Skip to content

impl(027): emit schemas for dynamic, live and telemetry documents - #168

Merged
bartekus merged 1 commit into
mainfrom
impl/027-schema-emitter-r46
Oct 22, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/027-schema-emitter-r46

Conversation

@bartekus

@bartekus bartekus commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Adds the six public document schemas from specs 019, 026 and 028 to spec 027's emitter under owner decision R-46. Contract tests validate the documents, including trace JSONL goldens, against their emitted schemas. Both bindings receive regenerated TypeScript declarations.

Diff size: 170 additions and 15 deletions are authored. The other 5,443 additions and 2,761 deletions are generated schemas, TypeScript declarations and spec-spine shards. The two TypeScript files account for most of the diff.

Validation: pinned spec-spine 0.31.0 refresh, make gate and coupling pass. Hosted code and binding checks pass; declared acceptance is still running. Local workspace validation is running. Pushed before local code completion at the owner's request.

Rebased onto merged #165. Both AI review groups report no findings on 04dd831. Auto-merge is enabled pending the final required acceptance check. R-46 records the owner ruling of 2026-10-21; the spec records now explicitly distinguish its implementation date, 2026-10-22.

@github-actions

Copy link
Copy Markdown

AI review (findings)

Group 1 of 2

Reviewing the six new schema files, the Rust source changes, the test additions, the TypeScript definitions, and the decision record entry.

Schema files (six new .schema.json files): Each schema is a single-line JSON file with an appropriate $comment marking it descriptive rather than normative. Structural spot-checks pass:

  • rustev.dynamic-question-1 – required list matches the Rust struct fields; additionalProperties: false; parse limits are in x-rustev-parse-limits.
  • rustev.dynamic-capability-1 – required list complete; operations, task_families, template all properly typed.
  • rustev.dynamic-outcome-1 – nullable fields (attempt, capability, request, template) use anyOf[ref, null] correctly.
  • rustev.live-reexecution-1 – deeply nested; required list and nullable fields are consistent with the Rust struct.
  • rustev.redaction-1 – classes uses additionalProperties: {$ref: Action} (string key → Action value), which is correct for BTreeMap<FieldClass, Action> since FieldClass serializes as a string; only schema is required; classes/fields/content_events carry default values, consistent with #[serde(default)].
  • rustev.trace-1 – TraceValue uses anyOf over string/int/double/bool and their homogeneous array variants; anyOf rather than oneOf is intentional since the $comment says the schema is descriptive.

src/redaction.rs and src/trace.rs: Adding schemars::JsonSchema to FieldClass, Action, FieldOverride, RedactionPolicy, and the trace types is straightforward and consistent with the emission additions in schema_emit.rs. deny_unknown_fields and serde rename attributes are preserved.

src/schema_emit.rs: The six new emit::<T>(schema_const, None) calls are correct: DynamicQuestion, DynamicCapability, DynamicOutcome, LiveReexecution, RedactionPolicy, TraceLine against their respective schema string constants.

Tests: The fits_emitted_schema helper is duplicated across dynamic_wire.rs, live.rs, and redaction.rs — a minor code quality concern but not a defect. The logic is identical and correct in each copy. The new schemas.rs extension reads JSONL golden files line-by-line under tests/ directories and validates each parsed line against its schema; the sentinel assert!(seen.contains("rustev.trace/1")) correctly ensures that the span-line goldens are actually exercised.

TypeScript definitions: The six new namespaces (RustevDynamicCapability1, RustevDynamicOutcome1, RustevDynamicQuestion1, RustevLiveReexecution1, RustevRedaction1, RustevTrace1) are correctly placed in alphabetical order, match the JSON Schema structures, and follow existing namespace patterns. The tightening of Judgment.schema from string to "rustev.judgment/1" in RustevJudgment1 is a correct fix.

Decision record R-46: The entry is factual, scoped appropriately, and makes no claims beyond schema emission and type generation.

No concrete defects found.

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

Group 2 of 2

Reviewing the five files in group 2.

specs/019-dynamic-questions/spec.md — R-46 (dated 2026-10-22) is inserted immediately before the pre-existing R-47 entry (dated 2026-10-21). Ruling numbers appear to be globally sequential identifiers across the corpus; if so, R-46 is being assigned after R-47 was already issued, which inverts the chronological ordering the numbering scheme requires. This is a concrete inconsistency in the implementation record.

