Skip to content

release: image qualification serves one decision of an exact-only synthetic plan (060 3.4.3, amended) - #500

Merged
bartekus merged 1 commit into
mainfrom
impl/060-image-qualify
Nov 4, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/060-image-qualify

Conversation

@bartekus

@bartekus bartekus commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Spec 060 increment 6a: 3.4.3 amended and implemented in the harness. Stacked on #494 (the manifest's image).

  • Spec: 3.4.3 now decides a small exact-only synthetic plan, registered unsigned, compared with a new golden, instead of the lodging reference plan. This is the owner's amendment of 2026-11-03, recorded under Decisions at approval. Reason: the standalone image installs no semantic backends; the remote-backend path is covered by spec 042's tests. The decisions file is not touched.
  • qualification.rs: required reads a named image from m.image; required_on requires the image step on linux-x64-gnu and linux-arm64-gnu only (IMAGE_PLATFORMS); elsewhere it must be excluded with a reason.
  • qualify/harness.py image step:
    • pulls the image by index digest and checks it;
    • gh attestation verify oci://... for the index's provenance and the platform's CycloneDX SBOM;
    • runs 042's check.sh;
    • gets the plan ID from the release's verified CLI (plan compile);
    • starts the image --read-only --network none with qualify/image/serve.json read-only and its socket in a private dir owned by 65532;
    • registers unsigned, decides once, and requires judged plus a judgment equal to qualify/image/judgment.json.
  • Fixtures: qualify/image/{definition,serve,decide,judgment}.json. README updated.
  • Test: a_named_image_is_qualified_on_amd64_and_arm64_linux_only (tests/image.rs).

Local evidence: on the Debian 13 image built for linux/arm64 from this tree, the configuration, registration and decision answered judged with a judgment equal to the golden. The socket was on a Docker volume there, because Docker Desktop host mounts cannot hold a Unix socket; Linux runners bind-mount it as the harness does. Pull and attestation verification run first in a release.

The qualify.yml change (ghcr login, packages: read) follows as its own workflow PR.

Checks: cargo test -p rustev-release --locked --test image --test family --test qualify_harness passed; make gate passed; check-authored-content.sh clean.

Review fixes (round 1): the stray __pycache__ bytecode is removed from the commit. Each request now checks curl's HTTP status (200 required), not only the response schema.

Full checks at 6077e13: cargo test -p rustev-release --locked passed; clippy -D warnings passed; spec-spine verify 031 passed (4 commands).

@bartekus bartekus added the statecraft:stacked-ci Run the full CI matrix on a stacked pull request label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (findings)

Looking at the diff for spec 060 increment 6a: the image qualification harness, its fixtures, Rust logic, and tests.

Findings:

1. Committed compiled Python bytecode cache file

tools/rustev-release/qualify/__pycache__/harness.cpython-314.pyc is a machine- and interpreter-version-specific compiled Python bytecode file. It has no place in version control: it is regenerated by CPython on every import, encodes the CPython 3.14 magic number, and will differ across developer machines and CI images. It should be excluded via .gitignore and removed from this commit.

2. call() does not validate HTTP response status

In harness.py, image_serve()'s call() closure passes -w '%{http_code}\n' to curl, which writes the status code to curl's stdout (logged by self.run()), while the response body goes to the -o out file. The harness never reads that status code back for validation: a 500 or 404 response is caught only if the JSON body schema fails to match (or if the body is not JSON at all, causing read(out) to throw). A correctly shaped unexpected document that happens to pass the schema check would not be caught. A minimal fix is to capture and assert the HTTP status code.

3. harness.py calls self.log.write(compiled.stdout) in image() on bytes, then json.loads(compiled.stdout) — if CLI outputs trailing whitespace or logging lines, json.loads will raise

compiled = subprocess.run([str(cli), 'plan', 'compile', ...], capture_output=True, check=True)
self.log.write(compiled.stdout)
plan_id = json.loads(compiled.stdout)['plan_id']

