Skip to content

impl(026): live re-execution - #150

Merged
bartekus merged 3 commits into
mainfrom
impl/026-live-re-execution
Oct 21, 2026
Merged

bartekus merged 3 commits into
mainfrom
impl/026-live-re-execution

Conversation

@bartekus

@bartekus bartekus commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Spec 026, increments 1 and 2: live re-execution of a recorded decision shape as a new decision, behind a host authorization seam, and its comparison with the verified historical case.

  • crates/rustev-contract (src/live.rs, new): the rustev.live-reexecution/1 document (LiveReexecution): the new decision, plan and computed snapshot identities, evaluation time, opaque subject and scope, the historical case as a HistoricalLink (identities, evaluation time and the bundle's record digest, never content) or explicit none, admission, the new run record's digest, termination and cost summary, one LiveEffect per proposed external attempt (with the host's AuthorizationReference or the typed refusal, and the dispatch observation), unreconciled attempts, delivery, capture and retention posture, and the comparison section. check bounds every list and free text and refuses an effect or liability not attributable to the new decision, or a new decision id equal to the historical one. AuthorizationRequest and its tagged digest (rustev.live-authorization/1) bind an answer to exactly one attempt; refusals are missing, expired, mismatched, errored and refused.
    • tests/live.rs: bounds, refusals, digest binding and round trips.
  • crates/rustev-runtime (src/live.rs, new; src/driver.rs): Runtime::reexecute_live(plan, LiveRequest, &dyn LiveAuthorizer, cancel), the only function that takes an authorizer. Before admission it refuses a reused historical decision id, a snapshot whose computed SnapshotId differs from the stated one, an invalid capture configuration, an out-of-range historical decision id, and a plan whose worst-case attempts exceed the document bound. It then runs an ordinary spec 003 decision; in the attempt driver, after the full worst-case reservation and the deadline and cancellation re-check, the host is asked about that exact attempt (a panic is contained as errored). An allow counts only if it names the presented digest and is still valid by the runtime clock. A refusal releases the reservation, sends nothing and stops the request; retries and fallbacks are each authorized again.
    • tests/live.rs: section 5 rows 2 to 6 and 9; allow, refusal, mismatch, error, panic, expiry, retry, fallback, cancellation, unknown charge, possibly continuing work and sink failure with exact attempt attribution; exact steps still judge when the host refuses all external work; cache and batch bypass; capture. Compile-fail examples show decide and decide_with_capture take no authorizer.
  • crates/rustev-eval (src/live.rs, new): compare_live(LiveCase), a pure function over host-supplied documents. It refuses a document that does not check, an unbound run record, a plan that is not the document's, and a bundle other than the linked one; verifies the historical case by spec 004 reproduction (an unavailable item makes the comparison unavailable, nothing restored); then reports agreement, live-diverged (proposal_changed or unresolved_category_changed) or incomparable, with snapshot, plan, evaluation-time, artifact, backend, definition, policy, calibration, runtime count, cost, termination, cancellation, remote-state, retention and delivery differences reported apart. with_comparison returns a copy; no source is modified.
    • tests/live.rs: section 5 rows 1, 7 and 8; byte-identical sources after a live run and its comparison; a source scan showing eval names no runtime, backend or authorizer.
  • Mutation seeds: eight live: seeds in crates/rustev-runtime/mutation/seeds.py and two live-comparison seeds in crates/rustev-eval/mutation/seeds.py; all ten detected.
  • Makefile: 026 joins VERIFIED_SPECS. tools/rustev-release/archive-policy.json: the new source files in the contract, runtime and eval archives.
  • Spec 026: implementation record. Derived shards regenerated.

What remains: the comparison reports the first unavailable item reproduction meets, not every item; served identity stays unknown until a run record carries it; the live document's later members (spec 043 3.9) are not part of this implementation.

Owner decisions (engineering choices made within the spec, open to review; see the implementation record):

  • E-26-1: an authorization refusal is typed in the live document, and the core is supplied backend_unavailable with detail authorization_refused: <refusal> (the spec 003 3.6.4 form). Spec 002's four runtime reasons, rustev.run/1 and the core are unchanged.
  • E-26-2: the authorizer is synchronous and lives in rustev-runtime, not in the core seams; its answer is neither serializable nor clonable, and only its reference is kept. Validity is a duration judged by the runtime's clock.
  • E-26-3: live runs bypass the memory cache and general batching (a diagnostic says so when the plan enables either); each attempt is fresh work, authorized on its own.
  • E-26-4: no JSON Schema yet: the live document is not added to spec 027's emitted schemas, since that would regenerate the committed TypeScript declarations. A spec 027 follow-up.

Local verification (macOS arm64): make gate, make code (build, test, clippy -D warnings, fmt, boundaries), .bin/spec-spine verify 026 (10 commands, 10/10 seeds detected), bash scripts/check-authored-content.sh.

Review round 1 (1 finding, fixed): LiveReexecution::check refused a historical decision id longer than 256 bytes but not an empty one, so a parsed document linking an empty historical id passed check although reexecute_live refuses it. check now refuses it too; the_historical_decision_id_is_one_to_256_bytes checks 0 and 257 bytes (refused) and 256 bytes (accepted).

Rebased onto main after #143, #144 and #145 merged (derived shards regenerated).

Review round 2 (0 findings).

Review round 3 (0 findings), after the rebase onto #144.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR for spec 026 (live re-execution). I'll work through the contract, runtime, and eval layers in turn.


Contract (crates/rustev-contract/src/live.rs)

LiveReexecution::check() validates the historical link as:

if let Historical::Linked(h) = &self.historical
    && (h.decision_id == self.decision_id || h.decision_id.len() > 256)
{
    return Err(LiveDocError::DecisionId);
}

The condition checks len > 256 but not is_empty(). A document with Historical::Linked carrying a zero-length decision_id passes structural validation: "" == "live-1" is false, 0 > 256 is false, so no error is returned. The runtime's reexecute_live does enforce the 1–256 byte constraint (InvalidHistoricalLink), so documents produced by it are sound. But LiveReexecution::parse(bytes) + check() — the normal wire-document path — accepts an empty historical id, violating the 1–256 byte invariant stated in the implementation record and mirroring what AuthorizationReference::new enforces for references.

Runtime (crates/rustev-runtime/src/live.rs)

  • worst_case_attempts, cache/batch bypass, deadline/cancel re-check after authorization, Presented push on both allowed and refused outcomes, and Charge::Unknown attribution to unreconciled all look correct.
  • Role assignment (tries > 1 → Retry, t > 0 → Fallback, else Primary) correctly gives priority to retry over fallback for retries on a fallback target.
  • The expiry check uses now captured before the authorizer is called and cx.rt.clock.now() after — conservative and intentional.

Eval (crates/rustev-eval/src/live.rs)

  • HistoricalLink::of(case.bundle).ok().as_ref() != Some(link) correctly rejects any bundle other than the linked one.
  • result_change correctly distinguishes proposal vs. abstention category divergence.
  • delivery_change / retention_change logic is consistent with the spec definitions.
  • with_comparison returns a clone; sources are unchanged. Correct.
  • The source scan (eval_has_no_backend_runtime_or_authorizer_path) is scoped to src/, not tests/, which is intentional.

Spec and governance

  • implementation: complete is appropriate given the delivered code and verification block.
  • Addition of 026 to VERIFIED_SPECS is consistent with the verification commands in the spec.
  • The extends entry for 031-public-api-and-release-family over tools/rustev-release/ with nature: additive correctly claims the archive-policy change.

Finding

LiveReexecution::check() at line ~540 of crates/rustev-contract/src/live.rs omits the is_empty() guard on HistoricalLink::decision_id. A wire document with Historical::Linked { decision_id: "" } passes parse + check but violates the 1–256 byte constraint that reexecute_live enforces before admission. The fix is || h.decision_id.is_empty() added to the existing condition.

{"head": "2c71c9cbb0fa67206e22f41ec805430533855411", "verdict": "findings", "findings": [{"path": "crates/rustev-contract/src/live.rs", "line": 540, "summary": "LiveReexecution::check() does not reject an empty HistoricalLink::decision_id (only checks len > 256 and equality with the new id), so a parsed wire document with an empty historical decision id passes structural validation despite the 1-to-256-byte constraint enforced by reexecute_live."}]}

Subject: 1204bc8...2c71c9c, diff digest 1b5582986f8056b179cf1e9bdc99ab20f5affd09611f38a611fa457e7459a83f, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 21, 2026 18:33 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/026-live-re-execution branch from e08c68e to 09bf419 Compare October 21, 2026 19:21
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which implements spec 026 (live re-execution with fresh observations) across rustev-contract, rustev-runtime, and rustev-eval.

Contract layer (crates/rustev-contract/src/live.rs)

The AuthorizationRequest digest uses tagged_digest(AUTHORIZATION_REQUEST_TAG, &canonical_bytes(self)?), and the test the_request_digest_binds_every_member verifies every field contributes. AuthorizationReference is bounded at construction and on parse. LiveReexecution::check enforces list counts and text limits. attempt_prefix correctly escapes %, /, ,. The binds method guards on run_digest.is_some() before comparing digests. No issues found here.

Runtime layer (crates/rustev-runtime/src/live.rs and driver.rs)

reexecute_live correctly refuses before admission (historical ID reuse, snapshot identity mismatch, oversized historical link, invalid capture, plan exceeding MAX_EFFECTS). The live path bypasses memory cache and general batching with a diagnostic. DispatchAnswer carries neither Serialize nor Clone, so it cannot be retained. The expiry check cx.rt.clock.now() >= now.saturating_add(valid_for_ms) is correct for the manual-clock test where the clock advances inside the authorizer. Panic containment via AssertUnwindSafe is safe because the worst outcome is a corrupted authorizer that produces Errored on future calls, preventing dispatch. The presented push happens after both the early-return error paths (request_document failure, asked.digest() failure), meaning those rare defect paths produce no LiveEffect entry; these are programmer-error paths on well-formed requests, not operational scenarios. worst_case_attempts uses u64::saturating_add correctly.

Eval layer (crates/rustev-eval/src/live.rs)

compare_live correctly verifies the historical case via spec 004 reproduction before comparing outcome categories. HistoricalLink::of failure in ok().as_ref() != Some(link) returns incomparable("historical-link-mismatch") rather than a more precise reason, but this is safe. The eval_has_no_backend_runtime_or_authorizer_path test scans src/ with read_dir (non-recursive), which is adequate since the repo context shows no subdirectories under crates/rustev-eval/src/. The LIMITATIONS and EXCLUSIONS constants are all under the 256-byte text limit enforced by check.

Governance

implementation: pending → complete is consistent with approved + complete = settled. Spec 026 claims additive authority over tools/rustev-release/ (spec 031's directory), and the archive policy correctly adds three new src/live.rs entries. Spec 026 is added to VERIFIED_SPECS in the Makefile. The eight runtime mutation seeds and two eval mutation seeds cover the critical dispatch/authorization paths.

No concrete defects found.

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

Subject: 7d65c1b...09bf419, diff digest a21764ee56cb32bfc5edf6e12f423da3eab6b257022192d20c4279ec2b4408e4, 1 call(s). An AI comment is not an approval.

Spec 026, increment 1 of 2: the contract document and the runtime entry
point (3.1 to 3.6). Plan in the spec's new implementation record.

- `rustev-contract/src/live.rs`: `rustev.live-reexecution/1` under
  `REPLAY_V1` (historical link by digest and identities, admission, new
  run record digest, one effect per proposed attempt with the host's
  reference or typed refusal and the dispatch observation, unreconciled
  liability, delivery, capture and retention posture, comparison
  section), `AuthorizationRequest` with its tagged digest,
  `AuthorizationReference` (1 to 256 bytes) and the five refusals, all
  recorded as `authorization_refused`. Bounds and attribution checks.
- `rustev-runtime/src/live.rs`: `Runtime::reexecute_live`, the only
  function that takes a `LiveAuthorizer`. Refuses before admission a
  reused historical decision id, a snapshot whose computed identity is
  not the stated one, an invalid capture and an unbounded plan. In the
  driver, every attempt (primary, retry, fallback) is presented after its
  reservation and immediately before dispatch; a refusal releases the
  reservation, sends nothing and stops the request. Live requests bypass
  the memory cache and general batching.
- New source files join spec 031's reviewed archive list; 026 extends
  `tools/rustev-release/` for it.
- Tests: `rustev-contract/tests/live.rs`, `rustev-runtime/tests/live.rs`
  (section 5 rows 2 to 6 and 9, scripted authorizers), compile-fail
  examples showing `decide` and capture take no authorizer.
Spec 026, increment 2 of 2: comparison of a finished live run with its
verified historical case (3.7, 3.8); implementation complete and 026 joins
`make verify`.

- `rustev-eval/src/live.rs`: `compare_live`, pure over host-supplied
  documents. Refuses a document that does not check, a run it does not
  bind, a plan that is not its own and a bundle other than the linked
  one; verifies the historical case by spec 004 reproduction (an
  unavailable item makes the comparison `unavailable` with its reason,
  never restored); compares the adapter's named fields: `agreement`, or
  `live-diverged` with a proposal or unresolved-category change; a
  cancelled live run is `live-not-judged`. Identity, observation, cost,
  cancellation, remote-state, retention and delivery changes are reported
  apart, with fixed exclusions and limitations. `with_comparison` returns
  a copy of the live document.
- `reexecute_live` also refuses a historical link whose decision id is
  outside 1 to 256 bytes.
- Tests: `rustev-eval/tests/live.rs` (section 5 rows 1, 7 and 8, source
  immutability, separation scan). Seeds: eight `live:` runtime seeds and
  two `live-comparison` eval seeds, all detected.
- Spec: implementation record, verification block, `implementation:
  complete`; Makefile `VERIFIED_SPECS` gains 026.

Checked: make gate, make code, spec-spine verify 026, and verify 002,
003, 004, 013 and 017 (all seeds detected).
@bartekus
bartekus force-pushed the impl/026-live-re-execution branch from 09bf419 to a2d15de Compare October 21, 2026 19:48
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR implementing spec 026 (live re-execution with fresh observations) across rustev-contract, rustev-runtime, and rustev-eval.

Contract (crates/rustev-contract/src/live.rs): The LiveReexecution document structure, AuthorizationReference bounds (1–256 bytes refused on construction and parse), attempt_prefix escaping (%, /, ,), attribution checks, and comparison bounds all look correct. The check method verifies effects are attributed to the new decision, not the historical one, and the test confirms attempt_prefix("a/b,c%") == "a%2Fb%2Cc%25/". The DispatchAnswer correctly omits Serialize/Clone, keeping authorization material in-process only.

Runtime (crates/rustev-runtime/src/live.rs, driver.rs): Pre-admission refusals (reused historical ID, snapshot identity mismatch, invalid capture, unbounded plan) fire before the authorizer is called. catch_unwind(AssertUnwindSafe(...)) correctly contains authorizer panics as Errored. The authorization block in driver.rs is placed after reservation and before cx.hold(); a refusal calls cx.release(reserved) and b.stop(...), which returns from drive() with no retry, fallback or downgrade path. Both cache bypass and batch bypass are correctly conditioned on cx.live.is_some(), and each retry/fallback re-enters the authorization block. The presented list is pushed regardless of outcome, enabling Dispatch::NotDispatched for refused attempts in the document.

Eval (crates/rustev-eval/src/live.rs): compare_live is a pure function with no runtime, backend or authorizer imports (verified by the eval_has_no_backend_runtime_or_authorizer_path test scanning src/). The four incomparable guards (invalid document, run mismatch, plan mismatch, wrong bundle) fire before touching any historical data. with_comparison correctly returns a clone without modifying the input.

Spec and lifecycle: implementation: pending → implementation: complete is correct since code is delivered. The extends entry claims tools/rustev-release/ from spec 031 with nature: additive to cover the archive-policy.json additions, satisfying the spec-first coupling requirement. Spec 026 joins VERIFIED_SPECS in the Makefile.

No concrete defects found.

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

Subject: 2d6a1f2...a2d15de, diff digest d9aa537c9d3d05c50796c285c660ce1858657127bfb7b180c2ddd759908373b8, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus merged commit c58c52e into main Oct 21, 2026
7 checks passed
@bartekus
bartekus deleted the impl/026-live-re-execution branch October 21, 2026 20:16
bartekus added a commit that referenced this pull request Oct 21, 2026
Spec 020: remote protocol refinements, increments 1 to 6 (phase
ceilings, the host-endpoint principal reference and `rustev.remote/2`,
bounded connection reuse, `rustev.run/2`, runtime-planned remote
batches, Jev and verification). Every refinement is disabled by default,
and a binding with every refinement disabled keeps its spec 009 bytes,
artifact and `PlanId`.

**Awaiting the owner.** Spec 020 stays `implementation: pending`, and so
stays out of `make verify`, because two acceptance items are not
verifiable as written (recorded in the spec's implementation record):

1. Multiplex cancellation (pool acceptance). The HTTP binding speaks
HTTP/1.1 only, so a pool policy must declare one stream per connection;
nothing is multiplexed and there is no multiplexed cancellation to test.
Covering it needs an HTTP/2 binding, a new dependency that spec 021's
audit would have to admit.
2. "New qualification evidence for every enabled refinement" (Jev). No
refinement is enabled on the Jev adapter, so there is none to produce;
enabling one would need a new mapping version and a newly authorized
qualification, which this spec does not authorize (3.7).

The ruling on these two decides whether 020 can be marked implemented.

## Per increment

- **1, phase ceilings (3.4, 3.1).** `rustev-remote-http/src/phases.rs`
(new): `PhasePolicy` (a positive ceiling per phase; zero refused at
construction), `TransportPhases` (disabled by default), `PhaseClock`
(each phase's allowance is the lesser of its ceiling and the budget left
when it starts; phases only move forward) and `phased`.
`HttpTransport::with_phases` enters resolution, connect, TLS handshake,
request write, first response byte and response body on the real
connection; `TransportError::PhaseExpired`. An expiry before request
bytes is `transport_unsent`, after them `transport_interrupted`; no
retry is added. The cancellation acknowledgement ceiling bounds every
cancel exchange. `rustev.remote-exchange/1` gains an optional
`phase_expiry`; `AdapterBinding::transport_phases` is not written when
disabled.
- **2, principal reference and `rustev.remote/2` (3.6, 3.7).**
`rustev-contract`: `PROTOCOL_V2`, `InferRequest::principal`
(`WirePrincipal`, omitted when absent, refused in version 1 or when not
canonical) and its domain-separated evidence digest; the exchange
record's optional `principal` holds only that digest.
`rustev-remote-http/src/principal.rs` (new): `EndpointOperator`,
`PrincipalSource`, `HandleAsReference`, `PrincipalPosture`,
`PrincipalWire`. The client negotiates exactly `protocol_major` (1 by
default) and refuses a principal for a third-party endpoint, over
version 1, or with a bad label. The server serves
`ServerConfig::versions` (`[1]` by default) and includes the principal
in idempotency content. Redirects stay unfollowed.
- **3, bounded connection reuse (3.5).**
`rustev-remote-http/src/pool.rs` (new): `PoolPolicy`, host-owned
`ConnectionPool`, `KeyMaterial` (every isolation member; credential and
principal only as digests; unknown material never reuses).
`HttpTransport::post_observed` swaps stream hooks per exchange, so the
tracker and phase clock are always the current exchange's. A stale
connection is never replaced mid-exchange; exhaustion is
`transport_unsent` with `observed{0}`. The exchange record gains an
optional `connection`; the binding gains `connection_pool`, not written
when disabled.
- **4, `rustev.run/2` (3.2, I-4).** `rustev-contract`: `RUN_V2`,
`RunRecord::remote_evidence` and `remote_evidence_truncated` (absent in
every other version, so version 1 and 3 bytes are unchanged), bounded
`RemoteEvidence`, `check_version_members`, `project_v1`. `rustev-core`:
`EvidenceSink::run_schema` and `DecisionBackend::take_remote_evidence`,
both defaulted. `rustev-runtime`: version 2 exactly when the sink
selects it; one entry per remote attempt in order; a rejected version 2
record is never retried as version 1. `rustev-remote-http`:
`ClientConfig::run_evidence`, `ExchangeSink::deliver_located`, and
`Exchanges::deliver` now returns the record digest and delivery result.
`rustev-eval`: bundles hold the version 1 projection, so replay is
unchanged and offline; `remote_evidence::availability` checks references
against a host store, apart from judgment parity.
- **5, runtime-planned remote batches (3.3).** `RemoteClient` offers
spec 017's `batch_capability` only when `ClientConfig::batch_dispatch`
and the negotiated terms both allow shared-state batching (bound is the
lesser). `infer_batch` refuses an oversized or mixed batch before any
byte, checks each member as an independent attempt, sends one exchange
in the runtime's order bounded by the earliest member budget, and
answers each member from its own answer. New exchange attribution
`runtime_planned`.
- **6, Jev, drift, verification.** A negotiated endpoint answering
another protocol version is `identity_mismatch`.
`rustev-jev/tests/refinements.rs`: Jev offers no general batch seam, its
adapter-scoped batch stays shared-state, and no spec 020 member or
remote evidence appears; its binding and mapping are unchanged. Spec
020: acceptance mapped item by item and a declared `verify:cli` block.

Amended specs whose shared APIs change: 003 (runtime run/2 delivery),
004 (eval bundles and availability), 009 (binding members, exchange
record, `TransportError`, `Exchanges::deliver`), 012 (Jev), 017 (the
batch seam's remote side). Their verify passes.

## Interpretations recorded in the implementation record

- 3.1's explicit `disabled` values are explicit in the configuration
types but not written into the binding document, so every existing
adapter's artifact and `PlanId` stay byte-identical (section 2).
- The request-write phase ends at the first completed flush after the
connection took the request body; the response-body phase includes the
response head.
- The cancellation acknowledgement ceiling bounds the whole cancel
exchange, whose own transport phases also apply.
- `rustev.remote/2` keeps the HTTP paths `/rustev/remote/1/...` and the
schema strings; the `version` member distinguishes it. A version 1
server refuses a version 2 describe with 400, reported at construction
as a negotiation failure.
- The isolation key's authority is the configured scheme, host and port,
not the resolved address.
- Replay never consults an exchange store; "without a transport or store
call" is read as that, and availability is a separate, explicit check.
- A plan 3 decision's record stays `rustev.run/3` without remote
evidence even for a sink that selected version 2.
- Spec 017's batch report has one cancellation answer and one remote
state, so one possibly continuing member makes every member of its batch
possibly continuing with charge unknown: never understated, possibly
overstated until the host reconciles.
- A host-operated server hands a version 2 request's reference to the
hosted backend as `CallContext::principal_handle`; version 1 keeps spec
009's empty handle.

## Local verification (macOS arm64)

Rebased onto `main` at df053f6 (4cecab0 dropped as already applied as
#146), then onto 2d6a1f2 after #143 and #144 merged, then onto c58c52e
after #150 (spec 026) merged; no conflicts and no call sites to fix.
`.bin/spec-spine verify 026` also passes. `make gate`, `make code`
(build, test, clippy `-D warnings`, fmt, boundaries), `.bin/spec-spine
verify` for 020, 003, 004, 009, 012 and 017 (spec-spine 0.31.0), `bash
scripts/check-authored-content.sh`.

Review round 1 (1 finding, reported by two groups, fixed): the
`RustevRun1` and `RustevRun3` declarations (both packages) carried
`remote_evidence` and `remote_evidence_truncated`, which spec 020 says
are `rustev.run/2` only. The declarations were faithful to the schemas,
and the schemas to the parser: the run record's parser read every
version with one type and did not refuse those members outside version
2. Fixed at the source: `versioned_document!` takes an optional `check =
f` rule, and the run record's parser applies `check_version_members`
(refusing either member in version 1 or 3, and a version 2 record
without the list or beyond its bounds, as `ParseError::Schema`). The run
schemas now state that rule: `rustev.run-1` and `rustev.run-3` drop both
members and their now-unreferenced `$defs` (byte-identical to `main`
again), and `rustev.run-2` requires a non-null list. Declarations
regenerated with `gen-types.mjs`.
`crates/rustev-contract/tests/run_v2.rs`
(`the_parser_and_the_schemas_hold_the_version_rule`) checks parser and
schemas agree for each case; the implementation record says so.

Review round 2 (1 finding, fixed): an attempt that passed `prepare`
(which records its evidence as `pending`) and was then withdrawn from a
coalescing exchange before it sent kept `pending`: `finish` completes
only the members in the exchange record, and `note_unexchanged` leaves
an existing entry alone. Both "stopped before sending" paths of
`cancel_member` (withdrawn while collecting, and a lone member that
stops the send) now go through `stopped_unsent`, which turns a
still-pending entry into `no_exchange` with code `cancelled` and charge
provenance `nothing_sent`. `tests/batching.rs`
(`a_member_withdrawn_before_sending_has_no_exchange_in_its_evidence`)
fails without the fix and passes with it; the implementation record says
so. Round 2's review job reached its 15-minute limit right after posting
its comment, so that run recorded no evidence artifact; this push runs a
fresh review.

Review round 3 (0 findings), after the rebase onto #150. The first
attempt of this round reached the review job's 15-minute limit without a
verdict; the rerun returned no findings in both groups.
bartekus added a commit that referenced this pull request Oct 21, 2026
Spec 019, increments 1 and 2: dynamic questions as a narrow evaluated
class. The documents, pure validation and identity, `ask_dynamic`,
offline reproduction and the dynamic evaluation report. Scripted
backends only; nothing here selects a backend, authorizes live inference
or spend, or claims accuracy or calibration.

- `crates/rustev-contract/` (`src/dynamic.rs`, `ids.rs`, `limits.rs`):
`rustev.dynamic-question/1`, `rustev.dynamic-capability/1` (identified
by `DynamicCapabilityId`) and `rustev.dynamic-outcome/1` (`RECORD_V1`);
`DynamicRequestId`, `TemplateId`; the `DYNAMIC_QUESTION_V1` scan limits.
Parsing scans the bytes first, then checks the structural bounds of 3.2
(sizes, counts, byte-exact uniqueness of labels and context names, 64
KiB of context values, 128 KiB canonical); unknown members are refused.
The canonical request identity covers what a backend computes from,
including label order, template and preprocessing; the backend receives
a projection under fixed member names only.
- `crates/rustev-core/` (`src/dynamic.rs`, `seams.rs`): `validate`
builds the only `ValidatedQuestion`; `admit` (capability fit, no
truncation, `bounded` cost model only), `admit_cost` (enforceable bound
at or below the hard cap), `judge` (exact support, non-answer material
is invalid, pinned served identity, named abstention rules), `proposal`
(`model-derived`, with lineage). `DynamicBackend` and
`DynamicEvidenceSink` seams, separate from `DecisionBackend`, with no
tool, function or retrieval surface. Compile-fail tests with a compiling
control keep dynamic outcomes, raw outputs and proposals out of
`Supplied`, `Evaluation::supply` and `Judgment`, and keep
`ValidatedQuestion` unforgeable.
- `crates/rustev-runtime/` (`src/dynamic.rs`): `ask_dynamic`, one
attempt under a fresh hard ledger at the request's cap (and the optional
host ledger), deadline over every phase, spec 003/013 cancellation
evidence, optional sink whose delivery never changes the outcome. No
retry, fallback, batching or cache on this path.
- `crates/rustev-eval/` (`src/dynamic.rs`): `reproduce` takes no
backend; a changed canonical identity is `incomparable{request_changed}`
(section 5's last row: reordered labels), another declaration
`capability_changed`, a missing raw response `raw_response_unavailable`,
a different judgment `diverged`. `rustev.dynamic-dataset/1` and
`rustev.dynamic-evaluator-config/1` bind task family, exact question
schema, artifact and template; the dataset requires an
injection-adversarial case and refuses leakage across splits.
`rustev.dynamic-eval-report/1`: coverage, abstention by reason, accepted
error, uncalibrated Brier and log loss or mean level distance, overall
and over adversarial cases; `uncalibrated`, `mechanics_only` on
synthetic data, every gate `unknown`.
- Tests: `rustev-contract/tests/dynamic_wire.rs`,
`rustev-core/tests/dynamic.rs` (including adversarial text in every
caller-controlled field), `rustev-runtime/tests/dynamic.rs` (section 5
rows 1 to 7 with a dispatch counter), `rustev-eval/tests/dynamic.rs`.
- `tools/rustev-release/archive-policy.json`: the four new source files
join the reviewed archive lists; 019 now `extends`
`tools/rustev-release/` (additive) for it.
- `tools/rustev-conformance/fp-corpus` (spec 027, 3.11.3): the dynamic
log loss's `rustev_core::math::ln` call joins the differential corpus as
`eval.dynamic_log_loss.ln` (probability domain, as the existing log-loss
site), with its digests committed in `expected.json`; 019 `extends`
`tools/rustev-conformance/` (additive) and its verification runs the
corpus test.
- `Makefile`: 019 joins `VERIFIED_SPECS`.
- Spec 019: `implementation: complete`, Verification declares the
acceptance commands, implementation record. No existing document,
golden, plan id or test changed.

What remains: nothing in 019's acceptance. Calibration of a dynamic task
family needs a separately fitted artifact with its own binding; none
exists and none is claimed.

Owner decisions:
1. Whether the dynamic documents join spec 027's JSON Schema emitter
(3.2.2, "every public document type"). They are not emitted here: doing
so adds schema files under `crates/rustev-contract/schema/` and changes
the generated binding types under `integrations/rustev-wasm/types/` that
spec 027 owns, and neither spec says whether dynamic documents belong in
the binding surface.
2. Defaults chosen where the spec is silent, recorded in the
implementation record:
- `DISTRIBUTION_TOLERANCE` is 0.000001, equal to the reference plans'
tolerance.
- `min_margin` is top mass minus the second mass; ties go to the earlier
declared label.
- Free-text backend output retained in an outcome is cut to 256 bytes.
- Every evaluation gate is reported `unknown`: over synthetic data a
gate would claim quality from mechanics, and real data needs separately
governed admission (spec 023) that no dynamic dataset binds yet.

Local verification (macOS arm64): `make gate`, `make code` (build, test,
clippy `-D warnings`, fmt, boundaries), `.bin/spec-spine verify 019` (12
commands, passed), `rustev-fp-corpus check` (5 sites agree natively).
The WebAssembly corpus runs (`make bindings`) were not run locally: this
toolchain lacks the `wasm32-unknown-unknown` target. Rebased onto `main`
after #146, again after #143 to #145 merged (#145's corpus test required
the new site), and again after #150 (`VERIFIED_SPECS` and the contract's
schema constants unioned); derived shards regenerated each time.

Review round 1 (1 finding, fixed): `bounded_raw` kept NaN and infinite
distribution masses, so the outcome for that invalid output could not be
serialized and the evidence was lost. Such a distribution is now
recorded, and judged, as `Unrecognized { shape: non_finite_mass }` with
the masses as text (a new `ResponseShape` variant), so the outcome stays
a writable record and offline reproduction judges exactly what was
recorded.
`adapter_failures_and_malformed_outputs_are_named_and_never_retried` now
includes a NaN and an infinite distribution, asserts the recorded shape
and round-trips both outcomes. The implementation record says so.

Review round 1 (1 finding, fixed): `bounded_raw` kept NaN and infinite
distribution masses, so the outcome for that invalid output could not be
serialized and the evidence was lost. Such a distribution is now
recorded, and judged, as `Unrecognized { shape: non_finite_mass }` with
the masses as text (a new `ResponseShape` variant), so the outcome stays
a writable record and offline reproduction judges exactly what was
recorded.
`adapter_failures_and_malformed_outputs_are_named_and_never_retried` now
includes a NaN and an infinite distribution, asserts the recorded shape
and round-trips both outcomes. The implementation record says so.

Review round 2 (0 findings) on the rebased head 48c6c15.

Review round 3 (1 finding, fixed in the docs, behavior kept):
"`proposal()` omits `abstention` from `exact_processing` for label
answers, contradicting its doc comment and the implementation record."
The behavior is intended: under the explicit `label_only` posture no
abstention rule runs (`judge` returns `AbstentionDecision::LabelOnly`),
so listing `abstention` would claim an exact step that never ran. The
doc comment and the implementation record were wrong and now say
`validate` always, `abstention` only when thresholds were applied. The
core test for label output now builds the proposal and asserts its
lineage is exactly `["validate"]`.

Review round 4 (0 findings) on f9c4045. Rebased onto `main` after #152
(no conflicts, shards current).

Review round 5 (0 findings) on 54587eb; ci-gate passed.
bartekus added a commit that referenced this pull request Oct 21, 2026
…153)

Registers the two remaining required CI jobs: spec 027's `bindings`
(3.12.5) and spec 031's `release-checks` (3.5, 3.6.7, 3.8, 3.12).

- `.github/workflows/bindings.yml` (owned by spec 027): `make bindings`
on the reference runner (`ubuntu-24.04` x64, Node 22), the native suite
under Node 20 and 24, and the seven-platform native matrix. On each
platform the matrix builds the addon, runs the differential corpus, and
installs both packages from their tarballs into a fresh project.
- `.github/workflows/release-checks.yml` (owned by spec 031):
`adoption`, one job per partial-adoption subset (the five subsets whose
crate is absent are reported as skipped, never passed); `msrv` at the
toolchain the members' `rust-version` declares; `semver` with the pinned
`cargo-semver-checks` 0.51.0, where `no-baseline` is recorded as not
applicable.
- Both are registered by adding them to `ci.extra_required_jobs` in
`project.setup.parameters` of `.statecraft/environment.json`, then
re-rendering with the revision-17 renderer (statecraft-cli commit
`2f366913240ab9c6a13e4da46d057b165574bd71`, profile identity
`fe0e763c8f21`): `init plan . --profile github-actions-rust` produced
plan `df5491a7507d9a49ad1df28ec2bfc1e69f63f0af47557c3f22076fc511009bcd`,
which `init apply` applied, reporting every rendered path at its
intended digest. The renderer changed only `statecraft-ci.yml` (the two
`uses:` jobs and `ci-gate`'s `needs`) and the two setup documents.
`specs/000-bootstrap/spec.md` and `standards/spec/constitution.md` were
withheld as owner-edited and are unchanged.
- Specs 027 and 031: implementation-record paragraphs (027 increment 7,
fourth change; 031 increment 4).

This PR changes the authority set, so it needs the owner's approval of
the `statecraft-review-exception` Environment once. Once the
seven-platform matrix passes, specs 046 and 027 can be marked complete
in a follow-up.

Local verification (macOS arm64): `make gate` passes with spec-spine
0.31.0. The new jobs themselves run only in CI.

Round 1 CI (win32-x64-msvc): all 34 conformance cases failed their
pinned fixture digests, because the Windows runner checks out with
`core.autocrlf=true`. The `native` job now disables it before checkout;
spec 027 records why.

Review round 2 (1 finding, fixed): the WebAssembly tools cache key did
not name the tool pins, and its `restore-keys` prefix could restore an
older cache whose tools then passed the `test -x` check. The key now
carries `wasm-bindgen-cli` 0.2.129 and `wasm-opt` 0.116.1, and each tool
is installed under a root named by its version, so a restored older
cache never supplies a stale tool. (Round 2 first failed on reviewer
infrastructure, "claude native binary not installed", and was rerun.)

Review round 3 (0 findings). Rebased onto `main` after #150, #152 and
#148 (no conflict; none touched a managed or workflow file); `make
gate`, `couple` and the authored-content check pass again.
bartekus added a commit that referenced this pull request Oct 30, 2026
…use (A-67)

Spec 043: the members 3.9.1 added to rustev.live-reexecution/1 move to a
new per-case document, rustev.live-case/1, because spec 026's document
was implemented by #150 and published before them; the rate-limit pause
of 3.8.2 is deferred until a retry-after seam exists. Records the
owner's decisions as A-67. Status and implementation are unchanged.
bartekus added a commit that referenced this pull request Oct 30, 2026
…use (A-67)

Spec 043: the members 3.9.1 added to rustev.live-reexecution/1 move to a
new per-case document, rustev.live-case/1, because spec 026's document
was implemented by #150 and published before them; the rate-limit pause
of 3.8.2 is deferred until a retry-after seam exists. Records the
owner's decisions as A-67. Status and implementation are unchanged.
bartekus added a commit that referenced this pull request Oct 30, 2026
…use (A-67)

Spec 043: the members 3.9.1 added to rustev.live-reexecution/1 move to a
new per-case document, rustev.live-case/1, because spec 026's document
was implemented by #150 and published before them; the rate-limit pause
of 3.8.2 is deferred until a retry-after seam exists. Records the
owner's decisions as A-67. Status and implementation are unchanged.
bartekus added a commit that referenced this pull request Oct 30, 2026
…use (A-67)

Spec 043: the members 3.9.1 added to rustev.live-reexecution/1 move to a
new per-case document, rustev.live-case/1, because spec 026's document
was implemented by #150 and published before them; the rate-limit pause
of 3.8.2 is deferred until a retry-after seam exists. Records the
owner's decisions as A-67. Status and implementation are unchanged.
bartekus added a commit that referenced this pull request Oct 30, 2026
…use (A-67)

Spec 043: the members 3.9.1 added to rustev.live-reexecution/1 move to a
new per-case document, rustev.live-case/1, because spec 026's document
was implemented by #150 and published before them; the rate-limit pause
of 3.8.2 is deferred until a retry-after seam exists. Records the
owner's decisions as A-67. Status and implementation are unchanged.
bartekus added a commit that referenced this pull request Oct 30, 2026
…use (A-67)

Spec 043: the members 3.9.1 added to rustev.live-reexecution/1 move to a
new per-case document, rustev.live-case/1, because spec 026's document
was implemented by #150 and published before them; the rate-limit pause
of 3.8.2 is deferred until a retry-after seam exists. Records the
owner's decisions as A-67. Status and implementation are unchanged.
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