Skip to content

impl(033): increment 5, coverage, seeds and completion - #124

Merged
bartekus merged 1 commit into
mainfrom
impl/033-final
Oct 20, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/033-final

Conversation

@bartekus

Copy link
Copy Markdown
Contributor

Spec 033, increment 5 of 5: remaining coverage, mutation seeds, Verification and implementation: complete. Stacked on #123.

  • crates/rustev-core/tests/actionability_rows.rs: the computed party of every cause class as the golden actionability.addressing.json (each provenance class declared/not declared caller-controlled, observed/accepted, mixed accepted, backend per origin, budget, deadline, capability, policy, no cause, mixed combinations) via the now-public rustev_core::computed_party; downgrade_grade over spec 032 fixtures (authoritative to estimated, a hint stays hint, a pass changes nothing); provenance_within on a step value; relax and relaxed{by}; escalate; third-party plus user-supplied missing fields computed upstream; a terminal check issuing no semantic request on support routing; the future-window example as judgment 2 and evidence 2 goldens.
  • Mutation harness: the seven seeds of the Acceptance section, each detected by a named test failing. The harness's 120 s timeout counted all seven as detected on macOS (binary launch stalls), so each was also applied in place and run to completion; that exposed the terminal-check seed surviving, fixed by the support-routing test above.
  • Verification section declares the acceptance commands; make verify runs 033.
  • Node binding conformance remains externally blocked on spec 027 and is not claimed.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Looking at the diff, this PR promotes spec 033 from pending to complete by adding computed_party as a public function, a new test module actionability_rows.rs, golden fixtures, and seven mutation seeds.

crates/rustev-core/src/actionable.rs -- computed_party is a clean thin wrapper over cause_party; making it pub (vs pub(crate)) matches the existing pattern for transient. No issue.

crates/rustev-core/src/lib.rs -- re-export of computed_party alongside transient is consistent.

crates/rustev-core/tests/actionability_rows.rs -- reviewed all six tests:

  • the_computed_party_of_every_cause_class: the 6×2×2 loop asserts the right Party for each (declared, observed) combination, then covers mixed-accepted, backend, budget, deadline, capability, policy, and multi-cause combinations. Assertions are consistent with the golden file's 35 entries and with the Party ordering implied by the combine tests (None < Caller < Host < Upstream).
  • downgrade_grade_lowers_a_grade_and_never_raises_one: correctly verifies that hint stays hint after a downgrade-to-estimated (no grade inflation), and a passing check leaves the grade unchanged.
  • provenance_within_on_a_step_value_reads_its_provenance_set: cleanly isolates provenance-class matching on a step value.
  • relax_marks_the_group_relaxed_and_the_decision_continues, an_escalate_consequence_decides_without_the_policy, a_third_party_and_a_caller_missing_field_are_addressed_upstream, a_terminal_check_issues_no_semantic_request: all look correct; the mixed-missing-fields case (third-party + user-supplied → upstream) follows the max-combine rule.

crates/rustev-core/mutation/seeds.py -- seven seeds added for spec 033. Each defect targets the right file/logic and the ACT test list is complete. No issue.

Golden files -- the trip goldens (trip-refused, trip-dropped) lack a trailing newline (\ No newline at end of file), while actionability.addressing.json ends with \n. This is a minor inconsistency driven by record_canonical() not appending a newline; it won't cause test failures unless common::golden normalises trailing newlines differently between the two code paths.

Makefile -- adding 033 to VERIFIED_SPECS is correct now that the spec is complete.

No substantive bugs, security problems, or logic errors found.

{"head": "017365ac7918c5ab8ce8a88c4d1e581a040013f4", "verdict": "no-findings", "findings": []}

Subject: e1dacd6...017365a, diff digest aa0b89b82f8feaa1d0c2ba72fe91bfa42ab0450b6dc13ae25d0612c0c7855fd1, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reading through the diff carefully, focusing on logic, consistency with goldens, and mutation seed correctness.