If the CLI ever emits a trailing newline or any additional output after the JSON object, json.loads will raise json.JSONDecodeError. The existing cli_smoke path presumably handles this, but plan compile with --out plan.json should write the JSON cleanly; the risk is low but worth noting.

{"head": "09960be997e8804bf7779c5ef953eb8a66ccc9b3", "verdict": "findings", "findings": [{"path": "tools/rustev-release/qualify/__pycache__/harness.cpython-314.pyc", "line": null, "summary": "Machine- and interpreter-version-specific compiled Python bytecode committed; should be excluded via .gitignore and not tracked in version control."}, {"path": "tools/rustev-release/qualify/harness.py", "line": 419, "summary": "The curl -w '%{http_code}\\n' status code is written to subprocess stdout and logged but never read back or validated, so non-2xx HTTP responses from the service are only caught incidentally if the JSON body schema mismatches."}]}

Subject: 7b8c0b2...09960be, diff digest 57f74280a778609dc16e270baa51205a1f102bfdefdb3cc9dcadabad1027c129, 1 call(s). An AI comment is not an approval.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the PR, which implements spec 060 §3.4.3's image qualification step: an exact-only synthetic plan is registered unsigned, one decision is served, and the judgment is compared against a golden file.

Rust side (qualification.rs)
required_on correctly gates image qualification to IMAGE_PLATFORMS only. required_files and evidence both switch from required to required_on, keeping the two code paths consistent. The test in tests/image.rs covers the three failure modes (excluded on a qualifying platform, missing on a qualifying platform, passed on a non-qualifying platform). No issues.

Harness (harness.py)

  • socket.name returns only the filename component (serve.sock); with cwd=sock on the subprocess, curl resolves it correctly within the socket directory. The comment explains the Unix-socket-path-length motivation. Intentional.
  • The out = work / 'response.json' file is shared between the registration call and the decision call; since the calls are sequential and the first result is validated in memory before the second, there is no data loss.
  • sudo -n rm -rf str(sock) operates on work / 'sock', a path constructed by the harness itself; no injection risk.
  • The finally block uses check=False throughout, ensuring cleanup even on partial failure.

Golden files

  • judgment.json has "evaluation_time_ms": 0. Principle XIII promises byte-determinism for exact computation, and exact steps involve no backend I/O, so 0 ms is plausible by design. Local testing confirmed the golden matches. Not a defect I can confirm.
  • definition.json policy rule uses "params": []; judgment.json outcome carries "params": {}. The runtime converts an empty parameter list to an empty map for the outcome document. Local testing passed; the transformation is consistent with the schema contract. Not a defect.
  • The snapshot_id hash in judgment.json is a stable SHA-256 of the canonical empty-snapshot form; deterministic by principles IV and XIII.

Configuration (serve.json)
Socket mode 384 (0o600), owned by 65532, auth: filesystem. The host's curl runs under sudo, which satisfies the ownership check. --read-only --network none matches spec 060 §3.4.3. allow_unsigned signing mode and drop_counted sink policy are correct for a standalone image with no semantic backends and no evidence sink.

Spec text
The amendment to §3.4.3 and increment 6a are present and internally consistent. The rationale (standalone image has no semantic backends; remote-backend path is covered by spec 042) matches the implementation.

No concrete defects found.

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

Subject: 7b8c0b2...6077e13, diff digest d891e9addf123b68adb000daa4ea4efb5e0b61c44246ea6b9481649f311251fd, 1 call(s). An AI comment is not an approval.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

AI review (findings)

Review

tools/rustev-release/qualify/harness.py — cwd=sock after chown makes the call inaccessible

In image_serve, the sock directory is created with mode 0o700 and then immediately transferred to uid 65532:

sock.mkdir(mode=0o700)
...
self.run('sudo', '-n', 'chown', '65532:65532', sock)

After that chown, the GitHub Actions runner process (uid ~1001, not 65532, not root) can no longer enter sock. Yet the call closure uses that directory as the working directory for every curl invocation:

