Skip to content

impl(031): increment 5, the npm members and the absences in the release set - #162

Merged
bartekus merged 1 commit into
mainfrom
impl/031-npm-members
Oct 22, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/031-npm-members

Conversation

@bartekus

@bartekus bartekus commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Spec 031 increment 5: the npm members and the absences in the release set, and the audit fix the first full release candidate found (spec 021).

  • Release set (tools/rustev-release/release-set.json). Spec 027 is complete (R-47), so its npm packages join the family: npm lists the seven per-platform packages by name, then @statecrafting/rustev, then @statecrafting/rustev-wasm, each with its directory. absent lists, with reasons, what 031 3.1 plans but this release does not ship: the prebuilt rustev CLI binaries (no release workflow yet; the CLI ships as the rustev-cli crate), the rustev-serve image and crate (spec 010 in progress), and rustev-bedrock, rustev-backend-embed-linear. rustev-otel (spec 028, impl(028): the span projection and JSONL exporter in rustev-otel #158) exists and stays under excluded with its reason.
  • Check (src/npm.rs, run by rustev-release manifests). Each npm member's package.json: name, family version, license, repository URL and directory, description, files, os/cpu for platform packages, no runtime dependency, the main package's optionalDependencies naming exactly the release's platform packages at exactly the family version, and the "private": true guard spec 027 keeps until publication (the release's packing step removes exactly that field). The set's shape refuses wrong npm order, wrong scope or directory, duplicates, and an absence with an unknown kind, no reason, or a member's name. tests/npm.rs passes on the repository and breaks each rule once.
  • Audit fix (spec 021 3.6). make release-candidate at 00a4b7c (local) reproduced all eleven archives byte-identically, passed the archive policy, the unpacked tests on 1.98.1 and MSRV 1.88, and wrote every SBOM, then failed cargo deny on RUSTSEC-2026-0381 (webpki-roots 1.0.9) and RUSTSEC-2026-0382 (rustls-webpki 0.103.15), via rustev-remote-http. The lock now holds 0.103.16 and 1.0.10, and the workspace's webpki-roots floor is 1.0.10. Recorded in 021's implementation record; 021 3.7 stays open until the candidate passes in full at a commit with this fix.
  • Archive bound (spec 021 3.5). A second candidate run at this PR's first head (3670e6b) passed packaging and SBOMs, then failed the archive policy: rustev-eval's unpacked total is 279,602 bytes against its reviewed bound of 262,144 after spec 029's statistics core (impl(029): increment 1, the statistics core #155). The bound is raised, by review, to 393,216; the archive (73,245 bytes) and every other bound are unchanged.

No workflow change; nothing is published.

Review findings answered

  • Round 2 (419b664), bundleDependencies read as an object: fixed. The bundled list (either spelling) is judged as npm defines it (an array of names, or true); empty maps and lists declare nothing. Tests cover [], a named list and true for both spellings, and {} for dependencies.
  • Round 3 (9ad8a9b), rustev-otel listed as absent and unimplemented: fixed. impl(028): the span projection and JSONL exporter in rustev-otel #158 merged the crate as an exclusion; the absence is removed and the record says why.
  • Round 4 (9a461fe), a refused directory still read: fixed. expected_directory gives each family package its one directory (a platform name is lowercase letters, digits and single hyphens), and check_npm opens only a member whose directory is exactly that; tests show a .. directory or platform name is refused and never read.

Checks

  • cargo fmt --check, cargo clippy -p rustev-release --all-targets -D warnings, cargo test -p rustev-release (all suites): passed locally on the first head; the round-2 fix is verified by CI (the shared target was in use by the candidate run).
  • cargo run -p rustev-release -- manifests: 11 crates and 9 npm packages pass.
  • cargo deny ... check with the release policy: advisories, bans, licenses, sources ok.
  • make gate: passed. spec-spine couple: OK. check-authored-content.sh: clean.

@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for bugs, security issues, and inconsistencies.

Cargo.lock / Cargo.toml: The rustls-webpki bump (0.103.15 → 0.103.16) and webpki-roots bump (1.0.9 → 1.0.10) address the two RUSTSEC advisories cited in spec 021. The workspace floor for webpki-roots is raised from 1.0.5 to 1.0.10, ensuring published manifests cannot resolve an affected version. The lock holds the expected upgraded checksums. Correct.

tools/rustev-release/src/npm.rs:

  • platform_of: correctly strips @statecrafting/rustev- and excludes wasm and the bare main package. Returns None for NATIVE_MAIN (empty suffix fails strip_prefix('-')).
  • check_npm_set set-level validations: duplicate detection, scope guard, expected-directory derivation, platform-before-main ordering, platform lexicographic sort (>= on suffix strings, correct given the list), WASM-last check via position + 1 == len, and absent-kind / absent-reason / member-conflict checks are all logically consistent with the spec description.
  • check_npm per-package checks: name, version (lockstep), license, non-empty description, repository URL + directory, "private": true, non-empty files, os/cpu for platform packages, optionalDependencies exact-match to the set's platform full names at the family version for NATIVE_MAIN, no runtime deps. All match the spec 031 3.1 description.
  • Lifetime hygiene: optional (borrowing from doc) and named (borrowing from optional) are all within the same per-package scope. Fine.
  • check_npm_set double-violation for a package outside scope that is also unrecognized: generates both "outside scope" and "not a family package" before continue. Cosmetically noisy but not a bug; the continue prevents a spurious directory violation.