computed_party function (crates/rustev-core/src/actionable.rs:122-124): Clean delegation to Party::combine; signature and pub visibility match the re-export in lib.rs.

Golden table (actionability_rows.rs:80-99): The expected-party predicate matches every entry in actionability.addressing.json:

  • declared=true → Caller for all six classes ✓
  • declared=false, ThirdParty|SystemOfRecord → Upstream ✓
  • All others not declared → Host ✓
  • Mixed accepted (UserSupplied + ModelDerived, cc=[UserSupplied]) → Host (conservative; all classes must be caller-controlled for Caller) ✓

Ordering implied by golden mixed-cause cases: None < Caller < Host < Upstream, which is what the mutation seed "party combination prefers caller" is designed to break (makes Caller beat Host/Upstream, failing "caller and deadline → host").

Mutation seeds: The seed targeting rustev-contract/src/actionability.rs uses the ACT test list from rustev-core; since rustev-core depends on rustev-contract, this is correct — the harness mutates the dependency and verifies the dependent tests fail.

the_future_window_example_as_goldens: Both cases use T_NOW - 86_400_000 as the window start (past → check fails). Definition hash is identical in both goldens (same definition). Snapshot hashes differ because provenance class differs. Outcome and notice structure in the goldens are consistent with refuse vs drop_field consequences.

a_third_party_and_a_caller_missing_field_are_addressed_upstream: partner.code (third-party, not caller-controlled) → Upstream cause; party.size (user-supplied, caller-controlled) → Caller cause; max(Caller, Upstream) = Upstream. Test asserts computed = addressed_to = Upstream. ✓

downgrade_grade_lowers_a_grade_and_never_raises_one: The "hint stays hint" case correctly checks step status (Unresolved/insufficient) rather than calling step_grade, since a hint is too weak to read. ✓

Spec changes: implementation: complete is consistent with the implementation record and the verified-specs Makefile entry. The carve-out for the Node binding conformance item (blocked on spec 027) is accurately noted.

No bugs, security issues, or inconsistencies found.

{"head": "c9c5aa677abfd638780ab20ec62c205c421b8775", "verdict": "no-findings", "findings": []}

Subject: 9444b88...c9c5aa6, diff digest 5ce77fb9ccca33c3e7b4e94c78033c59a96b59d4ec13295106e14f339c3d87ff, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff: a new test file (actionability_rows.rs), four golden files, a new public function in actionable.rs, seven new mutation seeds, and the spec status flip to complete.

actionable.rs / lib.rs — computed_party is simply Party::combine(causes.iter().map(...)), delegating to the existing cause_party. The public re-export in lib.rs is consistent. No issues.

actionability_rows.rs — module imports (mod common; mod eq;) both exist under crates/rustev-core/tests/ per the repo context. All assertions are internally consistent:

  • The 35-row party table (6 classes × 2 declared × 2 observed + special cases) matches the golden actionability.addressing.json exactly.
  • accepted_mixed returning Host (not Caller) when one class is caller-controlled and another isn't is the correct spec behavior; the mutation seed "accepted causes ignore a non-caller class" is designed to catch the inverse error.
  • a_third_party_and_a_caller_missing_field_are_addressed_upstream: window is a future date so future_window passes; partner.code (third-party → Upstream) + party.size (user-supplied, caller-controlled → Caller) combined → Upstream; assertion action.computed == Upstream is correct.
  • relax test: lenient check fires first, relaxes the dates group (containing strict), decision continues to propose search_dated; notice addressed to Caller (user-supplied window) is correct.
  • a_terminal_check_issues_no_semantic_request: checks ev.pending().is_empty() before finish; the mutation seed "a terminal check does not stop semantic requests" exercises exactly this invariant.

Mutation seeds — Seeds 1 ("party combination prefers caller") and 4–6 target files not in this diff (rustev-contract/src/actionability.rs, rustev-core/src/evaluate.rs). These files exist in the base and hold logic from prior increments; the seeds are additive across all five increments, which is consistent with the cumulative design described in the implementation record.