http = subprocess.run(argv, cwd=sock, env=self.env, capture_output=True, text=True, check=True)

subprocess.run with cwd calls os.chdir(sock) in the forked child before exec. That chdir runs as the runner uid and fails with EACCES — the sudo -n curl is never reached. The readiness poll (sudo -n test -S …) is fine because it goes through sudo, but cwd is a Python-level operation that happens before exec.

The intent (using a relative socket name to stay inside the ~100-byte sunpath limit) is sound, but the directory needs to remain traversable by the runner, e.g. mode 0o711 instead of 0o700.

tools/rustev-release/qualify/image/judgment.json — evaluation_time_ms: 0 is a measured field compared exactly

The golden includes:

"evaluation_time_ms": 0,

The harness compares the full judgment dict with !=. evaluation_time_ms records how long the serve took to evaluate the decision. For an exact computation it is likely sub-millisecond and may round to 0, but it is a wall-clock measurement, not an echo of the request's evaluation_time. On a loaded runner or slow machine this field may be 1 ms, causing a spurious qualification failure. If the field is deterministically 0 for exact plans (e.g. the serve always writes 0 for sub-millisecond exact steps), this is fine; but if it is a live measurement the golden comparison will be flaky.


{"head": "a34e75167863f1921a76099d6d33ff72d004b0df", "verdict": "findings", "findings": [{"path": "tools/rustev-release/qualify/harness.py", "line": null, "summary": "After `sudo chown 65532:65532 sock` with mode 0o700, the runner process cannot chdir into `sock`, so `subprocess.run(argv, cwd=sock, ...)` in the `call` closure will raise PermissionError before curl is ever executed."}, {"path": "tools/rustev-release/qualify/image/judgment.json", "line": 3, "summary": "`evaluation_time_ms: 0` is a measured wall-clock field compared exactly against the serve response; on a loaded runner it may be non-zero, causing a spurious qualification failure."}]}

Subject: 99f0a71...a34e751, diff digest 9a400eaf872de248aed795c067d968bdac04d278dfbab6c6e4471e60810e0245, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 3, 2026 23:27 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/060-image-manifest branch from 99f0a71 to 2a368e2 Compare November 4, 2026 00:31
@bartekus
bartekus force-pushed the impl/060-image-qualify branch from a34e751 to c2e8e35 Compare November 4, 2026 00:31
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (findings)

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

tools/rustev-release/qualify/harness.py — image_serve / call

The call closure passes the Unix socket path to curl as --unix-socket socket.name with cwd=sock. socket.name is the filename-only component of the Path (serve.sock), and cwd=sock is the full directory. sudo -n curl inherits the working directory through sudo, so curl resolves the socket against sock/. This is correct per the in-code comment.

tools/rustev-release/qualify/harness.py — image / golden comparison

expected = read(HERE / 'image/judgment.json')
expected['plan_id'] = plan_id
...
if decision.get('judgment') != expected:
    raise ValueError('the judgment differs from the golden')

The golden (qualify/image/judgment.json) contains "evaluation_time_ms": 0. This field records the service's measured wall-clock evaluation time for the decision. For a single field_presence step on an empty snapshot the measurement is almost always sub-millisecond and rounds to 0, but it is a real wall-clock measurement, not a deterministic computed value. Under a loaded CI runner the service may return 1, which would fail the strict equality and misreport the qualification as failed with no way to distinguish a genuine behavioral change from a timing artifact. The snapshot_id and plan_id are content-hash-derived and are stable; evaluation_time_ms is not.

tools/rustev-release/qualify/harness.py — execute exclusion path

The two-branch exclusion:

if not required and kind == 'image' and self.m.get('image'):
    status = {'excluded': {'reason': 'the image is qualified on linux/amd64 and linux/arm64 only ...'}}
elif not required:
    ...

is consistent with the Rust required_on logic and correct.

tools/rustev-release/src/qualification.rs