tools/rustev-release/src/main.rs: The conversion of check_manifests result to Vec<String> via .iter().map(ToString::to_string) is correct regardless of whether the existing function returns Vec<String> or Vec<T: Display>. Combining with npm violations and unified printing is fine.

release-set.json: The seven per-platform entries are in strict lexicographic order (darwin-arm64 < darwin-x64 < linux-arm64-gnu < linux-arm64-musl < linux-x64-gnu < linux-x64-musl < win32-x64-msvc), NATIVE_MAIN follows, WASM is last. Directories match the platform_of expectations. All absent entries have known kinds and non-empty reasons; none collide with shipped crate or npm members (the absent binary: rustev is intentionally not compared against the binaries entry, per the comment).

Tests: the_repository_passes anchors correctness against the live checkout. Each rule-break test targets one field at a time with only()/set_detail() which assert exactly one violation — these are correct given the mutation applied.

Spec text (021, 031): The 021 increment correctly discloses the audit failure, the fix applied, and that 3.7 (full reproduction) remains open pending the post-merge candidate run. The 031 increment accurately narrates the added member list and absence list relative to the code.

No concrete defect found.

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

Subject: 70a6424...3670e6b, diff digest 543fdd87c0b0eca509eccaca1db9ac6366402191481698b58e7da528456071fd, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus force-pushed the impl/031-npm-members branch from 3670e6b to 419b664 Compare October 22, 2026 02:13
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR for bugs, security issues, and inconsistencies.

Cargo.toml / Cargo.lock: The webpki-roots floor is raised from 1.0.5 to 1.0.10 and the lock holds 1.0.10 to address RUSTSEC-2026-0381/0382. Both files are consistent and the spec narrative in 021 matches.

archive-policy.json: rustev-eval's max_unpacked_bytes raised from 262144 to 393216; the spec 021 candidate run notes 279,602 bytes actual. Internally consistent.

release-set.json: Nine npm members and six absences; their structure and order match what the spec 031 narrative and check_npm_set enforce.

src/npm.rs – platform_of: Correctly excludes the empty-suffix case and the wasm suffix via the .filter.

src/npm.rs – check_npm_set ordering: Platform-before-main, strict-ascending-suffix, and WASM-last checks are logically sound.

src/npm.rs – check_npm – bundleDependencies check (concrete defect):