integrations/rustev-wasm/types/rustev-documents.d.ts — Six new namespaces are added (RustevDynamicCapability1, RustevDynamicOutcome1, RustevDynamicQuestion1, RustevLiveReexecution1, RustevRedaction1, RustevTrace1). Schema literal strings match their declared schema keys. The internal type aliases duplicated across namespaces (e.g., DynamicOperation, DynamicOutputKind) are consistent across all three dynamic namespaces. (A | B) | C grouping in ResponseShape and CaptureStatus is valid TypeScript (equivalent to A | B | C). No structural defects found.

specs/026-live-re-execution/spec.md, specs/027-node-and-wasm-bindings/spec.md, specs/028-opentelemetry-evidence-sink/spec.md — Updates are internally consistent: all three reference R-46 at 2026-10-22 and correctly describe the emission extension. The six schema names listed in spec 027's record match the six namespaces in the WASM declarations.

{"head": "32c2564679114325e3b81e5694fb920c2b6ee746", "verdict": "findings", "findings": [{"path": "specs/019-dynamic-questions/spec.md", "line": null, "summary": "R-46 (dated 2026-10-22) is inserted before the pre-existing R-47 entry (dated 2026-10-21), assigning a lower ruling number to a later event and inverting the chronological order that sequential ruling numbers require."}]}

Subject: ed1d191...32c2564, diff digest 051c22452134e6f3b1d239d291628ef00a8dbbaa8e339a99c078998e8e578f2f, 2 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 22, 2026 16:47 — with GitHub Actions Error
…ma emission (R-46)

Six documents join schema_emit::document_schemas(): rustev.dynamic-question/1, rustev.dynamic-capability/1, rustev.dynamic-outcome/1, rustev.live-reexecution/1, rustev.redaction/1 and rustev.trace/1. Their schemas are committed under crates/rustev-contract/schema/ and both packages' rustev-documents.d.ts gain their types; no existing schema or type changes. Recorded as R-46.
@bartekus
bartekus force-pushed the impl/027-schema-emitter-r46 branch from 32c2564 to 04dd831 Compare October 22, 2026 17:26
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Group 1 of 2

Reviewing the six new schema files, the schema_emit.rs additions, the redaction.rs and trace.rs derive expansions, the test helpers, the schemas.rs JSONL extension, the decisions document entry, and the Node type declarations.

Schema file consistency — The six emitted schemas (dynamic-capability-1, dynamic-outcome-1, dynamic-question-1, live-reexecution-1, redaction-1, trace-1) are internally self-consistent. The $comment on every file correctly marks them as descriptive, not authoritative. The oneOf usage in ResponseShape and Action is semantically correct: the non_finite_mass constant is absent from the preceding enum list, so exactly one branch matches any valid value.

schema_emit.rs — The six new emit calls are correctly typed and ordered. RedactionPolicy and TraceLine use module-level constants (REDACTION, TRACE) while the other four use schema::* constants; the naming inconsistency is cosmetic and not a defect.

Test helpers — fits_emitted_schema is duplicated verbatim in three test files (dynamic_wire.rs, live.rs, redaction.rs). This is code duplication but all three compile in independent test crates, so it is not a bug.

schemas.rs JSONL extension — Malformed JSONL lines are silently skipped (consistent with the existing silent-skip pattern for non-JSON files). The follow-on assertion assert!(seen.contains("rustev.trace/1")) provides a minimum sanity check. The assertion floor (>= 30) is a lower bound and is not invalidated by adding more documents.

redaction.rs — Adding schemars::JsonSchema to FieldClass has no effect on the emitted RedactionPolicy schema (class names are free-string keys, not constrained to enum values). The derive is harmless.

TypeScript declarations — TraceValue collapses integer and float to number, and integer arrays with float arrays to number[], which is a standard TypeScript limitation. The rest of the new namespaces (RustevDynamicCapability1, RustevDynamicOutcome1, RustevDynamicQuestion1, RustevLiveReexecution1, RustevRedaction1, RustevTrace1) are structurally consistent with their schemas.

R-46 governance entry — Records the owner's ruling as described; no structural inconsistency with the changes it authorises.

No concrete defects found in the reviewed files.

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

Group 2 of 2

Reviewing the five files in group 2: the WASM TypeScript declarations and four spec implementation records.

integrations/rustev-wasm/types/rustev-documents.d.ts

Six new namespace exports are added alphabetically:

  • RustevDynamicCapability1, RustevDynamicOutcome1, RustevDynamicQuestion1 (spec 019)
  • RustevLiveReexecution1 (spec 026)
  • RustevRedaction1, RustevTrace1 (spec 028)