required, required_on, required_files, and evidence are all internally consistent. The test in tests/image.rs covers the qualifying platforms, the exclusion requirement on non-qualifying platforms, the missing-step error, and the unexpected-pass error.

specs/060-the-service-image-in-the-release/spec.md

The amendment is recorded with rationale and date. The increment notes are self-consistent with the code.

No other defects found. The compile-report structure in register.json is confirmed to work by the author's local test; the snapshot_id hash is deterministic (canonical compilation guarantee); the container cleanup logic is correct (docker run -d failure means no container to clean up).

{"head": "c2e8e35795a4e24d1bcd8550664b4990e891fe66", "verdict": "findings", "findings": [{"path": "tools/rustev-release/qualify/image/judgment.json", "line": 5, "summary": "The golden judgment contains `\"evaluation_time_ms\": 0`, a measured wall-clock value that is not deterministically zero; under a loaded CI runner the service may return 1, failing the strict equality comparison in harness.py and misreporting the qualification as failed."}]}

Subject: 2a368e2...c2e8e35, diff digest 9a400eaf872de248aed795c067d968bdac04d278dfbab6c6e4471e60810e0245, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 4, 2026 00:45 — with GitHub Actions Error
Base automatically changed from impl/060-image-manifest to main November 4, 2026 02:37
@bartekus
bartekus force-pushed the impl/060-image-qualify branch from c2e8e35 to ed2f085 Compare November 4, 2026 02:38
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (findings)

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

harness.py – image_serve / image methods: The logic for pulling by digest, verifying attestations, running check.sh, compiling the plan, and comparing the judgment looks structurally sound. Subprocess calls use list form throughout, so no shell-injection risk. The cwd=sock trick with socket.name is correct for staying within the Unix-socket path-length limit.

qualification.rs – required_on / required_files / evidence: The logic is consistent: required_on returns false for the image kind on non-qualifying platforms, required_files omits those entries, and evidence skips missing files for non-required entries while checking that any present-but-non-required file carries an excluded status. The test in tests/image.rs covers all three cases (qualifying passes, qualifying excluded, non-qualifying wrongly passed). No defect here.

judgment.json – evaluation_time_ms: 0: The golden file commits "evaluation_time_ms": 0 (line 3). The harness compares with strict equality (decision.get('judgment') != expected). evaluation_time_ms is a measurement of actual wall-clock evaluation time returned by the service, not a configuration value. Even for a sub-millisecond exact computation, CI runners and the overhead of container startup, Unix-socket round-trips, and JSON serialization make it very likely this field exceeds 0 ms in practice. If it does, the comparison raises "the judgment differs from the golden" and the image qualification step fails. The spec text says this was verified locally on an arm64 Docker Desktop setup (where the socket lived on a Docker volume rather than a bind mount), which is a substantially different execution path from GitHub's Linux runners.

No other concrete defects were found.

{"head": "ed2f08531380fd31300441f811d7df2f45876d92", "verdict": "findings", "findings": [{"path": "tools/rustev-release/qualify/image/judgment.json", "line": 3, "summary": "Golden file fixes evaluation_time_ms at 0, but the harness compares actual judgment with strict equality; the service returns real elapsed time, so any non-zero measurement in CI will cause the image qualification step to fail."}]}

Subject: adcaa4c...ed2f085, diff digest 9a400eaf872de248aed795c067d968bdac04d278dfbab6c6e4471e60810e0245, 1 call(s). An AI comment is not an approval.

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

bartekus commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Review note on ed2f085: the finding on qualify/image/judgment.json is a false positive. evaluation_time_ms is the judgment's evaluation timestamp (Timestamp in crates/rustev-contract/src/judgment.rs), copied from the request's evaluation_time, which qualify/image/decide.json fixes at 0. It is not a measured duration, so the service returns 0 deterministically and the strict comparison holds. No change.

@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
@bartekus
bartekus removed this pull request from the merge queue due to a manual request Nov 4, 2026
@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 4, 2026
@bartekus
bartekus force-pushed the impl/060-image-qualify branch from ed2f085 to e3cf225 Compare November 4, 2026 05:22
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (no-findings)

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