Golden files — trip-refused.* and trip-dropped.* lack a trailing newline (\ No newline at end of file in diff). The addressing.json golden is produced with an explicit \n suffix. If common::golden does a raw-byte comparison, the four trip goldens would be matched byte-for-byte only if record_canonical() also omits the newline — which is the typical behavior for canonical JSON serialisers. Not a bug, but worth a note.

Spec — Status flip from pending to complete is correctly qualified: "the Node binding's conformance item awaiting spec 027."

No logic bugs, security issues, or spec inconsistencies found. The missing-newline in the four trip golden files is a minor style point, not a correctness issue.

{"head": "f0c1aaf79807e4949238f5e3f4ecf76ba9a7bfb5", "verdict": "no-findings", "findings": []}

Subject: fc88043...f0c1aaf, diff digest 5ce77fb9ccca33c3e7b4e94c78033c59a96b59d4ec13295106e14f339c3d87ff, 1 call(s). An AI comment is not an approval.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for spec 033, increment 5: coverage, seeds, and close.

Makefile — Adding 033 to VERIFIED_SPECS is correct; the spec's verification block is now present.

mutation/seeds.py — Seven new seeds cover the spec 033 invariants. The ACT target list includes actionability_rows, which is the test that finally catches the "terminal check does not stop semantic requests" seed (noted in the implementation record). All seed mutation sites and their old/new strings are plausible and internally consistent.

src/actionable.rs / src/lib.rs — computed_party is promoted to pub and re-exported alongside the existing transient. The doc comment cites the correct spec section (3.5.2).

tests/actionability_rows.rs — Comprehensive. Specific checks:

  • The loop order (declared=false, observed=true), (false, false), (true, true), (true, false) matches the golden exactly. ✓
  • The accepted_mixed case ([UserSupplied, ModelDerived] with cc = [UserSupplied]) expects Party::Host. With the ordering Upstream > Host > Caller > None, combine([Caller, Host]) = Host. The golden confirms "computed": "host". ✓
  • The "caller and deadline" case expects Host (max([Caller, Host]) = Host). ✓
  • The "caller, host and upstream" case expects Upstream. ✓
  • a_third_party_and_a_caller_missing_field_are_addressed_upstream: partner.code (ThirdParty → Upstream) + party.size (UserSupplied, cc → Caller) → max([Upstream, Caller]) = Upstream. ✓
  • The golden closure borrows rows mutably; after the last row(…) call, NLL ends the borrow before common::golden(&rows). Compiles correctly under modern Rust. ✓
  • window(T_NOW - 86_400_000, …) is a past timestamp; the check start > now fails, triggering consequences. ✓

Golden files — The trip goldens omit a trailing newline (differ from addressing.json which explicitly appends \n), but record_canonical() is used without \n appended by the test, consistent with how the existing one-line golden files (e.g., refusal-*.json) are apparently produced.

spec.md — Status updated from pending to complete. The implementation record accurately describes increment 5. The carve-out for the Node binding's conformance item is properly scoped to spec 027.

No bugs, security issues, or inconsistencies found.

{"head": "569ef74abed15e6347b621617b31158155769a99", "verdict": "no-findings", "findings": []}

Subject: 480d38c...569ef74, diff digest 5ce77fb9ccca33c3e7b4e94c78033c59a96b59d4ec13295106e14f339c3d87ff, 1 call(s). An AI comment is not an approval.

Base automatically changed from impl/033-cli to main October 20, 2026 14:53
@bartekus
bartekus enabled auto-merge (squash) October 20, 2026 14:57
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

The diff is a well-scoped increment: it publishes computed_party alongside the existing transient export, adds a 469-line test file covering the remaining rows of spec 033 section 5, updates four golden files, adds seven mutation seeds, and marks the spec implemented. Here is what I checked:

computed_party wrapper (src/actionable.rs +122–127, src/lib.rs) – thin delegation to Party::combine(causes.iter().map(...)), matching the existing cause_party helper. No logic gap.

