Skip to content

impl(011): stage 4 measured on linux-aarch64-gnu - #462

Merged
bartekus merged 1 commit into
mainfrom
impl/011-linux-stage4
Nov 3, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/011-linux-stage4

Conversation

@bartekus

@bartekus bartekus commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Adds spec 011's stage 4 measurement for linux-aarch64-gnu to the feasibility record (3.2, 3.13). This is local CPU inference only, with no provider call or spend. It is stacked on #455, which commits the record.

Result

linux-aarch64-gnu Measured Limit Result
Cold setup 383.9 ms 2,000 ms Pass
Peak RSS 282,726,400 bytes 536,870,912 Pass
Warm p95 59.6 ms 100 ms Pass
Warm p99 60.3 ms 200 ms Pass
  • All 19 inferred fixtures agree with the reference, with exact token ids, and are bitwise repeatable in process.
  • Stages 1 to 3 pass. Stage 4 still refuses, for the complete-backend items of 3.13 that were not measured. The platform is not qualified, because the Node local-embed build has not run. Thresholds are unchanged.
  • Host: a Docker Desktop Linux VM on an Apple M5 Pro (Debian 12, glibc 2.36, 18 virtual CPUs), not a dedicated Linux server. The record and linux-aarch64-gnu-host.json say so.
  • linux-x86_64-gnu: still not measured on this host. No native x86_64 Linux host was available, and an emulated run would not be a measurement.

Change

  • examples/feasibility.rs:
    • reads the runtime version through dlopen on any Unix, not only macOS;
    • checks a per-platform runtime digest, for measured platforms only. The linux-aarch64 library comes from the official 1.31.0 tarball, verified against its published digest. x86_64 gets a digest when it is measured.
  • measure.py names its outputs by platform key and converts Linux's KiB to bytes.
  • Record bindings: the record binds the new bytes of both files and keeps the digests macos-aarch64 was measured with (macos_aarch64_measured_with).
  • New script: rerecord_linux.py, in rerecord.py's conventions, adds the platform to the A-73 record and rewrites feasibility.sha256 (sha256:5213cc048ef44c8452ae6d03d4b87c6252b0de9db08e47aa2e7a15e6f74cc464). Every evidence file is bound by SHA-256.
  • New evidence files: linux-aarch64-gnu.json, -resource.json, -stderr.txt and -host.json.
  • tests/feasibility_record.rs checks:
    • stages 1 to 3 on both measured platforms;
    • every encoder limit on linux-aarch64;
    • that linux-x86_64 is still unmeasured.
  • Spec 011's implementation record, the qualification README and the crate manifest's comment describe it. status: and implementation: are unchanged.

The qualification directory is excluded from the AI review (review.exclude). Review rerecord_linux.py, the probe and measure.py diffs, the test and the spec paragraph.

Checks

  • make refresh
  • make gate
  • bash scripts/check-authored-content.sh
  • make code
  • make boundaries at 4c8edd61

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

AI review (findings)

Looking at the four changed files, I'll focus on the hash table added to feasibility.rs and the claim it makes against the qualification record.

Unverified runtime digest for linux-x86_64-gnu

feasibility.rs line ~133 adds:

("linux", "x86_64") => "469849977cb60744ea160927e1a3a0643fd4c55c0aff743251c6d293402e334e",

The spec text (added to specs/011-semantic-backend/spec.md) explicitly states: "no native x86_64 Linux host was available, and an emulated measurement would not be one." The test in feasibility_record.rs confirms the qualification record marks every linux-x86_64-gnu stage as "refuse" with reason "not measured on this host".

Pinning a binary-identity hash for a platform that was never measured contradicts that status. The probe is not built by CI (autoexamples = false), but it is kept as bound evidence of what was measured. A hash for a platform whose binary was never fed through the probe is an asserted, not measured, claim, which conflicts with constitution principle XI and the record's own "not measured on this host" verdict. If someone manually runs the probe on an x86_64 Linux host and the runtime binary happens to match this hash, the probe will pass its identity gate and proceed to gather measurements that have no place in the current qualifying record, with no gate to stop it.

No other defects were found. The #[cfg(unix)] broadening is correct (dlopen is available on all Unix targets, and the non-Unix arm properly errors). The two measured-platform hashes are 64 hex characters each (SHA-256). The test assertions are consistent with the spec text for the two actually-measured platforms.

{"head": "7e253993816f7e6fe2cf0bffede674a874214d8a", "verdict": "findings", "findings": [{"path": "backends/rustev-backend-embed-linear/examples/feasibility.rs", "line": 132, "summary": "A runtime SHA-256 digest is pinned for linux-x86_64-gnu even though the spec and qualification record both state that platform was never measured, making this an unverified assertion rather than measured evidence."}]}

Subject: daea92e...7e25399, diff digest de8634494e87a430688a966aa83aa10b987a7d8e6380d05c4a8bfc788a828aaf, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 2, 2026 23:52 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/011-feasibility-record branch from daea92e to 4c8edd6 Compare November 2, 2026 23:54
@bartekus
bartekus force-pushed the impl/011-linux-stage4 branch 3 times, most recently from dd91b92 to c370a81 Compare November 3, 2026 00:38
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing each changed file for bugs, security issues, and inconsistencies.

backends/rustev-backend-embed-linear/Cargo.toml — comment update only; no issues.

backends/rustev-backend-embed-linear/examples/feasibility.rs

  • #[cfg(unix)] replaces #[cfg(target_os = "macos")] — correct, dlopen is a POSIX API available on both Linux and macOS; the fallback stub mirrors the change.
  • Both pinned SHA-256 strings are exactly 64 hex characters: macOS 2a50a63e…4b70 and linux-aarch64-gnu 595c7f7a…af99 — correct length.
  • Match arms cover ("macos", "aarch64") and ("linux", "aarch64"); all other combinations return an explicit error. No default or silent bypass.

