Repository navigation
feat(recipe): require_inputs, sha256_file, linked-file check and receipt with tests (R-1 slices 8+9) - #7137
Merged
Conversation
…slice 1/6) Pins contracts.nt, the census witness and the README contract count. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…(R-1 slice 1/6) Four falsification tests named fns that land in later slices, so pv lint --strict-test-binding reported 4 missing. Slice 1 now carries one shell-harness entry (pv validate); FALSIFY-APR-RECIPE-001..005 return in the slice that adds each test. Loader and example paths are marked as landing later. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…st ids) pr-light's fail_fast ids step refused FALSIFY-APR-RECIPE-000: ids must start at 001. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Schema types of `apr finetune --recipe` (RecipeMethod, the Raw* shapes, TrainRecipe); the parser, rules and receipt follow in later slices. FALSIFY-APR-RECIPE-003 cites the method-spelling test present at this head. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
TrainRecipe::parse reads the required keys and anchors relative paths at the recipe's directory; FALSIFY-APR-RECIPE-002 cites the test that proves it. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… (R-1 slice 4) Tests the required-key refusals the parser already makes (missing eval, missing keys, wrong schema id, unknown keys, wrong type, bad seed); FALSIFY-APR-RECIPE-001 and 003 cite them. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…lice 5) Empty strings, the heldout-aliases-train check, and the training block are validated by field; FALSIFY-APR-RECIPE-003 cites the tests. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…training numbers (R-1 slice 6) Tests of the rules slice 5 added; FALSIFY-APR-RECIPE-003 and 005 cite them. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
check_teacher validates the distillation block and TrainRecipe::load reads a recipe file; FALSIFY-APR-RECIPE-002 and 003 cite the tests. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…lice 8) require_inputs checks the files a real run reads and the data pin before any model is loaded; sha256_file streams a hash. FALSIFY-APR-RECIPE-002 and 005 cite the tests. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ice 9) require_inputs refuses a heldout linked to the training file; TrainRecipe::receipt carries the recipe, data and eval hashes and the engines. FALSIFY-APR-RECIPE-003 and 005 cite the tests. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts: # contracts/apr-recipe-v1.yaml
Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…der-error limit Review of #7130 at 4d8e724: no test planted an unknown key under eval, teacher or output, and the contract claimed every fault is listed in one message, which is false for a wrong type or an unknown key (the YAML reader stops at the first). Adds the three rows, one test that pins the limit, and narrows the contract wording. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Review of #7130 at d5c336a: the contract states heldout != train, teacher <=> distill and training numbers > 0, and the loader at this head checks none of them. Comment-only: names them as not yet enforced and drops stale slice numbering. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…or optional keys Keeps the review fixes of #7130 (reader-error limit, unknown-key rows), narrows the contract's not-yet-enforced list to what the loader still lacks, adds valid_optional_fields_are_kept and an infinity row for learning_rate. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ests catch length and digit faults Review of #7132 at a4a3cd7 (2 lanes FAIL): lexical_normalize dropped a repeated leading '..' and kept '..' above the root; is_sha256 survived two mutations. Rewrites the '..' arm, skips the same-file rule when data.train is missing, adds tests for both, and narrows FALSIFY-APR-RECIPE-005 to the pin's shape. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…slices 5+6 (PMAT-5316 slice 7) Merges R075h-recipe-6 (reviewed at ad76fcc) and keeps its review fixes. Adds tests that fail when a check is removed: alpha bounds inclusive, NaN and negative teacher numbers, the teacher rule waits for a known method, the same-file rule is silent for an empty heldout, load names the file in a refusal. The contract's not-yet-enforced list drops the teacher rule. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…h and the qlora refusal (PMAT-5316 slice 7) Review of #7135 at 15ba17a (2 lanes FAIL): a temperature bound of 1 passed every test, the not-UTF-8 error was not checked for the file name, no test put a teacher under qlora, and the body said a teacher block is not judged under an unknown method when only the presence rule waits. Adds a test for each; no change to the parser. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…le and the receipt (R-1 slices 8+9) require_inputs refuses a directory and a hard-linked held-out file, a pin on an absent file is not compared, sha256_file is tested past one buffer, and the receipt fields are asserted. The contract's not-yet-enforced list drops require_inputs and the receipt. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…w of a163e81) sha256_file returns nothing for a directory or a device instead of reading it, so /dev/zero as data.train no longer hangs require_inputs or the receipt. The training file is hashed only when a pin is set. Adds the one-million-a vector for the file hash. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…is not opened (review of a317857) Opening a pipe waits for a writer, so the check after the open still hung require_inputs and the receipt. The test now covers a pipe as data.train and eval.heldout, with and without a pin. The pin-only hashing of a317857 is taken back out: no test could tell it from hashing always. Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Pmat-Ticket: PMAT-5316 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
noahgift
marked this pull request as ready for review
November 16, 2026 10:05
noahgift
enabled auto-merge (squash)
November 16, 2026 10:07
|
§13.11 rung 1 — quorum shadow verdict Shadow mode: this records a verdict and merges nothing. A refusal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
apr finetune --recipework (Declarative recipes for finetune, distill and merge (CRUX-001/002) #5316). feat(apr-cli): recipe teacher rules and TrainRecipe::load (PMAT-5316 slice 7) #7135 (slice 7), feat(apr-cli): apr-recipe-v1 optional-field, alias, pin and training-number rules (R-1 slices 5+6) #7132 and feat(apr-cli): parse the required keys of apr-recipe-v1 (R-1 slice 3) #7130 have merged, and main is merged into this branch at bfde49c: the diff against main is now only this PR's +480/-17 in 3 files.TrainRecipe::require_inputs()checks the files a recipe names, after the recipe has parsed:base,data.train,eval.heldoutandteacher.modelthat is not a regular file is named in one error (a directory counts as missing);data.sha256pin that differs from the training file's hash is refused. A pin on a file that cannot be read is not compared; the missing file is the error.sha256_filehashes a regular file in 64 KiB reads. It returns nothing for a path that does not exist and for one that is not a regular file (a directory, a device, a named pipe), which it does not open.TrainRecipe::receipt()builds the apr-recipe-receipt-v1 fields: recipe name and hash, data and eval hashes (null when the file was not read), method, seed, engines, overrides and the validated-not-applied list (seed,eval).contracts/apr-recipe-v1.yamlcites the new tests under FALSIFY-APR-RECIPE-005, and its NOT YET ENFORCED list dropsrequire_inputsand the receipt.require_inputsorreceiptfrom the CLI yet; both are tested as functions. A later slice wires them in.Measured at head bfde49c (after merging main), 2026-11-16
cargo test -p apr-cli --lib train_recipe: rc 0, 40 passed.cargo test -p aprender-contracts --lib: rc 0, 2403 passed.cargo fmt --all -- --checkrc 0;cargo deny check advisoriesok.Measured at head 1ecc46a, 2026-11-16
cargo test -p apr-cli --lib recipe: rc 0, 57 passed.cargo clippy -p apr-cli --lib -- -D warnings: rc 0.python3 scripts/ci/fail_fast.py ids: rc 0.cargo fmt -p apr-cli -- --check: rc 0.is_filereplaced byexists; the canonical-path comparison always false; the inode number dropped from the comparison; the hash loop stopped after one read; the validated-not-applied list emptied. One no-op change passed, as a control. At 1ecc46a three more, each failing the new test on its 20-second limit: the regular-file check removed; the check moved to after the open; the check narrowed to directories only.Review history
/dev/zeroasdata.trainmaderequire_inputsandreceiptread without end; no test covered a path that is not a regular file; the wording said "published vector" for the file hash, which was only compared with the in-memory hash. Fixed in a317857: the regular-file test, a test that runs both calls against/dev/zerounder a time limit, and the published one-million-avector for the file hash.data.trainand aseval.heldout, with and without a pin, and the pin-only hashing is taken back out.baseanddata.trainlabels in the missing-file error, the wording of the pin error, and areceiptthat ignores the not-applied list it is given.Known limits
require_inputshashes the training file even when the recipe has no pin. That costs one read of the file and changes no result.mkfifoand is built on Unix only.--recipeflag conflicts; a seed above 9223372036854775807 is refused by the YAML reader as a type error.require_inputsruns. A file swapped between that check and the training run is not seen.receiptis called, not whenrequire_inputsran.cargo mutantswas not run.scripts/check_contract_test_binding.sh(CI runs it), clippy over the test module.ont-delta: none
Closes #7136
keep-open: #5316 master ticket, later slices still open
🤖 Generated with Claude Code