harness.py – image_serve / image methods

The call inner function uses cwd=sock with '--unix-socket', socket.name (relative path serve.sock). This avoids the ~100-byte Unix socket path limit. sudo preserves cwd by default on Linux runners, so the relative path resolves correctly. The design is intentional and consistent with the README.

The 60-second readiness poll uses the absolute str(socket) for the existence test and the relative socket.name for curl—consistently correct.

The register.json bundle construction passes plan_id (from the CLI's stdout) into compile_report and also uses definition = read(HERE / 'image/definition.json') independently of the copy in work/. Both originate from the same file, so the plan identity is consistent.

The finally block uses check=False for all docker cleanup commands, correctly tolerating a container that failed to start.

qualify/image/judgment.json

"evaluation_time_ms": 0 matches the request's "evaluation_time": 0 in decide.json. Given the naming convention and the deterministic exact-only computation, this is a passthrough of the client-supplied evaluation timestamp, not a wall-clock duration. The author's local run corroborates the golden.

"params": {} (object) in the golden while the definition rule uses "params": [] (array): these are different JSON types. The serve layer appears to normalize an empty array of key-value params to an empty object in the judgment output. The local testing confirms the golden is correct. No defect is evident from the diff alone.

qualification.rs

required_on correctly gates the image kind to IMAGE_PLATFORMS while leaving all other kinds unchanged. required_files and evidence both consistently use required_on instead of required, so non-qualifying platforms are excluded from the required file list and must present an Excluded record when the file is present.

tests/image.rs

a_named_image_is_qualified_on_amd64_and_arm64_linux_only exercises the full matrix: required files include the two Linux-gnu platforms, non-linux and musl platforms are absent from required_files, an excluded record on a qualifying platform fails, a missing step on a qualifying platform fails, and a passed record on a non-qualifying platform fails. Coverage is complete for the per-platform invariant.

Spec text

The amendment is recorded under "Decisions at approval" as an owner act dated 2026-11-03, consistent with the governance model (ratification and amendment are both owner acts). The amendment note is clear and self-consistent.

No concrete defect found.

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

Subject: c2389cd...e3cf225, diff digest 77b3d06bee48d1540878198ca3c9c10e3969e87ee0ae1bf25412f22668ab5069, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 4, 2026
@bartekus
bartekus force-pushed the impl/060-image-qualify branch from e3cf225 to 1566f52 Compare November 4, 2026 07:15
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the PR for spec 060 increment 6a: image qualification harness, golden fixtures, and qualification.rs platform-gating logic.

Finding 1 — harness.py image_serve: docker run placed before try:, leaving 65532-owned directory on failure

In image_serve, the sequence is:

self.run('sudo', '-n', 'chown', '65532:65532', sock)   # sock now root/65532-owned
...
self.run('docker', 'run', '-d', '--name', name, ...)    # outside the try:
try:
    ...
finally:
    ...
    subprocess.run(['sudo', '-n', 'rm', '-rf', str(sock)], ...)

If chown succeeds but docker run fails (name collision from a leaked prior container, image pull error, etc.), the finally block is never entered. The sock directory—now owned by 65532—is not cleaned up via sudo rm -rf. The qualifying user cannot remove it without elevated privileges, and the parent work tree becomes unremovable by normal cleanup. The fix is to move docker run inside the try: block (or prepend a docker rm -f name before the run to handle the name-collision case).

Finding 2 — judgment.json: evaluation_time_ms: 0 is part of the strict golden equality check

harness.py compares the full judgment document with the golden:

expected = read(HERE / 'image/judgment.json')
expected['plan_id'] = plan_id
if decision.get('judgment') != expected:
    raise ValueError('the judgment differs from the golden')

judgment.json contains "evaluation_time_ms": 0. If this field reflects actual wall-clock elapsed time (truncated to milliseconds), any CI runner that takes ≥ 1 ms for even this single exact field-presence step will cause qualification to fail. The description confirms 0 was returned locally, but that does not guarantee it on all amd64/arm64 runners. The golden should either exclude this field from comparison or use a tolerance check.

{"head": "1566f5283dc83e8880d28aad7949455ef63ef46e", "verdict": "findings", "findings": [{"path": "tools/rustev-release/qualify/harness.py", "line": null, "summary": "In image_serve, docker run is called before the try: block; if it fails after sudo chown 65532:65532 sock, the finally cleanup (sudo rm -rf sock) is skipped, leaving a root/65532-owned directory the qualifying user cannot remove."}, {"path": "tools/rustev-release/qualify/image/judgment.json", "line": 4, "summary": "evaluation_time_ms: 0 is included in a strict full-document equality check against the actual decision; any CI runner returning ≥ 1 ms for the exact computation will fail release qualification."}]}

Subject: b4b19e8...1566f52, diff digest 611c7f9562fa241195ca7a470dd424cb8fa6469def077c1ff565a20361719b54, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 4, 2026 07:20 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/060-image-qualify branch from 1566f52 to 6bb7af2 Compare November 4, 2026 07:22
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (findings)

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

Spec (specs/060-the-service-image-in-the-release/spec.md)

The amendment is internally consistent: it describes the change from lodging reference plan to exact-only synthetic plan, records the owner's rationale, and the "Decisions at approval" owner-amendment block matches the timestamp and content of the increment note. No inconsistency found.

Rust qualification logic (tools/rustev-release/src/qualification.rs)

required_on correctly short-circuits: required(m, kind) && (kind != "image" || ...). When m.image.is_none(), required returns false and the image step is excluded via the standard path. The refactored call site in evidence now binds required = required_on(m, kind, platform) and uses it throughout. The required_files filter is also updated. Logic is consistent.

Test (tools/rustev-release/tests/image.rs)

Covers the three negative cases (excluded on qualifying platform, missing on qualifying platform, passed on non-qualifying platform) and the positive case. The excluded-reason string in the fixture ("...only") differs from what the harness writes ("...only (060 3.4.3)"), but evidence only checks non-emptiness, so this is not a bug.

Harness (tools/rustev-release/qualify/harness.py) — concrete bug

Inside image_serve, after:

sock.mkdir(mode=0o700)
...
self.run('sudo', '-n', 'chown', '65532:65532', sock)

the directory sock is mode 0700 owned by UID 65532. Any subsequent access as the CI runner (non-root, non-65532) requires entering that directory. The socket-existence check correctly avoids this:

subprocess.run(['sudo', '-n', 'test', '-S', str(socket)], ...)

uses the full path under sudo (root bypasses permission checks). But the call closure then passes cwd=sock to subprocess.run:

http = subprocess.run(argv, cwd=sock, env=self.env, capture_output=True, text=True, check=True)

Python's subprocess performs chdir(sock) in the forked child before exec-ing sudo. At that point the child still runs as the runner user, which has no x permission on the mode-700 directory owned by 65532. The chdir call returns EACCES and the subprocess raises PermissionError before sudo is ever executed. The socket-check loop already demonstrates the correct pattern (full absolute path under sudo with no cwd); the same approach is not applied to the curl invocation.

The local test on Docker Desktop succeeded because that environment runs the Docker daemon (and potentially the harness) in a Linux VM where the effective UID may differ from a standard GitHub Actions runner.

{"head": "6bb7af2d8c9f23737513c6b9f27002471bd7d284", "verdict": "findings", "findings": [{"path": "tools/rustev-release/qualify/harness.py", "line": null, "summary": "In image_serve, subprocess.run(argv, cwd=sock, ...) chdir-s into the sock directory as the runner user before exec-ing sudo, but sock is mode 0700 owned by 65532 so the chdir fails with EACCES on a standard non-root CI runner; the socket-existence check already shows the correct pattern (full path, no cwd)."}]}

Subject: b4b19e8...6bb7af2, diff digest 56fce2616b4353c0e8f2ad3c09981abe7e0c815f7cd215a1730db4fd694a5a90, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception November 4, 2026 07:37 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/060-image-qualify branch from 6bb7af2 to 846a912 Compare November 4, 2026 07:38
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (findings)

Reviewing the diff for spec 060, increment 6a: image qualification with an exact-only synthetic plan.

Structural / correctness checks

qualification.rs — required_on and evidence are consistent: a named image is required on the two Linux platforms; elsewhere it must be excluded with a reason. required_files now filters by required_on(m, kind, platform). The test in tests/image.rs covers all four cases (pass, wrongly-excluded on qualifying platform, missing on qualifying platform, wrongly-passed on non-qualifying platform). No issue found.

harness.py — socket path length is handled correctly by the cd "$1" && … --unix-socket <name> trick. docker run is inside the try block so the finally cleanup runs even on a failed start. The wait loop, attestation verification, CLI-derived plan_id, and decision comparison are logically consistent with the spec text.

Concrete inconsistency between definition.json and judgment.json

qualify/image/definition.json (line 1) encodes the propose rule as:

"then": {"propose": {"action": "review", "params": []}}

params is an array ([]).

qualify/image/judgment.json (line 11–12) expects:

"outcome": {"propose": {"action": "review", "params": {}}}

params is an object ({}).

These are different JSON types. [] != {} in Python, so decision.get('judgment') != expected will raise ValueError unless the runtime normalises an empty array to an empty object for this field. The test passed locally (the spec notes it), so the runtime does perform that normalisation today; but the definition file is internally inconsistent with the golden it must produce, and a schema-strict version of the compiler or a future tightening of the definition validation would break the fixture silently.

The correct form for an empty parameter map is {} throughout. The definition should use "params": {} to match the judgment golden and the documented type for proposal parameters.

{"head": "846a91228db5193d86f9993f630b2930d9516416", "verdict": "findings", "findings": [{"path": "tools/rustev-release/qualify/image/definition.json", "line": 1, "summary": "The propose rule uses `\"params\": []` (array) while the judgment golden expects `\"params\": {}` (object); the types differ and the golden comparison passes only because the runtime happens to normalise empty arrays to empty objects."}]}

Subject: b4b19e8...846a912, diff digest 7835538c53fb52915cd8b018c7b3572ea32c6305f1e0cecde6ed4f8e6a4504b3, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus temporarily deployed to statecraft-review-exception November 4, 2026 07:49 — with GitHub Actions Inactive
@bartekus

bartekus commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Review note on 846a912: the params finding is a false positive. In a decision definition, a propose rule's params is an array of {name, value} bindings (see any tools/rustev-conformance/fixtures definition); a judgment's outcome.propose.params is the object those bindings evaluate to. An empty binding list evaluates to {} by contract, not by accident. No change.

@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 4, 2026
…ly synthetic plan (060 3.4.3, amended; harness)
@bartekus
bartekus force-pushed the impl/060-image-qualify branch from 846a912 to 0e84a5d Compare November 4, 2026 09:23
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI review (findings)

Review

tools/rustev-release/qualify/harness.py

The image_serve logic is sound: socket directory is 0700 owned by 65532; sudo -n lets root bypass DAC to connect; the cd "$1" && shift && exec "$@" trick avoids the ~100-byte Unix-socket-path limit by making curl use the relative filename serve.sock; check=True on the curl invocation catches transport failures; the finally block stops and removes the container unconditionally. The required_on split between "image in manifest but wrong platform → exclude with platform reason" and "no image in manifest → exclude with 'names no container image'" is correct across all four cases.

tools/rustev-release/src/qualification.rs

required_on correctly short-circuits: for non-image kinds it delegates to required; for image it also gates on IMAGE_PLATFORMS. Switching required_files and evidence to use required_on instead of required is consistent, and the test in tests/image.rs covers the three failure modes (excluded on a qualifying platform, missing on a qualifying platform, passed on a non-qualifying platform).

specs/060-the-service-image-in-the-release/spec.md

The amendment text and the increment 6a prose are internally consistent. The amendment is recorded both inline (3.4.3) and under "Decisions at approval." No governance lifecycle fields are changed; implementation and status remain as-set at ratification.

tools/rustev-release/qualify/image/judgment.json — potential defect

"evaluation_time_ms": 0 (line 5) is compared with strict dict equality in harness.py:

if decision.get('judgment') != expected:
    raise ValueError('the judgment differs from the golden')

evaluation_time_ms is a wall-clock measurement made by the serve runtime, independent of the request's evaluation_time field (a logical evidence-freshness timestamp, not a duration). If the runtime records even 1 ms of elapsed time — plausible under Docker overhead on CI — the image qualification step will consistently fail for every release that includes an image. The local verification the author describes proves it reached zero on their machine; it does not prove the golden is stable across runners.

No other concrete defects found.

{"head": "0e84a5d69ce460c63c771f439a09cb98c1944750", "verdict": "findings", "findings": [{"path": "tools/rustev-release/qualify/image/judgment.json", "line": 5, "summary": "\"evaluation_time_ms\": 0 is compared with strict equality in harness.py; if the serve runtime records any non-zero wall-clock milliseconds for the evaluation (plausible under Docker overhead on CI), the image qualification step will consistently fail for every release that includes an image."}]}

Subject: 294c40d...0e84a5d, diff digest 20cb4719cab5319f40ed8914ebc36aaa6e1f0e132bcd0baaf999488cc092d660, 1 call(s). An AI comment is not an approval.

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

bartekus commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Review note on 0e84a5d: repeat of the false positive noted on ed2f085. evaluation_time_ms is the evaluation timestamp the request supplies (evaluation_time: 0 in qualify/image/decide.json, type Timestamp in crates/rustev-contract/src/judgment.rs), not a measured duration, so it is 0 on every host. No change.

@bartekus
bartekus added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 185713b Nov 4, 2026
38 checks passed
@bartekus
bartekus deleted the impl/060-image-qualify branch November 4, 2026 10:47
bartekus added a commit that referenced this pull request Nov 5, 2026
…0 3.1) [held for owner decision] (#499)

Spec 060 increment 5 (3.1): membership. DRAFT, DO NOT MERGE until the
owner decides 060 decision 2 and the other prerequisites below hold.

- `tools/rustev-release/release-set.json` names the image under `image`
(`ghcr.io/statecrafting/rustev-serve`, `linux/amd64`, `linux/arm64`) and
drops its `absent` entry. This is the switch that makes the next release
name the image in its manifest, gate its scan through
`image-exceptions.json`, push and attest it (`publish-image`), verify it
and qualify it.
- Tests that are not about the image (`tests/family.rs`,
`tests/tagged.rs` fixtures) set `image` to none; `tests/npm.rs` and
`tests/image.rs` no longer read an image absence from the committed set.

Prerequisites before merging:
1. The base move to `gcr.io/distroless/cc-debian13:nonroot` (#502),
decided by the owner on 2026-11-03.
2. The owner's ruling on each of the 44 findings on that base (one
decision row and one `image-exceptions.json` entry per (id, package), at
most 90 days). With the image a member, any uncovered finding fails
`image-checks`.
3. The image qualification of 060 3.4.3 as amended (#500 harness, #501
workflow).
4. Spec 042 is complete (#477), so 3.1.1's condition holds. The owner
makes the ghcr package public after the first push.

Stacked on #498 (on #496, #494).

Checks: `cargo test -p rustev-release --locked` passed (all binaries);
`make gate` passed.

This branch was previously deployed

1 inactive deployment
statecraft-review-exception — 0e84a5d6 Deployed Nov 4, 2026 by bartekus via review-exception #3318
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

statecraft:stacked-ci Run the full CI matrix on a stacked pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant