Skip to content

impl(063): increment 2, profiles and variants in the Node binding - #520

Merged
bartekus merged 2 commits into
mainfrom
impl/063-inc2
Nov 6, 2026
Merged

bartekus merged 2 commits into
mainfrom
impl/063-inc2

Conversation

@bartekus

@bartekus bartekus commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What

Spec 063 increment 2, profiles and variants in the Node binding.

  • compile and compileSync take definitions, execution, profile, profileBases, variant and definitionVersion (3.2). Usage rules throw InvalidDocument naming the field before any document is serialized or parsed (3.2.2). A version 2 template or an instantiation field compiles through compile_profiled_with; anything else through compile_with_sources, so execution now reaches a persistent-tier plan (3.2.1). sources (increment 3a, impl(063): increment 3a, sources on compile and load in the Node binding #518) reach both compile paths, profiled or not. A definition over DEFINITION_V1.max_bytes is refused before template detection, as plan_command's bounded host read refuses it.
  • Instantiation refusals are CompileRefusal with the 034 code in snake case and the surface's stage, code, subject, detail; later compile refusals keep their category code with stage: "compile" and parameters (3.2.3, 3.10).
  • command('check' | 'compile') routes through rustev_surface::profile::plan_command (3.2.4). profileCheck (sync) and planDiff (async) call profile::check and plan_diff::diff, also join command, and apply 034 3.14.4's checks (a) to (d) in order (3.3).
  • Hand-written declarations in index.d.ts (3.11); no generated declaration change.
  • The 23 parameterized.* cases run on cli and native with unchanged expected bytes (3.13.1); only manifest.json is re-blessed.
  • test/profile.test.mjs: each usage rule, both refusal kinds with their detail objects, PlanId and plan bytes equal to the CLI golden and the plan_command output, execution reaching a persistent tier (store_missing at prepare without a store), base chains and version pins, profileCheck/planDiff happy and refusal paths.
  • 063's implementation record gains increment 2's paragraph; no normative text changed.

Spec sections: 063 3.2, 3.3, 3.10 (034 codes), 3.11 (declarations), 3.13.1, and the profile rows of section 5.

Checks (local, macOS arm64)

  • cargo build --workspace --locked: pass
  • cargo test -p rustev-node --locked: pass
  • cargo test -p rustev-conformance --locked: pass
  • cargo clippy -p rustev-node -p rustev-conformance --all-targets --locked -- -D warnings: pass
  • cargo fmt --all --check: pass
  • cargo build -p rustev-node --locked --release, copy-addon.mjs: pass
  • tsc --noEmit --strict --lib es2022,dom integrations/rustev-node/index.d.ts: pass
  • node --test integrations/rustev-node/test/*.test.mjs: 77 tests, 73 pass, 0 fail, 4 skipped (after rebasing onto impl(063): increment 3a, sources on compile and load in the Node binding #518; source.test.mjs included) (the local-embed feature tests, skipped in a build without that feature as before)
  • node tools/rustev-conformance/js/run.mjs native integrations/rustev-node: 218 cases, 0 failures
  • make gate: pass

OTLP note: the OTLP Node tests (049 3.3 to 3.5) were skipped in the implementation sandbox, which refused listen (EPERM); they were run here outside it and pass.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff for bugs, security problems, and inconsistencies across the eight changed paths.

Structural correctness: index.js / profile.rs validation symmetry

The JS profileInputs and the Rust validate function enforce the same usage rules (definitions-with-definition, plan-with-profile-field, profileBases/definitionVersion without profile, length 1–64 for array fields). The two layers are consistent, and the array element type check in Rust's list matches the JS-side bytes(d) serialization path.

Command routing (commands.rs)

Routing "check" and "compile" through crate::profile::command changes the entry point for those two existing commands. The profile::command function calls validate (which handles the else-branch for these names) and then plan_command. This correctly passes opt(a, "out")? for compile and None for check, matching the behaviour that was already expected by callers.

planDiff validation checks (a)–(d)

The four guards are enforced in the stated order and cover plan-mode/definition-mode exclusion, pair completeness, at-least-one-side-specification, and mandatory out. The test exercises each rule label.

Concrete defect: template detection in profile::compile relies on DEFINITION_V1 parse bound

In integrations/rustev-node/src/profile.rs, the compile function detects a v2 template definition with:

let template = parse_bounded::<Value>(definitions[0], &DEFINITION_V1)
    .ok()
    .is_some_and(|v| {
        v["schema"] == "rustev.definition/2"
            && (v.get("parameters").is_some()
                || v.get("variants").is_some()
                || Definition::parse(definitions[0]).is_err())
    });

If the definition's byte size exceeds DEFINITION_V1 parse limits, parse_bounded returns Err, .ok() yields None, and template is false. With no other instantiation hints (profile, variant, profileBases, definitionVersion), the condition

if template || profile.is_some() || !bases.is_empty()
    || present(a, "variant") || present(a, "definitionVersion")
    || definitions.len() != 1

is entirely false, so execution falls to Definition::parse(definitions[0]). A v2 definition fails the v1 Definition parser, producing usage(&e.to_string()) — an InvalidDocument error — rather than routing to compile_profiled_with. Spec 063 §3.2.1 (changelog, increment 2) states that "a version 2 template… compiles through compile_profiled_with". A v2 template large enough to exceed DEFINITION_V1 limits, supplied without any instantiation field, violates that contract and surfaces a misleading InvalidDocument instead of a proper compile error.

No other concrete bugs or security issues found. The prepare_profile / prepare_profile_async split, the TypeScript declaration additions, the conformance adapter rewiring in run.mjs, and the spec changelog entry are all internally consistent.

{"head": "7972eb57eed04112ed9573acc790cee13d4da7d5", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/src/profile.rs", "line": null, "severity": "medium", "category": "correctness", "summary": "Template detection in `compile` calls `parse_bounded::<Value>(definitions[0], &DEFINITION_V1)`; a v2 definition template whose byte size exceeds the DEFINITION_V1 parse limit, supplied without any instantiation hint (profile, variant, profileBases, definitionVersion), sets `template = false` and falls to `Definition::parse` / `compile_with_sources`, yielding a confusing InvalidDocument error instead of routing through `compile_profiled_with` as spec 063 §3.2.1 requires."}]}

Subject: 49fac12...7972eb5, diff digest f5fc2eb40af31196a21de49401b28dc64ba99a308cc35f697f51bf38bd1fe1fa, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 6, 2026 01:22 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

Review of PR 4dc430a

This PR implements increment 2 of spec 063 (node-binding-parity): adds definitions, profile, profileBases, variant, definitionVersion inputs to compile/compileSync, and introduces profileCheck and planDiff commands.

Findings

TypeScript type declaration inconsistency (index.d.ts, line ~385)

The PlanDiffArgs definitions-mode variant declares all four side-specific fields as optional:

export type PlanDiffArgs = { ... }
  | { definitions: string[]; leftProfile?: string; rightProfile?: string;
      leftVariant?: string; rightVariant?: string; ... out: string };

The TypeScript type therefore permits { definitions: ['x'], out: 'y' } — all of leftProfile, rightProfile, leftVariant, rightVariant absent. But profile.rs::validate rule (c) rejects exactly this input:

if !plans
    && !["leftProfile", "rightProfile", "leftVariant", "rightVariant"]
        .iter()
        .any(|k| present(a, k))
{
    return Err(usage("planDiff (c): a side profile or variant required"));
}

A TypeScript caller using these declarations gets no compile-time warning but a runtime InvalidDocument error. The spec.md increment 2 notes explicitly enumerate "034 3.14.4's checks (a) to (d) in order", so constraint (c) is normative and the runtime is correct — only the declaration is imprecise.

No other findings

The rest of the implementation is consistent:

  • profileInputs JS validation order (usage checks before bytes() calls) matches the stated guarantee.
  • validate for check/compile routing through profile::command correctly handles both single-definition and multi-definition cases.
  • planDiff checks (a)–(d) are implemented in order and match the test coverage.
  • prepare_profile_async follows the same Blocking::enter + spawn_blocking pattern as other async compile methods.
  • The template detection heuristic (schema == "rustev.definition/2" + parameters/variants/parse-failure) correctly handles valid v1 definitions, valid v2 templates, and invalid JSON.
  • Size bound on definitions (DEFINITION_V1.max_bytes) is applied before template detection, as described.
  • The conformance runner additions for parameterized.* case routing correctly map CLI flags to JS args.
{"head": "4dc430a943e723f8d314ca41446169e2041f77d5", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.d.ts", "line": 385, "severity": "low", "category": "correctness", "summary": "PlanDiffArgs definitions-mode variant allows all of leftProfile/rightProfile/leftVariant/rightVariant to be absent, but profile.rs::validate rule (c) requires at least one; TypeScript callers receive no compile-time warning for a runtime-rejected input."}]}

Subject: 49fac12...4dc430a, diff digest c2d78ddd81dd5ac185d67a243c09e77fbe7f016a475b87a5865c492612ad5728, 1 call(s). An AI comment is not an approval.

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

bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Review note: the finding on index.d.ts line 385 (PlanDiffArgs lets every side profile and variant be absent) is intended, not a defect.

  • The declaration is 063 3.3's normative signature, copied verbatim: the definitions-mode arm there declares leftProfile?, rightProfile?, leftVariant? and rightVariant? all optional. 3.11 says the additions are declared by hand from the spec; a stricter type would diverge from the ratified text and needs a spec change first.
  • 3.3.2 makes "at least one side profile or variant" a runtime usage check: 034 3.14.4 (c), thrown as InvalidDocument naming the check, in order after (a) and (b). profile.rs::validate does this, and test/profile.test.mjs covers it ({ definitions: ['missing'] } rejects with (c)). The command('planDiff', ...) path takes args: object and reaches the same check, so a type-level constraint would not cover every caller anyway.
  • No behavior is affected: a call that compiles and omits all four fields is refused before any input is read, as the CLI refuses it.

The earlier finding on 7972eb5 (template detection under the definition parse bound) was fixed in 4dc430a. An oversized definition is now refused before detection, matching the bound plan_command's host read applies, and a test covers it.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

Looking through the diff carefully, focusing on correctness, security, and consistency between the JS validation layer and the Rust implementation.

Review

integrations/rustev-node/src/profile.rs — validate for planDiff, lines 55–57

if (plans && defs) || (!plans && !present(a, "definitions")) {
    return Err(usage("planDiff (a): exactly one input mode"));
}

The second sub-condition !plans && !present(a, "definitions") fires for inputs like { leftProfile: "p" }: defs is true (leftProfile is in the defs list), plans is false, definitions is absent. The error label "(a): exactly one input mode" is misleading here—the caller is using definition mode and providing a side selector, but the error says the mode itself is ambiguous. The input does correctly produce an error, so the system is safe; the message is imprecise.

integrations/rustev-node/src/profile.rs — validate for check/compile/profileCheck, lines 86–108

The exclusion list checked when plan is present is ["definitions", "profile", "profileBases", "variant", "definitionVersion"], which does not include "definition" (singular). An input { plan: "p", definition: "d" } passes validation; definitions(a)? then returns ["d"], the definition is used, and the plan bytes in the input map are silently discarded. For commandSync("check", …) or commandSync("profileCheck", …), a caller intending to check a compiled plan would get a silent wrong-answer instead of a validation error. The JS-side compile/compileSync route correctly partitions on has('plan'), so the Engine methods are unaffected; this applies only to direct commandSync/command callers.

integrations/rustev-node/src/commands.rs — routing change for check and compile

if matches!(name, "check" | "compile" | "profileCheck" | "planDiff") {
    return crate::profile::command(name, inputs, a);
}

All check and compile command calls now go through profile::command. If the previous handler for compile ever accepted { plan: "planKey" } (plan-loading mode), that path is now broken: profile::command calls definitions(a)? and returns Err("definitions required"). The spec says these route through plan_command, and the PR states conformance tests pass, which is consistent evidence that plan-loading was never valid here; but the original handler is not shown in the diff for confirmation.

JS/TypeScript consistency

profileCheck returns CommandResult (sync via commandSync) and planDiff returns Promise<CommandResult> (async via command); the TypeScript declarations match. The PlanDiffArgs union type does not enforce "at least one of leftProfile/rightProfile/leftVariant/rightVariant" in definition mode, but this is a TypeScript expressibility limitation rather than a runtime defect.

Security

No injection, privilege escalation, or cross-boundary issues found. All user-controlled bytes go through the typed Document/BackendDescriptor/ExecutionPolicy parse boundaries. The expect("surface JSON") calls in refusal are on internal surface output (not user data), and are consistent with existing patterns in the codebase.

{"head": "8f33e60cffd1ad52019d4e5999f3b0236984f51c", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/src/profile.rs", "line": 55, "severity": "low", "category": "correctness", "summary": "planDiff rule (a) check fires for inputs like { leftProfile: 'p' } (definition-mode key present, definitions absent) reporting 'exactly one input mode' rather than a more precise missing-definitions error."}, {"path": "integrations/rustev-node/src/profile.rs", "line": 90, "severity": "low", "category": "correctness", "summary": "The validate exclusion list for 'plan with <key>' does not include 'definition' (singular), so { plan: 'p', definition: 'd' } passes validation and silently discards the plan bytes, using only the definition."}]}

Subject: 773d72f...8f33e60, diff digest 1a428e7c3d1ec5463c5313ccff61bf3bbbfcea5e103b8dc64b7a6940036c54f4, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 6, 2026 02:09 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Review note on the 8f33e60 findings:

  • profile.rs line 90, { plan, definition } passing validate: fixed in 535487d. definition is now on the plan with <key> exclusion list, and test/profile.test.mjs covers it on check, compile and profileCheck. The public compile/compileSync already refused this pair in index.js (exactly one of a definition and a plan) before any native call.
  • profile.rs line 55, { leftProfile: 'p' } reported as check (a): intended. 034 3.14.4 defines (a) as "flags of both modes, or of neither (no --left-plan, --right-plan or --definition)". Without definitions, leftPlan or rightPlan the call is in neither mode, so (a) is the check that applies, and it runs first. 063 3.3.2 requires the checks in that order and requires naming the check, which the message does (planDiff (a): exactly one input mode). A "missing definitions" message would name a check 034 does not define, and would disagree with the CLI's usage error for the same flags.

The squashed head also fixes the governance failure on 8f33e60: its intermediate commits had stale 063 shards after the rebase onto #518. The branch is now one commit whose tree passes make gate.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff for bugs, security problems, and inconsistencies against the governance context and spec 063.

Key areas examined:

  1. profileInputs() JS validation logic vs. Rust validate() — overlap is intentional; both paths check the same constraints.
  2. compile()/compileSync() routing through profileInputs → prepare_profile → profile::compile.
  3. profile.rs validate, command, and compile for the new commands.
  4. The new profileCheck and planDiff JS methods.
  5. Conformance runner changes in run.mjs.

Finding:

In integrations/rustev-node/index.js, the new profileCheck method body reads:

profileCheck(inputs, args) {
    return this.commandSync('check', inputs, args);
}

It passes 'check' as the command name. In commands.rs, "check" routes to profile::command("check", …), whose _ branch calls rustev_surface::profile::plan_command("plan check", …). The command that actually reaches rustev_surface::profile::check("profile check", …) is "profileCheck", not "check".

The spec increment 2 text (added in this same PR, specs/063-node-binding-parity/spec.md near the new block) states: "profileCheck and planDiff call profile::check and plan_diff::diff." The implementation contradicts this — profileCheck runs the full plan check compilation instead of the lightweight profile check. For inputs where the two diverge (e.g. a profile whose variant is valid per profile::check but whose compiled plan fails plan_command), the method returns the wrong outcome. The analogous planDiff method correctly passes 'planDiff'.

No other concrete defects were found. The JS-side validation in profileInputs, the Rust-side validate/command/compile logic, the PlanDiffArgs union type, the lib.rs NAPI wrappers, and the conformance runner mapping all appear consistent with the spec and each other.

{"head": "535487d48f87407c92c333f5bf41d71eba644e9c", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.js", "line": 512, "severity": "medium", "category": "correctness", "summary": "profileCheck calls this.commandSync('check', …) instead of this.commandSync('profileCheck', …), routing to plan_command(\"plan check\") rather than profile::check(\"profile check\") as spec 063 increment 2 requires."}]}

Subject: 86bfc94...535487d, diff digest b7d130be1fecd85e752eb93af20dfa1d6b65074fcf8ab8c22a1833921bd9849e, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 6, 2026 02:27 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Review note on the 535487d finding (index.js line 512): a false positive. profileCheck already called this.commandSync('profileCheck', ...), and commands::run sends profileCheck to profile::check("profile check", ...). The cause was the existing plan check/plan show doc comment sitting above the new methods. e35cee5 gives profileCheck and planDiff their own comment (additions only), and test/profile.test.mjs now asserts that profileCheck's output names command: "profile check".

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff across all eight changed paths for bugs, security problems, and inconsistencies against the governance context.


integrations/rustev-node/index.d.ts — PlanDiffArgs union type

The two branches of the union are not mutually exclusive: TypeScript does not reject an object that supplies both leftPlan/rightPlan and definitions or other defs-mode fields. For example { leftPlan: 'l', rightPlan: 'r', definitions: ['d'], out: 'z' } satisfies the first branch structurally, compiles without error in TypeScript, but is rejected at runtime by validate check (a). The declared TypeScript contract is therefore wider than what the implementation accepts.

specs/063-node-binding-parity/spec.md — increment 2 date

The revision note at the bottom of the diff records "Increment 2, 2026-11-05" while the subsequent "Increment 3a" entry is dated 2026-11-06. The PR head is submitted on 2026-11-06. The date for increment 2 appears to be one day early.

integrations/rustev-node/src/profile.rs — validate missing absence check

For the non-planDiff branch of validate (line ~90), neither validate nor any check upstream of it enforces that at least one of definition / definitions is supplied. The constraint is caught afterward in definitions(). This runs before any host read or document parse, so the stated invariant is preserved; however, it means the error message ("definitions required") is emitted outside the centralised validate boundary that the spec describes as the guard.

integrations/rustev-node/src/profile.rs — compile function out check placement

For name == "compile" the out field is checked inside the match arm after definitions(), list() calls, and DepArgs construction (profile.rs ~171–210). None of those steps parse documents or read from host, so the doc-parse timing invariant holds in practice, but out is not checked inside validate alongside the other named-field usage rules.

No other concrete defects found. The JS-side profileInputs usage ordering (checks precede bytes() calls), the Rust validate → command → plan_command flow, the prepare_profile/prepare_profile_async blocking-token and liveness-check patterns, and the conformance-adapter mapping in run.mjs all look correct.

{"head": "e35cee5b09b0daf065d9d95b3427d80f6bae7075", "verdict": "findings", "findings": [{"path": "integrations/rustev-node/index.d.ts", "line": 388, "severity": "low", "category": "correctness", "summary": "PlanDiffArgs is a plain union, not a discriminated union, so TypeScript accepts objects mixing plans-mode fields (leftPlan/rightPlan) with defs-mode fields (definitions), which the runtime rejects with error (a)."},{"path": "specs/063-node-binding-parity/spec.md", "line": 773, "severity": "low", "category": "other", "summary": "Increment 2 revision note is dated 2026-11-05 while Increment 3a immediately following is dated 2026-11-06 and the PR is submitted 2026-11-06, making the increment 2 date one day early."},{"path": "integrations/rustev-node/src/profile.rs", "line": 42, "severity": "low", "category": "correctness", "summary": "validate() for non-planDiff commands does not check that at least one of definition/definitions is present; the missing-definition error is raised by the subsequent definitions() call, outside the centralised validation boundary the spec describes."}]}

Subject: 86bfc94...e35cee5, diff digest 132fe2827914a7dcc42c5d68ac779223669245a6130d4f0416419dda837fce03, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 6, 2026 02:45 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Review note on the e35cee5 findings (all low; none changes behavior):

  • index.d.ts 388, PlanDiffArgs not discriminated: the declaration is 063 3.3's normative signature, copied verbatim (3.11 declares the additions by hand from the spec). The two modes are separated at runtime by 034 3.14.4 check (a), which 3.3.2 requires to throw InvalidDocument naming the check, and test/profile.test.mjs covers it ({ leftPlan, definitions } rejects with (a)). Making the type stricter (never-typed cross fields) would diverge from the ratified text and needs a spec amendment first. The same point was answered for the earlier PlanDiffArgs finding above.
  • spec.md 773, increment 2 dated 2026-11-05: the work was done and first pushed on 2026-11-05 (local time; the first head, 7972eb5, predates impl(063): increment 3a, sources on compile and load in the Node binding #518's merge). Increment 1's paragraph is likewise dated by its work, not its merge. The record is not normative, and re-running the review over a date is not worth it.
  • profile.rs 42, missing definition/definitions raised by definitions() rather than inside validate: both run before any input is read or parsed. command calls validate, then definitions(a), before building the host or reading a byte, and compile does the same before read. 3.2.2's "before any parse" holds, and the public compile/compileSync refuse it earlier still, in index.js's profileInputs (definition or definitions required). The test covers { definitions: [] } and the missing case on the command path.

@bartekus
bartekus added this pull request to the merge queue Nov 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 6, 2026
@bartekus

bartekus commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

M1: removed from the merge queue at 03:23. release-checks / semver ran the 031 3.8 npm declaration check, which classes Engine.planDiff and Engine.profileCheck as breaking ("required member added"). A breaking finding passes only when the family moves to the breaking position, so this lands after the 0.5.0 version bump, which is now being prepared ahead of the freeze. Every crate passed cargo-semver-checks. No code change is needed here; it will be rebased onto the bump and re-armed.

bartekus added a commit that referenced this pull request Nov 6, 2026
…derive PlanId-keyed baselines, ledgers and caches (#528)

## Summary

The release family moves from `0.4.1` to `0.5.0` in lockstep. The owner
set release 0.5.0 as the sprint goal on 2026-11-05, within the release
approval of 2026-11-03 extended through the final release. Only the
timing is earlier: the move lands ahead of the 0.5.0 feature freeze
because spec 031 3.8's npm declaration check (`make semver`,
`tools/rustev-release/npm-api-diff.mjs`) classes a new required member
of the Node binding's `Engine` (spec 063 increment 2's `planDiff` and
`profileCheck`, #520) as breaking, and refuses it until the version
moves to the breaking position over the 0.4.1 baseline. Before 1.0 that
is the minor number. #520 failed in the merge queue on exactly that. No
behavior changes. The same procedure as #511 and #480.

- **Why a minor step:** the binding increments add required `Engine`
members, a breaking change under 031 3.8; a `0.x` family takes a break
in its minor version, so `cargo semver-checks` and the npm check against
0.4.1 report rather than refuse.
- **Version sites:** the workspace `version` and its internal `=0.5.0`
pins, `Cargo.lock`, the nine npm `package.json` files, and
`tools/rustev-release/release-set.json` (version and tag `v0.5.0`).
- **Regenerated fixtures:** spec 002 3.3.4 puts `rustev-core/<crate
version>` in every plan document, so every PlanId moves, and everything
derived from one: `RUSTEV_BLESS=1 UPDATE_REPEAT_GOLDENS=1
UPDATE_SELECTION_GOLDENS=1 UPDATE_HOST_GOLDENS=1 cargo test
--workspace`, the CLI re-bless, `make conformance-harvest`, the
embed-linear ignored bless test, the `rustev-otel` bless, the byte
copies #480 lists, and the `rustev-serve` Sigstore fixture re-signed
with its throwaway local keys (four-argument `regenerate_sigstore.py`).
The diff is hashes, version strings, recorded timing and the re-signed
throwaway certificates.
- **Spec 058:** a dated record entry for the 0.5.0 move: a
breaking-position release; every PlanId changes from 0.4.1 to 0.5.0 and
anything keyed by one must be re-derived on upgrade; the npm `Engine`
gains required members (031 3.8).
- **Release notes:** this title (the squash subject) carries the
re-derive note, so the 0.5.0 changelog states it.
- **`.statecraft/derived`:** refreshed (root `Cargo.toml` is a hashed
input; the spec edit).

Left unchanged on purpose: historical text naming 0.4.0 and 0.4.1, and
synthetic versions under test.

## Verification

- Bless and harvest paths on lane 1: after the last bless pass, `cargo
test --workspace --locked --no-fail-fast` gave 2645 passed and 2 failed,
the two byte-copy checks (`rustev-bedrock` `identity`, the pinned
reference PlanIds; `rustev-eval` `packaged_fixtures`, the retained
record). Both were refreshed from their sources (the core `*.plan-id`
goldens; the harvested `lodging.replay` bundle's retained bytes).
- `make refresh`, `make gate`: clean.
- The final local run (full workspace tests, clippy `-D warnings`, fmt,
`make boundaries`, `spec-spine verify` 058, 031 and 021, `make semver`)
is reported in a comment on this pull request when it completes.

`couple`: the regenerated fixtures are claimed through many specs'
`extends` whose text this change does not touch. Spec 058 carries the
authoring edit; the remaining paths are covered by the owner's waiver,
as in #480 and #511.

Policy isolation (profile revision 22, `guard-policy-files.sh`): this
change touches `Cargo.toml` and `Cargo.lock` beside the fixtures, so
governance's "Policy isolation" step is expected to fail. It cannot be
split into parts that pass on their own: a pull request with only
`Cargo.toml` and `Cargo.lock` fails its own tests (every PlanId fixture
is stale), and one with only the fixtures fails against the 0.4.1
crates. The owner decided on 2026-11-06 to land it as one pull request
by admin merge, bypassing only that guard, once every other check passes
(code, verify, bindings, release-checks with semver, boundaries, and the
AI review). The merged commit is never tagged: the 0.5.0 tag goes on a
later commit whose own ci-gate passed.

Spec-Drift-Waiver: family version bump to 0.5.0 (release 0.5.0, the
owner's sprint goal decided on 2026-11-05), moved ahead of the feature
freeze because spec 031 3.8 refuses the binding increments' new required
`Engine` members until the breaking position moves. Every PlanId embeds
the compiler crate version (spec 002 3.3.4), so fixtures are regenerated
mechanically through their bless and harvest paths; no behavior changes.
Approved by the owner on 2026-11-03 (release approval extended through
the final release) and 2026-11-05 (sprint direction: release 0.5.0).

Labelled `statecraft:stacked-ci` so this pull request's own run covers
every acceptance group, release-checks and bindings: an admin merge
skips the merge queue's full run.
compile and compileSync take definitions, execution, profile, profileBases, variant and definitionVersion (3.2), with sources reaching both compile paths; profileCheck and planDiff join the binding and command (3.3). The 23 parameterized cases run on cli and native.
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff across all changed files. I'll work through validation logic, Rust/JS consistency, type declarations, and security surface.

integrations/rustev-node/index.js — profileInputs

Validation order: definition+definitions conflict → plan+profiling-keys conflict → !profile block → length bounds → type checks → plan early-return → require definition/definitions. All guards fire before bytes() serialises any document. The plan early-return is correct: has('plan') returns null only after all plan-conflict checks pass.

execution is not in the withPlan exclusion list, so { plan: …, execution: … } returns null (plan path) and execution is silently discarded. The same omission appears in profile.rs::validate. The test's plan-conflict cases enumerate only ['definitions','profile','profileBases','variant','definitionVersion'], matching the runtime — the omission is consistent and apparently intentional (a compiled plan already embeds its execution policy). No defect.

integrations/rustev-node/src/profile.rs — validate

For planDiff, the bounds check for key in ["definitions","profileBases"] sits outside the if name == "planDiff" block, so it applies to both modes. In plans-mode, definitions and profileBases are absent, so the check is skipped harmlessly. In defs-mode it validates 1–64 entries. ✓

Check (a): (plans && defs) || (!plans && !present(a,"definitions")) correctly rejects mixed-mode and empty calls. defs includes descriptors/rules/calibrations/execution; without definitions or leftPlan/rightPlan, any such key still triggers "(a)". Correct.

Check (c) requires at least one side profile or variant in defs-mode. No path skips it incorrectly.

The opt(a, key)? loop at the end enforces that every string-typed key is actually a string; non-string values produce InvalidDocument before Rust core touches them. ✓

integrations/rustev-node/src/lib.rs — prepare_profile / prepare_profile_async

prepare_profile acquires Blocking::enter synchronously; prepare_profile_async acquires it before spawn_blocking and moves the token into the closure, so the slot is held for the full duration of the blocking work and released on drop. live() is checked in profile_uncounted (and again before spawn for the async path). The cloned Engine moved into the closure shares the same Arc<Inner> and telemetry handle. All correct. ✓

integrations/rustev-node/src/commands.rs — routing

if matches!(name, "check" | "compile" | "profileCheck" | "planDiff") {
    return crate::profile::command(name, inputs, a);
}

For check/compile, profile::command calls plan_command; for profileCheck, profile::check; for planDiff, plan_diff::diff. Routing matches declarations. ✓

integrations/rustev-node/index.d.ts

profileCheck returns CommandResult (synchronous via commandSync). planDiff returns Promise<CommandResult> (async via command). Both match the implementations. ✓

PlanDiffArgs is a union without a literal discriminant field, so TypeScript cannot narrow it structurally. The runtime discriminates via Rust validate (presence of leftPlan), but callers writing TypeScript with the planDiff overload may get unexpected inference. This is a low-severity type-definition quality issue, not a functional defect.

tools/rustev-conformance/js/run.mjs

delete args.definition before the parameterized block removes the single-definition key; args.definitions is set only when a.many('definition') is non-empty. For plan-diff plans-mode, neither is set, which is correct. Empty descriptors/rules/calibrations arrays are deleted to match the native API's absent-means-omitted semantics. ✓

specs/063-node-binding-parity/spec.md

Increment 2 changelog accurately describes the routing, error types, detail shapes, and test coverage. No internal contradiction with the code changes.

No concrete defects found.

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

Subject: 4503383...409842d, diff digest 132fe2827914a7dcc42c5d68ac779223669245a6130d4f0416419dda837fce03, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit b3bcc5f Nov 6, 2026
26 checks passed
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