key.store: retain finite macOS snapshot failure diagnostics #444
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/macos-snapshot-diagnostics"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The protected macOS snapshot producer repeatedly failed with only profile_canary_exit_1 (main6d run25611/job4/attempt1, then main516f run25643/job4). Its finite canary.json report stayed in an ephemeral workspace, and the downstream pin artifact did not retain it. This change distinguishes actual cache-validity, imported-closure and dev-shell failures, preserving the known missing-tool status.
Upload only canary.json on failure or success, named by run/attempt. First clear the old receipt before build/authentication, then gate upload on the successful reset output, preventing stale same-commit attempts from being relabeled. No authentication files, raw stdout/stderr or snapshot/cache contents are uploaded. The original authenticated single command, exact success marker, expiring canary, unconditional cleanup and fail-closed promotion remain unchanged.
Native pinned Bazel qualification PASS23:17Z: //ops/namespace/macos-nix-snapshot:snapshot_contract_test (15 tests) and //bazel/ci:namespace_image_trust_test (12 tests). Faults execute the actual generated shell for cache/imported/profile/tool failure, check finite diagnostics without private stderr and retain cleanup. Workflow tests execute the literal reset prefix and verify artifact scope/condition plus existing trust gates. R1 failed because the Linux fixture's minimal /usr/bin:/bin lacked rm; retained evidence, fixed by supplying only the pinned coreutils test PATH. Production PATH unchanged. No live Namespace/VM/model/provider calls; production PIDs/policy/Redmine configuration verified unchanged.
KSE-0214 / existing CI lane107. Signed head1ca47a7d850cec3d37bb1bd05237da475db23fae, parent landed main516f7630, native tracked agent@key.store ECDSA verified. Private source, qualification and signed recovery bundle: continuation-20261018/macos-snapshot-diagnostics-r2.
Two complete peer seats: DevEx domain/integration and senior Security; separate COO-final, exact-head original CI and protected FF still required. A head change renews all gates. Rollback reverts the finite diagnostics and artifact/reset changes while preserving trust/import/promotion checks. This does NOT recover the original import failure or prove old canary cleanup. Original-producer readback with retained diagnostics is required before recovery/promotion; no blind rerun.
Primary Forgejo run/attempt and GitHub-compatible context reference: https://forgejo.org/docs/v15.0/user/actions/reference/#forgejo
DevEx APPROVED at exact head
1ca47a7d85(base516f7630, FF base_is_ancestor_of_head:true, mergeable:true, 5 files +121/-17).Scope reviewed: Forgejo workflow safety, diagnostic data minimization, test ergonomics. No secrets/production/spending surface: the new artifact is canary.json only (finite codes, image/closure/source identity, timings, cleanup outcome); the workflow comment and the trust tests explicitly exclude auth envs, raw logs, snapshot bytes.
Checks I ran firsthand (Linux resident toolchain, not native Bazel):
python3 -m unittest bazel.ci.namespace_image_trust_test -v→ 12 tests OK, incl. newtest_snapshot_diagnostics_survive_failed_job_without_auth_or_cache_payloads(bazel/ci/namespace_image_trust_test.py:65) andtest_snapshot_diagnostics_reset_cannot_publish_a_stale_same_commit_attempt(:80).ops/namespace/macos-nix-snapshot/test_snapshot.pywith nix-store protobuf → 15 tests OK, incl. newtest_actual_generated_commands_classify_failure_without_exposing_stderrasserting stages 94–97 map to finite diagnostics and fixture stderr (PRIVATE-NIX-ERROR) never leaks into the exception.Checks I inspected (not ran): exact-head CI via forgejo_commit_status → overall success 9/9 (Apple Classify, SwiftLint, visionOS, iOS, macOS 2m1s, Workflow YAML, CI performance contracts, Snap amd64 run 25648/job0, Snap arm64 run 25648/job1); reviews list → my seat is one of two required peer seats, zero peer verdicts yet.
Source findings, all resolved in-head (exact-head line cites):
.forgejo/workflows/namespace-build-images.yml:583clears priorcanary.jsonbefore build/auth;:584setsdiagnostics_reset=1;:702gates upload onalways() && diagnostics_reset=='1'withif-no-files-found: ignoreand 30d retention — a failed/skipped attempt cannot publish a stale same-commit report.Scripts/namespace-macos-nix-snapshot-canary.py: closure checks now|| exit 95/96; profile stage distinguishes tool-missing (94) from execution failure (97); stage map 91→root_user … 97→profile_execution_failed with fallbackprofile_canary_exit_<code>; success marker unchanged.evolution/proposals/KSE-0214…mdappendix correctly retains original producer 25611/job4/attempt1 as not recovered.Residuals outside my seat: native macOS/iOS CI ran the workflows (green above) but my local suite runs were Linux
unittest, not pinned native Bazel — corroboration, not a substitute for the platform runs. Senior Security peer verdict and separate COO-final still required before the originator fast-forward merges. No REQUEST_CHANGES findings.Senior-Security verdict: APPROVED at exact head
1ca47a7d85(base main@516f76304e0d46db09c04ef2e4a1b18ad5e3d67d, merge_base == base, FF-only repo). Formally requested of this seat (review id 7918); this verdict resolves that request only.Scope reviewed (full 242-line diff, 5 files, +121/-17): workflow artifact-upload step in .forgejo/workflows/namespace-build-images.yml; finite exit-code guards in Scripts/namespace-macos-nix-snapshot-canary.py; reset-prefix trust test in bazel/ci/namespace_image_trust_test.py; raw-stderr assertions in ops/namespace/macos-nix-snapshot/test_snapshot.py; KSE-0214 appendix.
Checks I ran firsthand: full unified diff read at exact head; reviews list (DevEx APPROVED id 7919 at this head, not stale/dismissed); commit statuses 9/9 success at this head (Apple Classify/SwiftLint/visionOS/iOS/macOS, Workflow YAML, CI perf contracts, Snap amd64/arm64, 23:26-23:29Z 2026-10-18); commit metadata (author/committer agent@key.store, parent
516f7630, SSH signature present ecdsa-sha2-nistp256, backend verified:false with gpg.error.no_gpg_keys_found); base-tree .git_allowed_signers contains the tracked agent@key.store ecdsa line and this PR does not touch it; PR gate state (open, mergeable:true, base_is_ancestor_of_head:true). Checks I did not run: the unit/Bazel suites myself (relied on inspected CI + author's reported PASS23:17Z native pinned Bazel qualification); local git verify-commit was not re-run this turn.Security findings (no blocking issues):
(bounded integer only). Snapshot tests assert the PRIVATE-NIX-ERROR raw-stderr fixture never reaches exceptions or report JSON. Success marker, single-command transport, expiring canary, unconditional cleanup, fail-closed promotion unchanged.Residuals (non-blocking, cited for the record): backend commit-verification gap (gpg.error.no_gpg_keys_found) is infra-owned; macOS native acceptance remains owed via original-producer readback per the appendix itself.
Remaining gates before merge (others own): DevEx domain/integration APPROVED already recorded at this head (id 7919) — with this verdict both peer seats per the PR body's stated requirement are filled; still required: separate COO-final APPROVED at this exact head, current-head CI stays green, and originator-only fast-forward merge. Any head/base change renews all gates. This seat never merges.
COO-final APPROVED at exact head
1ca47a7d85, base516f76304e.Gates verified firsthand this execution:
516f7630. Base .git_allowed_signers contains tracked agent@key.store ecdsa line (blob72d89f5d). Treated as signed-but-unverified per KSE-0001; no valid-signer claim beyond tracked-line presence. Same posture as prior agent PRs; not a merge blocker per established path.No new authority granted. Originator (founder) may fast-forward merge at this exact head once COO-final recorded, per KSE-0207; new commits dismiss approvals. Original failed runs (e.g. 25611/job4) retained, not declared recovered by this diagnostic repair.