Each namespace is self-contained; types like Scope, Handle, DynamicOperation, CostModel are redeclared per namespace, which is correct TypeScript namespace practice. Existing namespace content (RustevEvalReport1 onward) is reordered by insertion but not altered in content.

Specific checks:

  • RustevDynamicOutcome1.DynamicRaw correctly includes "no_answer" as a terminal variant and "not_dispatched" for pre-dispatch; the raw-output path rejects non-label/non-distribution material as unrecognized without executing it — consistent with the "proposals, never grants" principle.
  • RustevRedaction1.Action covers drop | digest | truncate | allow; the parse-before-apply note matches the Rust-side contract comment.
  • RustevTrace1.TraceValue is string | number | boolean | string[] | number[] | boolean[] — correct OTel attribute repertoire; span_id/trace_id are string with comment constraints, enforced Rust-side, standard pattern.
  • RustevLiveReexecution1.AuthorizationOutcome records allowed/refused without embedding authorization material beyond a reference string — no credential leak path.
  • RustevJudgment1.schema is now typed as literal "rustev.judgment/1" (tighter than the old string in the embedded Judgment interface); consistent with the standalone type approach.

Spec implementation records (specs 019, 026, 027, 028)

All four records reference R-46 (owner ruling 2026-10-21, implementation 2026-10-22) consistently. Spec 027 carries the authoritative implementation record; specs 019, 026 and 028 cross-reference it with supersession notes. R-46 is inserted before the already-present R-47 in spec 019, which is chronologically coherent (both events 2026-10-21). The six document types named in spec 027's record match the six namespaces added to the .d.ts file exactly.

No concrete defects found.

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

Subject: f66e2cb...04dd831, diff digest f0586c17827e773083b75ead83bb2ddde0de5f796426789cf22923772614b40a, 2 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 17:33
@bartekus
bartekus merged commit 563fa42 into main Oct 22, 2026
26 checks passed
@bartekus
bartekus deleted the impl/027-schema-emitter-r46 branch October 22, 2026 17:58
bartekus added a commit that referenced this pull request Oct 22, 2026
Runtime-planned batch members with equal remaining budgets previously
received slightly different deadlines because each member started its
budget during preparation. When the earliest deadline ended the shared
transport, a later member could receive a transient transport failure
while its siblings expired. This is the runtime_batch CI failure seen on
#169.

Implements the owner-authorized fix under spec 020's existing
dispatch-budget and no-replenishment requirements: capture one monotonic
instant at batch entry and derive all member deadlines from it.
Preparation consumes the budget, and distinct remaining budgets stay
distinct. A paused-clock regression covers preparation time and expiry;
the existing batch-versus-independent loopback test is unchanged.

Validation: make gate, cargo fmt and git diff --check pass. Hosted code
and binding checks pass, including the new paused-clock regression and
the unchanged runtime_batch differential test. The rebased review
identified an in-place normative amendment. The approved normative text
is now unchanged; the implementation record explains how this fix
enforces the existing requirements. AI review reports no findings on
current head 9ebf3de. CI is running;
auto-merge is enabled. Pushed before local workspace tests at the
owner's request.

Rebased onto merged #168. Rebase #169 onto this fix after it merges.
Requires current-head no-findings AI review and green CI.
bartekus added a commit that referenced this pull request Oct 22, 2026
Adds the held-out ledger, baseline records and reproducibility checks
from spec 029 sections 3.7 to 3.9. The ledger verifies its hash chain
and bounded entries; baseline creation reproduces and checks the
supplied repeat report; reproducibility reports exceedances and unknown
evidence explicitly.

Tests cover ledger counts and tampering, bounds and round trips,
baseline bindings, exact band boundaries and unknown evidence.

This is the first part of increment 4. Section 3.10's diff document and
rendering are still to follow before candidate comparison and selection
gates. Spec 029 remains in progress. Brier per-case measures remain
absent and their interval unknown pending a concrete compatibility
decision on D-029-1.

Validation: make gate and pinned spec-spine coupling pass. AI review
reports no findings on 50e8d04. CI code
hit the existing runtime_batch deadline race, addressed separately in
#170; rebase and fresh checks follow that merge. Local code validation
is queued behind the current shared-target run; pushed before it
completes at the owner's request.

Merge order: after #168 and the runtime batch race fix #170. Auto-merge
stays off pending that order, a current-head no-findings AI review and
required checks.
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