Mutation seeds (mutation/seeds.py) – each seed targets a precisely identified snippet and is paired with the correct test target (ACT). The seeds and their inverses are internally consistent (e.g. the "transient for invalid_input" seed adds a branch that must not be there in production; the "terminal check" seed removes the guard that stops semantic requests). No seed accidentally targets production-path code.

Test logic (tests/actionability_rows.rs)

  • The party-table loop asserts the same want for observed=true and observed=false. This is correct per the golden: a single-class observed and a single-class accepted cause produce the same party, which is the declared semantics. The assertion error message omits observed from its label, a minor readability gap but not a correctness issue.
  • accepted_mixed case: Accepted { classes: [UserSupplied, ModelDerived] } with caller_controlled = [UserSupplied] → Host. This matches the corresponding seed ("accepted causes ignore a non-caller class" breaks it to Caller), so the test and seed are mutually consistent.
  • a_third_party_and_a_caller_missing_field_are_addressed_upstream: asserts fields.len() == 2 and computed == Upstream. With one ThirdParty and one UserSupplied missing field, max(Upstream, Caller) = Upstream under the Party ordering. Correct.
  • a_terminal_check_issues_no_semantic_request: support-routing fixture has three semantic steps; the test verifies ev.pending().is_empty() after the refusing check fires, then confirms the no-check variant requests them. Aligns with the "terminal check" seed.

Golden files – the trip-refused and trip-dropped goldens are single-line canonical JSON. The refused case traces ["check:future_window"] and refuses addressed to caller; the dropped case traces ["on_unresolved[0]","rule:undated"] and proposes search_undated addressed to host. Both are consistent with the trip() definition in the test (user-supplied → refuse, model-derived → drop_field with host addressing).

Spec update – status change to complete with the Node-binding conformance item explicitly carved out as waiting on spec 027. Accurately reflects what is and is not claimed.

No bugs, security issues, or inconsistencies found.

{"head": "59c9a9ceb7baa8d03892434550a1b5d30e9a3963", "verdict": "no-findings", "findings": []}

Subject: e91ff92...59c9a9c, diff digest 5ce77fb9ccca33c3e7b4e94c78033c59a96b59d4ec13295106e14f339c3d87ff, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus merged commit 355db90 into main Oct 20, 2026
7 checks passed
@bartekus
bartekus deleted the impl/033-final branch October 20, 2026 15:17
bartekus added a commit that referenced this pull request Oct 20, 2026
Spec 027, increment 2 of 7: JSON Schema emission (3.2.2). Stacked on
#124 (it covers 033's document types); independent of #125.

- `rustev_contract::schema_emit::document_schemas()`: a draft 2020-12
schema per public document type and version (28 files), derived via
`schemars` (=1.2.3, pure) from the serde definitions the bounded parser
uses; hand-written schemas for identities/digests, decimals and scope
handles; `schema` fixed by `const`; `ParseLimits` recorded as
`x-rustev-parse-limits`. Canonical JSON, committed under
`crates/rustev-contract/schema/`.
- `crates/rustev-contract/tests/schemas.rs`: committed bytes and file
set equal emission (`RUSTEV_BLESS=1` rewrites); emission deterministic
and canonical; every committed test-directory JSON document naming an
emitted version validates against it (`jsonschema` =0.59.0, dev-only, no
HTTP/file resolution); a schema refuses an unknown member and another
version.
- No document, parse bound or canonical byte changes. `schema_emit.rs`
joins `archive-policy.json` (hence 027's new `extends` on
`tools/rustev-release/`); the release audit (bans, licenses, sources)
passes with the new dependency.

