Skip to content

impl(070): rules_first listing, skipped and partial requests, conformance cases; spec 070 complete (increment 3) - #580

Merged
bartekus merged 1 commit into
mainfrom
impl/070-inc3
Nov 9, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/070-inc3

Conversation

@bartekus

@bartekus bartekus commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Spec 070 (rustev.extract-rules/2, #572), increment 3 of 3: rules first, and closure.

What changes

  • rustev-core: under fill: rules_first the rules run before the request is listed (3.7.2). Every required field filled: the step completes with skipped{rules_filled}, no request, attempt, reservation or capture (3.7.3). Otherwise one rustev.extract-request/1 lists the absent fields in declared order with its digest over that subset, byte-identical to the absent_fields request when the rules filled nothing (3.7.4). The output is validated against the subset, so a member for a rules-filled field is a record-level invalid_output fault; rules fields stand, requested fields take the model's values or absence reasons, and the rules are not evaluated again (3.7.5). Compilation accepts rules_first; budgets unchanged.
  • Runtime tests (3.7.6) in crates/rustev-runtime/tests/extraction.rs; conformance cases runtime.rules-first-skipped and runtime.rules-first-partial (tools/rustev-conformance/tests/runtime.rs, generated cases and fixtures review-excluded).
  • Closure: 070 in make verify (VERIFIED_SPECS) and CI's integrations-base group (scripts/acceptance/verify.py); spec implementation: complete with ## Verification.
  • Tests: crates/rustev-core/tests/extraction_rules_first.rs (skipped, partial and full requests, subset digests, replay identity, record-level fault, request failure, budget, PlanId).

Evidence

  • spec-spine verify 070-extract-rules-2, the full rustev-core, rustev-runtime, rustev-contract and conformance suites, workspace clippy and make gate pass locally; results posted as a comment.
  • node tools/rustev-conformance/js/run.mjs native integrations/rustev-node: 246 cases, 0 failures, including the two new runtime cases.
  • WebAssembly, measured locally with the pinned wasm-bindgen 0.2.129 and wasm-opt 116 (-Oz): 4,904,679 bytes raw with all of 070, within 057's 5,242,880 gate (3.11).
  • No existing golden, plan or PlanId changed (I-1).

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

AI review (findings)

Review of head 3496d30f

This PR implements increment 3 of spec 070: the rules_first extraction fill mode. I reviewed the implementation in extraction_eval.rs, the spec lifecycle change, the verification wiring, and the new test suites.

Spec lifecycle

specs/070-extract-rules-2/spec.md advances implementation: in-progress → implementation: complete. The spec already carries status: approved from the owner's prior ratification; changing the scheduling key is within the author's rights and matches the governance contract table (approved + complete = settled). No authority issue.

Core logic (extraction_eval.rs)

The pre-evaluation path (evaluate_rules called with withheld: &[] before the request is listed), the insertion into extraction.rules_first, and the retrieval/removal in complete_extract are consistent. The subset schema filtering preserves declared field order. The validate call correctly switches from b.schema to request.output (the subset), making a model member for a rules-filled field a record-level fault per spec 070 §3.7.5. The source-withholding check (withheld_read) in the rules_first branch correctly implements 038 §3.11.4. No correctness defect found.

Two low-severity observations

1. Comment placement out of numerical order (verify.py)

The inserted comment at lines 41–43 explains spec 070's group placement, but it appears between the comments for 064 and 065, while 070 numerically follows 067. The surrounding block reads: 064 … → 070 … → 065 … → 067 …. The actual GROUPS entry (integrations-base) is correct; only the comment ordering is inconsistent.

2. Field doc comment is incomplete (extraction_eval.rs, line 16–18)

The doc comment on rules_first reads "the rules' fields of a rules_first step whose partial request is listed, merged when the request completes." The state is in fact also populated for the fully-skipped (all-required-filled) case before complete_extract is called with Skipped. The comment describes only the partial-request sub-case.


{"head": "3496d30f072702847b1021390160efd8a047f895", "verdict": "findings", "findings": [{"path": "scripts/acceptance/verify.py", "line": 41, "severity": "low", "category": "other", "summary": "Comment explaining spec 070's group placement is inserted between the 064 and 065 notes, out of numerical order (070 > 067)."},{"path": "crates/rustev-core/src/extraction_eval.rs", "line": 16, "severity": "low", "category": "other", "summary": "Doc comment on `rules_first` field says 'whose partial request is listed' but the field is also populated for the fully-skipped (all-required-filled) case before complete_extract is called with Skipped."}]}

Subject: e11a8fc...3496d30, diff digest 4b4fb41d9b4162e6a67054c334e50612f12855a6c56886a864c80fd51f33b2be, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 9, 2026 01:59 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Head 45be0c7: fixed both low review notes (the 070 comment in scripts/acceptance/verify.py now follows the 067 note; the rules_first state comment covers the skipped case too). Local at 3496d30 (the fixes are a comment move and a doc comment): spec-spine verify 070-extract-rules-2 passed; full rustev-core, rustev-runtime, rustev-contract and rustev-conformance suites passed; workspace clippy -D warnings clean; run.mjs native: 246 cases, 0 failures; make gate and spec-spine couple pass.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

AI review (no-findings)

Review of PR 45be0c73

This PR implements "Increment 3" of spec 070 (rules_first extraction): evaluating rules before listing a request, skipping if all required fields are filled, and otherwise requesting only the absent fields.

Spec lifecycle change (specs/070-extract-rules-2/spec.md)

implementation is advanced from in-progress to complete. Per the contract, approved + complete is "settled" (no longer schedulable, unresolved units become errors). The verification section now carries concrete verify:cli commands, the implementation record documents increment 3, and all named tests are present in the diff. This change reflects the documented state; nothing in the governance rules requires a separate owner act for this field.

Logic review (crates/rustev-core/src/extraction_eval.rs)

Rules-first decision point (eval_extract): Rules run before request listing (evaluate_rules(id, &[])); if all required fields are filled, complete_extract is called with Skipped{rules_filled} and an immediate return—no request, no capture, no cost. Otherwise subset is built from unfilled fields in declared schema order, and make_extract_request receives it.

Partial request schema/digest (make_extract_request): output and schema_digest are set from the subset when Some; from the plan's precomputed values when None. This is consistent with spec 070 §3.7.4, and the test a_partial_request_lists_the_absent_fields_with_a_subset_digest explicitly asserts r.schema_digest == extraction_schema_digest(&r.output) and ≠ b.schema_digest.

Completion merge (complete_extract): The rules_first entry is removed from state, then fields are assembled in declared order: rules-filled fields (or SourceUnavailable if the source was runtime-withheld), FallbackNoMatch for skipped-not-requested fields, and model-supplied fields for partial-requested fields. The model iterator comes from std::mem::take(&mut fields), which holds exactly the requested (unfilled) fields—element count is consistent with what model.next().expect(...) demands.

Validation against subset: extraction_validate::validate is correctly called with &request.output (the subset schema), so a backend member for a rules-filled field (not in the requested schema) correctly produces InvalidBackendOutput.

Refactor of evaluate_rules: The extracted helper correctly handles the absence of a BoundExtractionFallback::Bound by returning [], and the withheld parameter is &[] at listing time (no screening yet) and the actual withheld slice at completion time for the non-rules-first path.

Conformance fixtures: Skipped case shows requests: [] and supplies: []; partial case shows one request, one supply, status: reproduced on replay. Schema digest in the evidence record is the full plan-level digest in both cases—consistent and intentional (the request document carries the subset digest).

Makefile / acceptance group: 070 added to VERIFIED_SPECS and integrations-base; matches the spec's Verification section.

Test removal in extraction_compile.rs: The ("rules_first is not supported by this build", ...) refusal test case is correctly removed now that the feature is implemented.

No bugs, security issues, authority changes, or governance violations found.

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

Subject: e11a8fc...45be0c7, diff digest 4f9f6eaeb5712560a3a9d169337d18816906b3ed15a17a419515445646ff9df5, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit e93a1c4 Nov 9, 2026
26 checks passed
@bartekus
bartekus deleted the impl/070-inc3 branch November 9, 2026 02:51
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