for key in ["dependencies", "peerDependencies", "bundleDependencies"] {
    if doc
        .get(key)
        .is_some_and(|d| d.as_object().is_none_or(|m| !m.is_empty()))
    {

dependencies and peerDependencies are JSON objects in npm, so as_object() works correctly for them. bundleDependencies is defined by npm as an array, not an object. as_object() on an array returns None; is_none_or(…) then unconditionally returns true, making the whole condition true. This means "bundleDependencies": [] (an empty, semantically harmless array) is incorrectly reported as a violation. No current package.json in the repo uses this field, so no test fails today, but the check logic is wrong for this key.

src/main.rs – path construction: root.join(p) where p is p.directory from the release set. check_npm_set adds a violation for a wrong directory but does not abort reading; check_npm still attempts read(&path) with whatever p.directory says. For an internal trusted tool reading only committed files this is acceptable, but worth noting it does not short-circuit on set violations.

Tests: tests/npm.rs verifies the current repo passes and breaks each rule once. The fixture sets in repro.rs and signing.rs are correctly updated to include the new required npm and absent fields.

No other concrete defects found.

{"head": "419b6647fa03c24541fba18c03e44faca8171b87", "verdict": "findings", "findings": [{"path": "tools/rustev-release/src/npm.rs", "line": 297, "summary": "The bundleDependencies key is treated as a JSON object via as_object(), but npm defines it as an array; any array value including the harmless empty [] triggers a false-positive violation because as_object() returns None and is_none_or() unconditionally returns true on None."}]}

Subject: 70a6424...419b664, diff digest 6bb4fcf8c6d476e2e724d3173ad29ca1495f3a4a4152ee0072a33db1942d30b2, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 22, 2026 02:17 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/031-npm-members branch from 419b664 to 912471d Compare October 22, 2026 02:18
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which covers: TLS dependency updates for two security advisories, an archive policy bound increase for rustev-eval, npm release family membership and validation logic, and spec documentation.

Cargo.toml / Cargo.lock
The webpki-roots floor is raised to 1.0.10 and the lock pins rustls-webpki to 0.103.16, matching the stated advisories. The existing rustls floor (0.23.46) is untouched. The comment accurately reflects the two advisories. No issue.

archive-policy.json
max_unpacked_bytes for rustev-eval raised from 262 144 to 393 216. The spec 021 audit note names the measured size (279 602) and explains the headroom for spec 029's remaining work. Consistent.

tools/rustev-release/src/npm.rs

  • platform_of correctly strips @statecrafting/rustev- and filters out "wasm" and empty.
  • check_npm_set first loop: scope and directory checks run; the None arm pushes "not a family package" and continues. A name that fails the scope check also falls through to the match, generating a second "not a family package" violation before continue. Both violations are accurate; the test only asserts any(…contains("scope")), so this is not a problem in practice.
  • Ordering checks: platform-after-main and ascending-suffix checks are each correct. The platforms local in check_npm_set holds suffixes; the platforms local in check_npm holds full names used to compare against optionalDependencies keys. No confusion between the two.
  • absent duplicate key is (kind, name), so same name with different kinds is allowed. The shipped-and-absent check is correctly gated on "crate" | "npm" kinds only.
  • declares closure handles Bool(true), non-empty Object, non-empty Array, and catches any other value. The empty-array / false short-circuit is correct per npm semantics.
  • private: true guard is required and the test covers its absence on the main package.

tools/rustev-release/src/main.rs
The refactoring of check_manifests result to Vec<String> before extending with npm violations is straightforward. The workspace root via concat!(env!("CARGO_MANIFEST_DIR"), "/../..") is correct for a crate at tools/rustev-release/.

tests/npm.rs
Repository-passing test, ordering tests, field violation tests, and absence validation tests each break exactly one rule and assert the expected violation. Coverage is adequate for the specified rules.

tests/repro.rs, tests/signing.rs
Inline JSON fixtures updated to include "npm":[],"absent":[], required because ReleaseSet now has non-defaulted fields.

No concrete defects found.

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

Subject: 70a6424...912471d, diff digest 7ebd480957cf09439bcc6b3bd759d4a2f5670581c23598f9bafaf366fdd3db48, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus force-pushed the impl/031-npm-members branch from 912471d to 7c68d72 Compare October 22, 2026 02:40
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for bugs, security issues, and inconsistencies.

Cargo.lock / Cargo.toml: The webpki-roots floor is raised from 1.0.5 to 1.0.10 and the lock bumps rustls-webpki from 0.103.15 to 0.103.16. The comment in Cargo.toml correctly names RUSTSEC-2026-0381/0382. rustls-webpki is an indirect dependency of rustls; pinning it via the lock is the correct mechanism. Consistent.

archive-policy.json: The rustev-eval unpacked bound is raised from 262,144 to 393,216 bytes. The spec records explain this (spec 029 statistics modules). The archive bound (131,072) is unchanged. No other bounds change. Consistent with the candidate run evidence.

release-set.json: The nine npm members are listed in the declared order — seven per-platform packages in ASCII-ascending name order, then @statecrafting/rustev, then @statecrafting/rustev-wasm. This matches the ordering rules in check_npm_set. The six absent entries use known kinds (binary, image, crate) and all have non-empty reasons. No member appears in both sections.

src/lib.rs: npm and absent are added as required Vec fields. The companion test files (repro.rs, signing.rs) correctly add "npm":[],"absent":[] to their inline JSON. No #[serde(default)] needed since all callers supply these fields.

src/npm.rs — logic review:

  • platform_of correctly returns None for @statecrafting/rustev (empty suffix) and for @statecrafting/rustev-wasm (filtered by the "wasm" guard). No off-by-one.
  • check_npm_set deduplicates via BTreeSet::insert, validates scope, directory, ordering, WASM-last, and the absence table. All constraints in the spec text are reflected.
  • check_npm constructs platforms as a BTreeSet of full scoped names, then compares to optionalDependencies keys verbatim — correct, since package.json would list the full scoped name.
  • optionalDependencies for non-NATIVE_MAIN packages: empty-map fast-path (unwrap_or_default) means a non-object optionalDependencies (e.g. null) silently passes the else if !optional.is_empty() guard for platform and WASM packages. In practice this would fail npm's own schema check and the declares closure handles the dependency keys; it is a minor gap but not a bug for the stated scope of this tool.
  • check_npm does not bail after check_npm_set violations, so a package with a set-level bad directory will also generate an Unreadable violation. This is verbose but not incorrect.
  • The root.join(p) path in main.rs uses p = "{directory}/package.json" where directory comes from release-set.json. check_npm_set validates the directory against an expected constant before any read, but the read still occurs even on a set violation. The input is a trusted repository file, not external data; no practical exposure.

tests/npm.rs — coverage review:

  • the_repository_passes proves the actual manifests satisfy the checker.
  • the_release_set_fixes_the_npm_members_and_the_absences enumerates and asserts every member and absence by name, cross-checking on-disk platform directories with the npm list.
  • Each subsequent test mutates exactly one field and asserts exactly the expected violation (using only() where one violation is expected, any() where multiple can arise). Arithmetic on indices after pop()/insert() is correct.

No bugs, security problems, or inconsistencies found.

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

Subject: cf6665c...7c68d72, diff digest 5e8c85c12cc287f559f874fe155b5066c76f5b0b2770aad9ad0a9e82b42027d2, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 02:45
@bartekus
bartekus disabled auto-merge October 22, 2026 02:56
@bartekus
bartekus force-pushed the impl/031-npm-members branch from 7c68d72 to 9ad8a9b Compare October 22, 2026 03:22
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff for bugs, security issues, and inconsistencies.

Security bump (Cargo.lock / Cargo.toml): rustls-webpki 0.103.15 → 0.103.16 and webpki-roots 1.0.9 → 1.0.10, floor raised in the workspace manifest. The lock checksums are present; the stated RUSTSEC advisory numbers match the comment. No issue.

archive-policy.json: rustev-eval max_unpacked_bytes 262,144 → 393,216 (384 KiB). The spec text explains why (spec 029 statistics modules). No issue.

src/npm.rs logic: platform_of correctly excludes WASM (filter(|s| *s != "wasm"). Ordering checks (platform after NATIVE_MAIN, lexicographic platform order, WASM last) look correct. The check_npm_set / check_npm split is clean; the absence duplicate key is (kind, name) which is intentional. optionalDependencies comparison uses full package names against the platforms BTreeSet. All checks match the tests. No logic bug found.

src/main.rs: check_manifests result is now .iter().map(ToString::to_string).collect() — if the original return type was Vec<String> this is an unnecessary clone-through-Display, but not incorrect.

Concrete defects found:

1. release-set.json — incorrect absent reason for rustev-otel. The entry states "reason": "planned by its own spec (#70), not implemented". The base commit's repo context lists a complete implementation: integrations/rustev-otel/Cargo.toml, src/ids.rs, src/jsonl.rs, src/lib.rs, src/project.rs, tests/golden.rs, tests/projection.rs, and multiple golden fixtures under integrations/rustev-otel/tests/golden/. The crate is implemented; the stated reason is factually wrong.

2. specs/031-public-api-and-release-family/spec.md — wrong spec attribution and wrong status for rustev-otel. The added text reads: "the planned crates rustev-bedrock, rustev-otel and rustev-backend-embed-linear (spec 011)." rustev-otel is owned by spec 028 (028-opentelemetry-evidence-sink), not spec 011 (which is the semantic-backend spec). Additionally, calling it "planned" contradicts the implemented codebase shown in the repo context.

{"head": "9ad8a9bd613cce102655395679c0c61456347329", "verdict": "findings", "findings": [{"path": "tools/rustev-release/release-set.json", "line": null, "summary": "The absent entry for rustev-otel states reason 'not implemented', but the base commit contains a full implementation at integrations/rustev-otel/ (Cargo.toml, src/, tests/, golden fixtures)."},{"path": "specs/031-public-api-and-release-family/spec.md", "line": 752, "summary": "The added text attributes rustev-otel to '(spec 011)' and calls it 'planned', but rustev-otel is owned by spec 028 and is fully implemented in the repository."}]}

Subject: 70b99ea...9ad8a9b, diff digest 6206b82daec767aaa761d08547825c64ea1ebb664a59c3b2cc5d788c850050d4, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 22, 2026 03:25 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/031-npm-members branch from 9ad8a9b to 385371a Compare October 22, 2026 03:26
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which adds npm-member checking to the release tooling, bumps TLS dependencies for security advisories, and raises an archive size bound.

tools/rustev-release/src/npm.rs — logic

  • platform_of correctly strips @statecrafting/rustev- prefix and excludes "wasm" and the empty suffix (matching NATIVE_MAIN itself). ✓
  • check_npm_set enforces scope, directory, upload order (platform packages before NATIVE_MAIN, WASM last, platform names strictly sorted). Order of violations is correct: an out-of-scope package emits two errors (scope + not-a-family-package), which is verbose but not a defect.
  • The absent-vs-member collision check correctly restricts to "crate" and "npm" kinds, deliberately leaving "binary" unchecked (the prebuilt rustev binary has the same name as the crate target but ships inside rustev-cli). The comment confirms intent. ✓
  • The duplicate-absence key is (kind, name), allowing the same name under different kinds. This matches the data: "binary"/"rustev" and the crate rustev-cli co-exist without collision. ✓
  • check_npm calls check_npm_set first, so both layers of validation run and aggregate correctly. ✓
  • Runtime-dependency checks cover dependencies, peerDependencies, bundleDependencies, bundledDependencies; devDependencies is intentionally omitted (dev-only, not a runtime dep). ✓

tools/rustev-release/tests/npm.rs — test coverage

  • only() asserts exactly one violation; tests that rely on it are constructed carefully so no extra violations fire (verified for each ordering case). ✓
  • Local const WASM (file path) does not shadow the imported npm::WASM constant because npm::WASM is never imported in the test file. ✓
  • The on_disk.sort() + assert_eq!(on_disk, npm[..7]) check is order-independent on the filesystem. ✓

tools/rustev-release/src/main.rs

  • check_manifests(…).iter().map(ToString::to_string) assumes the pre-existing return type implements Display. The spec candidate-run records show make code passed, so compilation is confirmed by evidence. ✓
  • root = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/../..")) correctly reaches the workspace root from tools/rustev-release. ✓

tools/rustev-release/release-set.json

  • Platform packages are in strict lexicographic order of their suffixes (darwin-arm64 < darwin-x64 < linux-arm64-gnu < linux-arm64-musl < linux-x64-gnu < linux-x64-musl < win32-x64-msvc), followed by NATIVE_MAIN, then WASM. Matches the ordering rules in code. ✓
  • Absent entries all carry non-empty reasons and known kinds; none collide with shipped members by the applicable crate/npm check. ✓

Dependency updates

  • webpki-roots floor raised 1.0.5 → 1.0.10; lock holds rustls-webpki 0.103.16. Matches advisories RUSTSEC-2026-0381/0382 (distrusted emSign intermediates). Comment in Cargo.toml is accurate. ✓

Archive policy / spec records

  • max_unpacked_bytes for rustev-eval raised 262144 → 393216 in both archive-policy.json and the spec-021 candidate-run record; the candidate-run description (279,602 bytes observed against the old 262,144 bound) is internally consistent. ✓

No concrete defects found.

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

Subject: 70b99ea...385371a, diff digest 1ae80cccf72d4ef50d4d819a1e77eb488de307eef47dffde073e3dc1e92c8587, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus enabled auto-merge (squash) October 22, 2026 03:37
@bartekus
bartekus force-pushed the impl/031-npm-members branch from 385371a to 9a461fe Compare October 22, 2026 03:56
@github-actions

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR: a security fix bumping webpki-roots/rustls-webpki, an archive-policy bound increase for rustev-eval, and the new npm.rs module that validates npm member package.json files as part of rustev-release manifests.

Cargo/spec changes look correct. The RUSTSEC numbers cited in the comment match the advisory descriptions. The max_unpacked_bytes raise for rustev-eval (262,144 → 393,216) matches the candidate-run record in spec 021.

tools/rustev-release/src/npm.rs — one concrete defect:

check_npm_set validates that p.directory matches the expected path and records a NpmViolation::Set if it does not, but a recorded violation does not prevent check_npm from proceeding into its per-package loop. The loop then constructs let path = format!("{}/package.json", p.directory) (line ~180) from the same unvalidated p.directory and passes it directly to the caller-supplied read closure. In src/main.rs that closure is |p| std::fs::read(root.join(p)).map_err(...). Path::join does not strip .. components, so a directory value such as "../../../../etc" would cause a file read outside the repository root. Because the violation is only emitted and not acted upon, a release-set.json with a crafted directory field—submitted as a PR and executed by CI—would traverse to an arbitrary path and expose field values through violation messages (the format!("is {:?}", doc.get("name")) arms).

The fix is to sanitise the path before reading (e.g. assert no .. component) or to skip the per-package read loop entirely for any package that already has a Set-level violation.

No other findings. The platform_of logic correctly handles WASM and NATIVE_MAIN, ordering checks are sound, the optionalDependencies cross-check is correct, and the test suite systematically exercises each rule.

{"head": "9a461fe1261b56b8133fa4f6e06394f8bd9bde93", "verdict": "findings", "findings": [{"path": "tools/rustev-release/src/npm.rs", "line": 180, "summary": "check_npm_set records a violation for an unexpected directory but does not stop check_npm from reading from that path; a release-set.json entry with a directory containing ../ components passes the violation through and still reads an arbitrary file via the unguarded Path::join in the main.rs closure."}]}

Subject: 68f40c0...9a461fe, diff digest 4b3b101a514868ff12d8a506628e47fe11614a4383bf1ae0831c6343c3c57d09, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 22, 2026 04:01 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/031-npm-members branch from 9a461fe to e299fa3 Compare October 22, 2026 04:02
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

I'll review the PR for bugs, security issues, and inconsistencies.

Security update (Cargo.lock / Cargo.toml)

The bump of webpki-roots from 1.0.9 → 1.0.10 and rustls-webpki from 0.103.15 → 0.103.16 is correct. Both the floor in Cargo.toml and the locked versions are updated consistently, matching the stated advisories (RUSTSEC-2026-0381, -0382). The comment in Cargo.toml is additive and accurate.

Archive policy (archive-policy.json)

Raising rustev-eval's max_unpacked_bytes from 262,144 → 393,216 (from 256 KiB to 384 KiB) is consistent with the spec 021 candidate run note: the observed unpacked size is 279,602 bytes, and the spec explains the change is made by review, not automatically. No issue.

npm module (src/npm.rs)

Path traversal protection — expected_directory validates that the platform suffix consists only of lowercase ASCII letters, digits, and - separators. . is not allowed, so ../../etc is rejected before any path is built. The guard in check_npm:

if expected_directory(&p.name).as_deref() != Some(p.directory.as_str()) {
    continue;
}

ensures no file is read unless the release set's declared directory exactly matches the derived expected directory. The tests in the_npm_list_shape_is_checked explicitly assert no path with .. is ever opened. Protection is sound.

platform_of edge cases — @statecrafting/rustev (NATIVE_MAIN) gives "" after the two strips, filtered by !s.is_empty() → None. @statecrafting/rustev-wasm gives "wasm", filtered by *s != "wasm" → None. Both corner cases are handled correctly.

Absent duplicate key — The BTreeSet uses (kind, name) as the key, so two entries with the same name but different kinds are correctly allowed (e.g. image ghcr.io/…/rustev-serve and crate rustev-serve). The shipped-vs-absent check only applies for crate and npm kinds, with the rationale documented in the comment.

check_manifests call site — The original return value is transformed to Vec<String> via .iter().map(ToString::to_string). If the original type already implemented Display, this is a correct (if slightly round-about) conversion; the subsequent .extend(...) pattern is sound.

platforms BTreeSet in check_npm — Collects full package names (e.g. @statecrafting/rustev-darwin-arm64), and the NATIVE_MAIN optionalDependencies is compared against them. The package.json keys in optionalDependencies are also full scoped package names, so the comparison is apples-to-apples. Correct.

Spec notes (021 / 031)

The candidate run narrative is internally consistent: the first run at 00a4b7c failed audit (RUSTSEC-2026-0381/0382), which this change fixes; the second run at 3670e6b failed the archive policy for rustev-eval (279,602 > 262,144), which is addressed by the archive-policy.json change. 3.7 (byte-identical reproduction) is noted as not yet closed.

The increment 5 note says npm is "layer 6, which follows the last crate layer" — this is a conceptual description of upload ordering; the JSON separates npm from crate layers structurally, which is a sensible design choice and not a contradiction.

Tests (tests/npm.rs)

Every rule is broken exactly once and the violation is asserted. The the_repository_passes test reads the live package.json files and expects an empty result, so the npm manifest fixtures must already satisfy the policy. No test gaps noted.

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

Subject: 68f40c0...e299fa3, diff digest 02b3d2d7b4bbee285d24a23b5ae3b4171f4e940732dce39ba3f56ca0c91b1546, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus force-pushed the impl/031-npm-members branch from e299fa3 to d703970 Compare October 22, 2026 06:02
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR: a TLS dependency security update (webpki-roots/rustls-webpki), a release-set npm extension (new npm and absent fields), and supporting infrastructure in tools/rustev-release.

Security update (Cargo.toml / Cargo.lock): The floor is correctly raised from 1.0.5 to 1.0.10 for webpki-roots and the lock picks up rustls-webpki 0.103.16. The spec 021 candidate-run notes match the diff.

Path-traversal guard in npm.rs: expected_directory validates every platform segment against [a-z0-9]+ only (no ., /, - within a segment), then check_npm reads a file only when expected_directory(&p.name) == Some(p.directory). Both the directory-traversal and the name-traversal test cases confirm the guard holds: "../../etc" is rejected at the plain check; the assertion in the test closure fires on any .. read attempt.

Ordering logic: The platform-before-main check (i > m), the windows(2) ascending-name guard, and the WASM-last check are all correct and match what the test exercises.

Absence de-duplication: The key is (kind, name), which is the right granularity; the error message (which prints only name) is slightly imprecise but not a defect.

main.rs refactor: check_manifests result is collected into Vec<String> before extending with npm violations; consistent with the else branch printing violations as strings.

archive-policy.json: Bound raised from 262,144 to 393,216 for rustev-eval; the spec 021 candidate-run note gives the concrete measured size (279,602 bytes) and attributes it to spec 029's statistics modules. No other bound is changed.

repro.rs / signing.rs: Both inline JSON fixtures updated to include the new required npm and absent fields; the structs would have failed to deserialize otherwise.

No concrete defects found.

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

Subject: 1b0ce68...d703970, diff digest 364df4f199b1c937f2c6105e0e14a135f4f2c2bfd32d4d1ecf6a0973e9a8823a, 1 call(s). An AI comment is not an approval.

…se set

Spec 027 is complete (R-47), so its npm packages join the release family:
release-set.json lists the seven per-platform packages, the native main
package and the WebAssembly package in the npm layer's upload order, and
lists as absent, with reasons, the prebuilt CLI binaries, the
rustev-serve image and crate, and the planned bedrock, otel and
embed-linear crates. rustev-release manifests now also checks each npm
member's package.json (name, family version, license, repository
directory, the private guard spec 027 keeps until publication, platform
os and cpu, no runtime dependency, and the main package's exact
optionalDependencies); tests/npm.rs breaks each rule once. No workflow
changes and nothing is published.

Spec 021: the candidate at 00a4b7c reproduced and unpacked all eleven
archives but failed the audit on RUSTSEC-2026-0381 and 0382; the lock
now holds rustls-webpki 0.103.16 and webpki-roots 1.0.10, the latter's
floor is raised to match, and cargo deny passes with the release policy.
@bartekus
bartekus force-pushed the impl/031-npm-members branch from d703970 to 7c4ea89 Compare October 22, 2026 06:32
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff across all changed paths.

Cargo.toml / Cargo.lock — TLS bump

webpki-roots raised from 1.0.5 to 1.0.10 (floor) and the lock pins rustls-webpki at 0.103.16. The comment cites RUSTSEC-2026-0381/0382 (distrusted emSign intermediates). Version constraint is "1.0.10" (semver >=1.0.10, <2.0.0), which is the correct form for a security floor. Consistent with the spec 021 candidate-run narrative.

archive-policy.json — rustev-eval unpacked bound raised from 262,144 to 393,216 bytes. Documented in spec 021 with the observed measured total and the rationale (spec 029 statistics modules). No issue.

release-set.json — nine npm members added in stated order (seven platform packages, native main, wasm); five absent entries with kinds and reasons. Matches the code and the spec 031 increment-5 narrative.

src/npm.rs — path traversal / injection analysis

platform_of strips the @statecrafting/rustev- prefix and rejects "wasm". expected_directory then validates each hyphen-separated segment of the suffix: every byte must be ASCII lowercase or ASCII digit, so . (period, slash, backslash) cannot appear. Any name that does not pass produces None, which the set-level check turns into a "not a family package" violation before check_npm ever opens a file. check_npm additionally guards with if expected_directory(&p.name).as_deref() != Some(p.directory.as_str()) { continue; } so a directory mismatch already flagged at the set level is also never opened. The tests exercise ../../etc names and assert no .. path is passed to read. Validation is sound.

optionalDependencies on the native main package is compared against the full platforms BTreeSet (all entries in set.npm for which platform_of returns Some). If the set has a platform entry whose directory is already rejected (and thus skipped), the platforms set still includes it, which could cause a spurious optionalDependencies mismatch violation against the main package. However this only arises when the release set is already malformed and a set-level violation was already emitted, so the impact is a redundant (not missing) error message, not a false clean result.

The absent-duplicate key is (kind, name), so ("crate", "foo") and ("npm", "foo") would not be flagged as duplicates. This appears intentional (different artifact kinds), and the current absent entries are all distinct on name alone.

tests/npm.rs — covers the repository itself, every rule broken once, ordering variants, path traversal cases. Coverage is thorough.

main.rs — root is built from CARGO_MANIFEST_DIR (absolute) with /../..; combined with the validated paths from check_npm, no untrusted path reaches std::fs::read.

No concrete defects found.

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

Subject: 262b37c...7c4ea89, diff digest 66d5073db98a3df2f823cb5b3695af0497fadac77352eb7ee8a0e8ce78f1a17e, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus merged commit 6060167 into main Oct 22, 2026
26 checks passed
@bartekus
bartekus deleted the impl/031-npm-members branch October 22, 2026 07:15
bartekus added a commit that referenced this pull request Oct 22, 2026
…g candidate (#167)

## Summary

Small follow-up in lane C (specs 027, 021, 045).

- **Binding test flake (027).**
`integrations/rustev-node/test/negative.test.mjs` and the conformance
driver (`tools/rustev-conformance/js/run.mjs`) bounded their waits for
an engine-side condition by 100,000 event-loop turns. A loaded CI runner
exhausted them in "a host backend resolving after the deadline is
discarded and counted" (#151's `bindings / wasm`, "waited forever").
Both waits are now bounded by 120 s of wall time, still yielding with
`setImmediate` and never sleeping; no assertion changed.
- **Release candidate evidence (021, 045).** `make release-candidate`
passed in full at `419b664` (a reviewed head of #162), locally on macOS
arm64: eleven archives byte-identical across two clean runs, archive
policy, unpacked tests on 1.98.1 and MSRV 1.88, `cargo deny` clean with
no exception, SBOMs, changelog, and the release manifest (SHA-256
`8b4e92e8dbd42fb91394474bb02fd58a59875c8fe8310f066174d44069b4761a`).
Recorded in 021 as evidence for that commit only; the release candidate
is rerun at the commit the owner names. 045's second acceptance item is
met; it stays `pending` on the upload-order item, which waits for the
owner.

Nothing is signed, tagged or published.

## Checks

- `node --check` on both scripts: OK. `make gate`: passed. `spec-spine
couple`: OK. `check-authored-content.sh`: clean.
- The Node tests run in CI's `bindings` jobs.
bartekus added a commit that referenced this pull request Oct 22, 2026
Spec 029 increment 3: repeat sets and `rustev.repeat-report/1` (3.1,
3.2.5, 3.5, 3.6). Library only; no CLI, ledger, baseline or gate yet; no
live run, provider call or spend. `implementation` stays `in-progress`.

- `rustev-eval/src/repeat.rs` (new): `repeat(RepeatInputs)` over N
reconciled runs. Refuses the `live` source (`live-source-unavailable`),
  N outside 1 to 64, unreconciled case measures (`reconcile`), runs that
  differ in dataset, split, evaluator configuration, plan or metric list
  or do not list the split's cases in manifest order (`mixed-runs`), a
  `replay` set whose runs are not identical (`not-reproducible`), an
  unreported stability metric or override, and a cohort over the
  bootstrap bound (`bootstrap-too-large`). The report names the source,
  configurations, dataset, split and fixed role (3.7.1), provenance,
  adapter rules, plan, each run's document digests and run seed, the
  stable cohort, and per cohort (`all`, then each slice) every metric's
per-run values, `mean`, `sd`, `min`, `max`, `pooled`, interval and band
  with its basis. Slices below their minimum are unknown throughout; a
metric without a per-case measure (cost totals, `brier`) has across-run
  statistics in `all` only. Latency, queue and cost metrics state their
observation (`historical` for candidate runs, 3.11.2). A held-out report
  records `held_out` as unknown until increment 4 adds the ledger.
- `rustev-eval/src/report.rs`, `eval_cases.rs`: `cost_per_1000/observed`
  and `/estimated` case measures (3.2.5), unknown unless cost units are
  declared comparable, the observed series unknown for a case with
  liability or an unknown charge; none for a candidate.
- `rustev-eval/src/repeat_stats.rs`: `across_runs`, factored out of
  `run_stats` unchanged, for metrics stated only by the run reports.
- Tests (`tests/reports.rs`): replay set (zero `deterministic_replay`
  band, pooled equal to the report, distinct run seeds, stable cohort,
  totals and `brier`, observations, unknown `cost_per_1000`, a reported
  slice and one below its minimum, round trip and byte determinism);
  captured set with a case losing its bundle (stable cohort, positive
  `k_sd` band); one captured run (unknown band); differing replays, the
  live source and N of 0 and 65 refused; mixed baseline and candidate
runs, unreconciled measures and an unreported stability metric refused;
  a candidate set with historical observations and `interval_width`
  bands.
- `tools/rustev-release/archive-policy.json`: `src/repeat.rs`.
- Spec 029: increment 3 record and engineering choices.

Still open from increment 2: owner decision D-029-1 (Brier per-case
measures), recorded in spec 029's implementation record.

Local verification (macOS arm64): `make gate` passes with spec-spine
0.31.0; `cargo clippy -p rustev-eval --all-targets -- -D warnings`,
`cargo test -p rustev-eval` and `cargo test -p rustev-fp-corpus` pass.

Review round 1 (1 finding, not a defect, evidence added): the finding
says
a candidate's cases get a known `cost_per_1000/observed` when costs are
comparable and known. The cost measures sit inside `case_measures_of`'s
`if inputs.candidate.is_none()` block (opened above the latency loop,
outside the reviewed hunk), so a candidate's cases carry none. A comment
now says so in the hunk, and a new test,
`cost_per_1000_is_measured_for_a_baseline_and_never_for_a_candidate`,
declares cost units comparable and checks that the baseline's cases
carry
cost per 1000 while the candidate's carry none and its repeat report's
`cost_per_1000/observed` is historical and unknown.

Review round 2: no findings. Rebased onto `main` after #159 (no
conflict).
`make code` passes locally on this head, except two failures caused by
other worktrees sharing the build target (a test binary removed by a
concurrent `cargo clean`, and `rustev-jev`'s `lodging_swap` finding its
output directory already created by a concurrent run); each passes when
rerun alone.

Review round 3 (1 finding, fixed by making the rule explicit): the
finding
says `cost_unknown_attempts` should carry no observation. It is one of
the
four cost series a spec 004 candidate report replaces with "the
candidate
was not executed; latency and cost are the baseline's", so it is an
observation of the runs and historical for a candidate, as 3.12.4 needs.
`observation` now lists latency, queue, the four cost series and
`cost_per_1000/*` by name instead of a `cost_` prefix, with that reason
in
its comment; the candidate test checks the cost series are historical
and
a quality metric has no observation.

Local on this head: `make gate` passes; `cargo test --workspace
--no-fail-fast` passes except `rustev-release --test manifests`, which
reports a `rustev-aicortex` member that exists only in another lane's
worktree sharing the build target, and passes when run alone; clippy,
fmt and boundaries pass.
Rebased onto `main` after #157 (no conflict); `rustev-eval` and
`rustev-release` tests (including `manifests`, now that
`rustev-aicortex` is on `main`) and `rustev-eval` clippy pass on the
rebased head.
Review round 4: no findings. Rebased onto `main` after #162 (no
conflict).
Review round 5: no findings. Rebased onto `main` after #160 (no
conflict); `make code` and `make gate` pass locally on this head.
Review round 6: no findings. Its `code` run failed in
`rustev-remote-http --test runtime_batch`

(`a_deadline_or_a_cancellation_after_send_ends_every_member_as_independent_calls_do`),
a timing test in a crate this PR does not touch. Rebased onto `main`
after
#167, which changes no Rust source, so the previous head's local `make
code`
still covers the Rust tree; `make gate` passes.
bartekus added a commit that referenced this pull request Oct 22, 2026
## Summary

Spec 031 increment 6: the release workflow with build provenance.
Increment 5 (#162) has merged; this PR is rebased onto `main`.

**This is a workflow change: it needs the owner's approval of the
`statecraft-review-exception` Environment.**

`.github/workflows/release.yml` runs only when dispatched by hand on the
signed release tag (`gh workflow run release.yml --ref vX.Y.Z -f
tag=vX.Y.Z`). It is not a required job and changes no managed file.

- `tag`: refuses a tag other than the release set's, a lightweight tag,
a signature that does not verify against
`tools/rustev-release/allowed_signers`, or a dispatch on another ref.
- `bindings`: spec 027's bindings workflow at the tag; supplies each
platform's addon.
- `cli`: `rustev` on the seven platforms in the bindings images at the
commit's source date; `--help` and a `plan check` of the lodging
reference plan that must equal its golden; archived with the license and
attested.
- `pack`: `rustev-release manifests`, the WebAssembly package built as
`make bindings` does, each addon staged, exactly the `private` guard
removed, the nine npm members packed in release order and attested.
- Attestations: `actions/attest-build-provenance` 4.2.2, keyless
Sigstore signatures over SLSA v1.0 provenance (Build Level 2, 031
3.9.5).
- `npm`: publishes with npm provenance through trusted publishing (no
token), only with `publish-npm: true` and after the owner approves the
`npm-publish` Environment. Nothing here dispatches it, creates that
Environment or the trusted publisher, or publishes.

## Review findings answered

- Round 3 (`17d292e`), `npm` job never sets `NODE_AUTH_TOKEN`: fixed
differently. Publication is by npm trusted publishing (OIDC), which
needs no token but needs npm 11.5.1 or later (Node 22 bundles npm 10).
The job now installs npm 11.21.0 pinned and checks it, and no longer
passes `registry-url`, so no `.npmrc` expects a token.
- Round (`ba6fed2`), npm pinned by version only: fixed. The job
downloads the npm 11.21.0 tarball, checks its SHA-512 against the
registry integrity recorded in the workflow (`sha512-Zov8...qivPg==`,
verified locally), and installs that file with `--ignore-scripts`.
- Round (`a2c5447`), `process.argv[1]` under `node -e` is empty: not so.
With `-e` there is no script path, so `argv[1]` is the first argument:
`node -e 'console.log(JSON.stringify(process.argv.slice(1)))'
integrations/x` prints `["integrations/x"]` (Node 24.6.0; the same
layout on Node 22). A comment in the step now states it.
- Round (`c697c11`), the `bindings` call would deny
`id-token`/`attestations`: not applicable. `bindings.yml` declares only
`permissions: contents: read` at the top level and no job asks for more
(`grep -n 'id-token\|attestations' .github/workflows/bindings.yml` finds
nothing); `upload-artifact` needs no token permission. The call now
states `contents: read` explicitly with that reason; the attestations
are made in `pack`.

## Open, recorded in 031's record

- The CLI has no version command (spec 006), so 031 3.9.7d's version
step cannot run as written.
- macOS and Windows CLI archives use bsdtar without fixed order or
times, so they are not yet reproducible (3.9.3); the Linux ones are.
- Not yet: two-build comparison for tarballs and binaries, the npm audit
(3.9.2), their SBOMs (3.9.1), and the hosted release (layer 8).

## Checks

- `actionlint .github/workflows/release.yml`: clean. `make gate`:
passed. `spec-spine couple`: OK.
- The workflow has not been dispatched: it needs a signed tag, and
publication waits for the owner's instruction (021 3.9, 031 3.11).
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