backends/rustev-backend-embed-linear/tests/feasibility_record.rs

  • New helper stage_verdicts panics via .unwrap() if the platform key is absent from record.platforms or has no stages array; it is called for both linux-aarch64-gnu (measured) and linux-x86_64-gnu (expected to be in the record as an all-refuse unmeasured entry per the spec paragraph). Consistent with the spec claim that the record represents linux-x86_64-gnu as not measured.
  • stage_verdicts(&record, "linux-aarch64-gnu") is asserted equal to verdicts (["pass","pass","pass","refuse"]), which implicitly verifies the platform is not qualified (stage 4 refuses). The loop for platform in PLATFORMS (unchanged) checks the top-level verdict field; since the PLATFORMS definition is not in the diff, I cannot confirm it was updated to include linux-aarch64-gnu, but the stage assertion already covers the non-qualified claim.
  • encoder_limits_are_met_on_linux_aarch64_and_refused_on_macos accesses record.measurements["platform_measurements"]["linux-aarch64-gnu"]["measured_encoder_limits"] and checks all four limits pass; checks a single macOS limit (p95_ms refuses). Weak macOS coverage but not a defect in what is claimed.
  • The stage 4 reason count (assert_eq!(reasons.len(), 1)) is consistent with the spec's claim that only unmeasured complete-backend items are the cause.

specs/011-semantic-backend/spec.md

  • New measurement paragraph is internally consistent: host described as a Docker Desktop VM (not a dedicated server), record says so. glibc 2.36 matches Debian 12. New contract digest provided. The description of examples/feasibility.rs and tests/feasibility_record.rs coverage matches the code changes.

Qualification directory changes are excluded from AI review per AGENTS.md; CI verifies the record digest and evidence SHA-256s mechanically.

No concrete defects found.

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

Subject: 4c8edd6...c370a81, diff digest f32ccc1704490e620520dbafee9da6e225be56d1cc503e0d87e3c1d930aa234a, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus force-pushed the impl/011-feasibility-record branch from 4c8edd6 to 37bb6a1 Compare November 3, 2026 03:39
Base automatically changed from impl/011-feasibility-record to main November 3, 2026 10:26
The encoder probe runs on linux-aarch64-gnu with the 3.13 protocol of
the macos-aarch64 measurement: cold setup 383.9 ms, peak RSS 282,726,400
bytes, p95 59.6 ms, p99 60.3 ms, so every encoder limit of 3.3 is met,
and all 19 inferred fixtures agree with the reference. Stages 1 to 3 pass
there; stage 4 still refuses for the unmeasured complete-backend items and
no platform is qualified. The host was a Docker Desktop Linux VM on an
Apple M5 Pro, as the record states. linux-x86_64-gnu stays unmeasured.

The probe reads the runtime version through dlopen on any Unix and checks
the runtime digest of each measured platform; measure.py names its outputs
by platform key. rerecord_linux.py adds the platform to the A-73 record,
binding every evidence file by SHA-256 and keeping the digests
macos-aarch64 was measured with. The record test checks the new verdicts.
@bartekus
bartekus force-pushed the impl/011-linux-stage4 branch from c370a81 to 9f3f9d9 Compare November 3, 2026 11:16
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (no-findings)

Looking at the four changed files in this PR, which adds Linux aarch64 feasibility measurement to the embed-linear backend.

examples/feasibility.rs

  • #[cfg(unix)] / #[cfg(not(unix))] correctly replaces the macOS-only guard; dlopen is available on all Unix targets and the error message is updated accordingly.
  • The SHA-256 hashes: macOS 2a50a63e…4b70 (64 hex chars) and Linux 595c7f7a…af99 (64 hex chars) are both the correct length for SHA-256.
  • The wildcard arm _ => return Err("runtime_digest_unknown_platform".into()) is the right behavior for unmeasured platforms.
  • The file is not built (autoexamples = false), so this is evidence code only; no runtime exposure.

tests/feasibility_record.rs

  • stage_verdicts helper is straightforward; the .unwrap() on a missing platform key would panic, which is appropriate for a deterministic test fixture.
  • The main test asserts both measured platforms share ["pass", "pass", "pass", "refuse"] and that linux-x86_64-gnu is "not measured" — consistent with the spec.
  • encoder_limits_are_met_on_linux_aarch64_and_refused_on_macos: checks all four encoder-limit fields pass on Linux and p95_ms refuses on macOS — consistent with the spec's numbers (p95 59.6 ms passes the Linux limit; macOS p95 was the previously recorded failure).
  • assert_eq!(reasons.len(), 1) for the Linux stage-4 refusal is consistent with the spec's statement that stage 4 refuses for the single block of "unmeasured complete-backend items" from §3.13, not for any exceeded encoder limit.

specs/011-semantic-backend/spec.md

  • The spec prose accurately describes the code changes (dlopen on Unix, per-platform digest match, measure.py naming outputs by platform key).
  • References to rerecord_linux.py and the updated qualification files fall in the excluded backends/rustev-backend-embed-linear/qualification/ directory; changes there are verified by the feasibility_record.rs test against the contract digest and SHA-256 hashes, not by this review.
  • The contract digest claim (sha256:5213cc…) will be checked by make code / tests/feasibility_record.rs in CI.

Cargo.toml

Comment-only change, accurate.

No concrete defects found.

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

Subject: 3dca8fd...9f3f9d9, diff digest c0b2ba5e30e47cc0a5423f5af02ad72da52adb2568333e1d438b9fdcacdab599, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 4be5525 Nov 3, 2026
27 checks passed
@bartekus
bartekus deleted the impl/011-linux-stage4 branch November 3, 2026 12:19
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