Repository navigation
Conversation
…the model declares R3: the fixtures come before the implementation, and they fail against it. Each fixture is a throwaway repository root with its own register, one shipped crate and, where the case needs it, the negative test: - a declared type with its negative test passes; - an undeclared type fails, including NotAProduct, ObservedBound and KappaError, which the audit sanctioned by name and no register declares; - a declared type without its negative test fails; - a declared type whose negative test is not a registered ID, or is not a build claim, fails; - a declaration is a (failure, negative) pair, made once; - an alias that hides the error type fails; a Result broken across lines is read whole. The rows live in the fixtures because the template's register is empty and a row in it would be copied into every repository cut from the template. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk
…clares
R5 says every public failure is typed, modeled, documented and covered by a
negative test; the audit enforced a fixed list of three names that are the
error types of one library. A row of model/ids.toml now declares a failure
type with two optional fields:
failure the error type as written in Result<_, E>
negative the ID of the build row whose test is its negative test
A shipped crate may name an error type in a Result only when a row declares
it, its negative test is a registered build row, and a test whose name ends in
that ID exists. A type is declared once. An undeclared type, an alias that
hides the error type, a declared type without its test, and a negative test
that is not registered or not a build claim are all refused, with the rule in
the diagnostic.
The three fixed names are removed: no register in this repository declares
them, and the template declares no failure of its own.
The audit reads a Result across lines, so a signature that rustfmt has broken
is read whole, and splits its arguments at the top level, so
Result<Vec<(u8, u8)>, E> has the error type E. The test-name scanner moves
from the BDD test to repo-conformance so that the meta-gate and the audit ask
the same question of the same list.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk
This branch has not been deployed
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.
Closes #18.
Change
cargo xtask audit-limitsno longer carries a list of error types. A shipped crate may name an error type in aResultonly when the register declares it.A row of
model/ids.tomldeclares a failure type with two optional fields, so the declaration is a field of an existing register row and no fourth register or schema is added (R1):Model::check(socheck-model, the meta-gate andaudit-limits) refuses a malformed declaration: afailurewithout anegativeor the reverse, a name that is not a bare type name, a type declared by two rows, anegativethat is not a registered ID, anegativethat is not abuildrow (anopenclaim is never asserted; asome-trueclaim is not established here).audit-limitsthen refuses:Result<_, E>whoseEno row declares (the last path segment is compared, socrate::OverflowisOverflow;Box<dyn Error>is no declared name);Resultthat names no error type (io::Result<T>,Result<T>), since an alias hides the type;Result<..>is read across lines and its arguments are split at the top level, so a signature rustfmt has broken, andResult<Vec<(u8, u8)>, E>, are read correctly. A type alias such aspub type R<T> = Result<T, Overflow>;is the one placeOverflowis named; uses ofR<T>carry noResult<.NotAProduct,ObservedBound,KappaError: I searched the repository (grep -rnover every file buttarget/and.git/). The only occurrence was the list inxtask/src/audit.rs. No register row, scenario or test uses them, and the template declares no failure of its own, so they are removed and not turned into rows.The test-name scanner moves from
crates/conformance/tests/bdd.rstorepo_conformance::workspace_test_namesso that the meta-gate and the audit ask the same question of the same list.xtaskgains the path dependencyrepo-conformance(bothpublish = false; no new external dependency;Cargo.lockgains one dependency edge).R3 order
Two commits, in order:
5ebbb08test(audit): the fixtures (12). Against the old audit 9 of the 12 fail; the 3 that pass are the cases the old audit already got right (a non-shipped crate, a comment, the template itself).5d99a17feat(audit): the implementation; all 12 pass. It also adds one more fixture,only_a_bare_type_name_is_a_declared_name, which passes on arrival.The register rows of the fixtures live in the fixtures (each builds a throwaway repository root with its own
model/, one shipped crate and, where needed, the negative test). The template's ownmodel/ids.tomlstays empty: a row in it would be copied into every repository cut from the template, and its scenario directory is likewise empty. So the "row, scenario, failing test" of R3 is a fixture register and failing fixtures, not rows in the template's register.Fixtures of the audit (
xtask/src/audit.rs,mod tests)crate::Overflowand the alias form)a_declared_failure_type_passesan_undeclared_failure_type_failsa_declared_type_without_its_negative_test_failsa_declared_type_whose_negative_test_is_not_registered_failsbuildrow failsa_negative_test_is_a_build_claimfailurewithoutnegative,negativewithoutfailure, a type declared twicea_declaration_is_a_pair_and_is_made_onceno_error_type_is_sanctioned_without_a_declarationan_alias_that_hides_the_error_type_failsResult, ok and bada_result_broken_across_lines_is_read_wholeBox<dyn ..>and a fn-pointer arrowonly_a_bare_type_name_is_a_declared_namepublish = falsecrate, comments and#[cfg(test)]stay out of scopea_crate_that_does_not_ship_is_not_audited,a_result_in_a_comment_or_a_test_module_is_not_auditedthe_template_itself_passesValidated
In
/home/claude/agents/template-r5, withRUSTUP_TOOLCHAIN=stable(1.97.0; the pinned 1.97.1 cannot be downloaded here):cargo test --workspace --locked: all pass (27 inxtask, of which 13 are new; 4 + 3 inrepo-conformance, 1 inrepo-model).cargo fmt --all -- --checkandcargo clippy --workspace --all-targets -- -D warnings: clean.cargo run -p xtask -- check-model,audit-limits,audit-deferral,audit-dependency-updates: pass.cargo run -p xtask -- audit-bootstrapandvalidatestop atprismpm.lock is required(no SDK here);validaterunscheck-model,audit-limitsandaudit-deferralbefore it.prismpm template check,prismpm lock checkandcargo denywere not run (no SDK;cargo-denyis not installed). Thebootstrapjob fails at the locked SDK on every PR, as onmain.Planted defect
A shipped crate (
crates/planted, nopublish = false) in the real tree, planted alone, run, then removed:pub fn f(x: u8) -> Result<u8, Overflow>with no register rowcargo run -q -p xtask -- audit-limits(exit 1)gate failed: R5: every public failure is typed, modeled, documented, and covered by a negative test. ...crates/planted/src/lib.rs:2: error typeOverflowis not declared in model/ids.tomlOV-01(failure = "Overflow",negative = "OV-02") andOV-02added, no testOV-01: failureOverflowhas negative test OV-02, but no test name ends inov_02``negative = "OV-09"model is inconsistent: OV-01: failureOverflownames negative test OV-09, which is not a registered ID (R5)crates/planted/tests/negative.rswith#[test] fn refuses_past_the_bound_ov_02()andnegative = "OV-02"audit-limits: every error type a shipped crate names is declared with a negative test (1 declared) (R5)The last row is the restored result. The planted crate and rows were removed afterwards;
Cargo.lockcarries only the newxtaskedge. Recorded inTEMPLATE-VERIFICATION.md.Not met
just vvas a whole was not run (noprismpm.lock, no SDK); see Validated.Owner decisions
negativemay name the declaring row itself (allowed here; the row's own test is then its negative test).audit-limitsnow needs a loadablemodel/; a repository with nomodel/fails it, ascheck-modeldoes.https://claude.ai/code/session_01F4DJnZorC2Jd4MJfN9DbZk
Generated by Claude Code