Review round 1 (2 findings): (1) `zmij` is already in the lock file
(`[[package]] name = "zmij"`, a dependency of `serde_json` on main); the
diff shows only changed entries. (2) The parser reads judgment 1 and 2
(and the other #76 pairs) with one wire type and does not refuse a later
version's members under the earlier `schema` string, so the version
schemas share that type's schema except `schema`; a stricter version 1
schema would describe something the parser does not enforce (3.2.2: the
schema is descriptive). `schema_emit` documents this.

Review round 2 (1 finding): as in round 1, now shown by a test: a
committed judgment 2 golden relabelled `rustev.judgment/1` is accepted
by `Judgment::parse` and by the version 1 schema alike; the schema
describes the parser and is never stricter (3.2.2).

Review round 3 (7 findings): fixed: `Timestamp`'s schema states the
range its parser enforces (0 to 9999-12-31T23:59:59.999Z); a schema
without `properties` is a defect (`expect`), never silently skipped; the
test reads files fallibly; a needless clone removed. Answered:
`RankEntry.position` is a `u64` the parser accepts from 0, so its schema
says so (the "1-based" comment states what the core produces, not what
the parser refuses); `Handle`'s byte bound is the parser's and a
character bound is looser, never stricter, as the code says; `zmij` is
in the lock file (a `serde_json` dependency on main).

Review round 4 (3 findings, same class as before): plan 2, evidence 1
and judgment 1 schemas admit the later version's members because the
bounded parser reads both versions with one wire type and accepts them;
a schema stricter than the parser would describe validity the parser
does not enforce (3.2.2). The parity test now shows it for all three
pairs: a later-version document relabelled with the earlier version is
accepted by the parser and by the earlier schema. Rebased on main.

Review round 5 (1 finding, fixed): a derived schema without `properties`
panics naming the document; the committed-bytes test emits every
document, so such a defect fails CI before any schema is committed or
shipped, and is never skipped.

Review round 6 (2 findings, same class as before): spec 033 writes every
version 2 notice with its `action`, but the bounded parser does not
refuse a notice without one, so the version 2 judgment and evidence
schemas do not either (3.2.2: the schema describes the parser, never
stricter). The parity test now shows it: a version 2 notice without
`action` is accepted by the parser and by both version 2 schemas.

Review round 7 (4 findings): (1-3) The execution policy's ranges
(`max_attempts` in `1..=8`, at most four fallbacks, standalone and
embedded) are checked when a plan is compiled against the policy
(`rustev_core::execution`), not by the bounded parser; the schema
describes the parser (3.2.2) and the field descriptions state the
compile rule. The parity test now shows it: an out-of-range policy is
accepted by the parser and the schema. (4) fixed: the `extends` comment
names both: the archive list follows spec 021 3.5's rule in the
directory spec 031 owns, which is why the edge names 031.

Review round 8 (3 findings): (1) Repeated and wrong: `Cargo.lock` has
`[[package]] name = "zmij" version = "1.0.23"` from crates.io; `cargo
build --locked` and CI resolve it. (2) fixed: the private test struct in
`bounded.rs` no longer derives `JsonSchema`. (3) fixed: the
committed-document sweep includes `integrations/`.

Review round 9 (2 findings): (1) Repeated: judgment 1's schema admits
`refused` and `needs_input` because the parser reads both judgment
versions with one wire type and accepts them under version 1; the parity
test (`the_version_schemas_describe_what_the_parser_accepts`) relabels a
version 2 refusal as version 1 and shows both the parser and the version
1 schema accept it (3.2.2: the schema describes the parser, never
stricter). (2) fixed: `ContinuationInputs` no longer derives
`JsonSchema`.

Review round 10 (4 findings, the same class as earlier rounds): version
1 schemas admitting version 2 members, and a character length standing
for a byte bound. Both follow from 3.2.2: a schema is derived from the
types the bounded parser reads and is descriptive, the parser being the
only authority on validity; the parser reads both versions with one
type, and JSON Schema cannot express a UTF-8 byte length. To make every
schema say this itself, each now carries a root `$comment` stating it
(admits what the shared type admits, including later-version members;
byte, depth and count bounds in `x-rustev-parse-limits`, string lengths
counting characters; compile rules in descriptions, not enforced). The
parity test shows the parser accepting each such document. Rebased on
main.

Review round 11 (1 finding, fixed): the file-set comparison sorts both
lists, so it never depends on emission order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant