Repository navigation
fix(ci): baseline artifact freshness on the artifact writeback - #231
Conversation
877d58d to
9f99c1a
Compare
[Medium impact] The change affects the scheduled and manual checks for two committed native artifact lanes. Fix the C++ and Swift baseline choices before merging; both can report old artifacts as fresh. Findings
Fix with agent prompt### Issue 1
tooling/release/check-artifact-freshness.mjs:153-156
The C++ baseline advances when either platform is refreshed. `cpp-build.mjs` updates only the selected target and keeps the other target's entry. After a source change, refreshing macOS alone moves this baseline past that change and reports the whole lane fresh, even though Windows still ships the old code. Check each target against its own build baseline rather than the last change anywhere under `native`.
### Issue 2
tooling/release/check-artifact-freshness.mjs:74-75
`appliedAtHead` records the checkout where an artifact was applied, not where it was built. The supported `--allow-sha` path can apply an older build after source changes and records that newer checkout in `appliedAtHead`. Starting the check there skips those source changes and reports the old framework fresh. Use the recorded build revision, or check the gap between the build and apply revisions before accepting this baseline.
### Issue 3
tooling/release/check-artifact-freshness.mjs:45-46
The shared `BUILD_INPUTS` list adds `spoke-connect-capi` to the Swift check, but the Swift build selects `spoke-connect` and does not build the C++ carrier. A change confined to the C ABI implementation now marks an unchanged Swift framework stale. Move the carrier paths into the C++ lane's inputs to avoid unnecessary Swift refreshes.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryReplaces the inline nightly comparisons with a shared checker that looks for build-input changes after an artifact baseline.
Reviews (1) · Last reviewed commit: "fix(ci): baseline artifact freshness on ..." · Reviewed by Greptile |
9f99c1a to
c6b4690
Compare
✅ Verdict:
|
| Findings | Count |
|---|---|
| 🔴 must-fix | 0 |
| 🟠 should-fix | 0 |
| 🟡 may-fix | 0 |
| 🔵 nit | 0 |
📋 Review
What this PR does: Rewrites the nightly Artifact freshness gate so each lane is compared against the build-input revisions recorded in provenance — Swift .xcframework.sourceRevision/.recipeRevision and per-rid C++ nativeArtifacts[rid].sourceRevision/.recipeRevision — rather than against the current HEAD's git log -1 over a shared path set. Every recorded revision must be a full 40/64-hex commit that resolves via git cat-file -e <sha>^{commit} and is an ancestor of HEAD (git merge-base --is-ancestor); anything else makes the lane invalid, never green. The workflow pins Node 24, keeps the exit-2 cause legible, and reports base, record label, and commit per stale entry, with a 12-case node:test suite covering the fresh/stale/invalid matrix.
Findings
none
Revalidated findings
Reassessed 7/12 prior finding(s) this round · 1 invalid-output · 4 omitted · 0 over cap · 12 recheckable · context coverage: truncated
| finding | disposition | evidence | thread |
|---|---|---|---|
| One shared BUILD_INPUTS set both over-includes and under-includes sources per lane | unverifiable (invalid-output) | - | - |
| Exit-2 failure cause is discarded before the generic "failed to run" alert | addressed (verified-fix) | current-code | - |
Nightly freshness job runs node on the runner's ambient runtime instead of the repo-pinned Node 24 |
addressed (verified-fix) | current-code | - |
| [DX-03] Failed freshness run discards the checker's exit-2 error message | addressed (verified-fix) | current-code | - |
| Workflow header documents the Swift baseline in the reverse order of the checker | addressed (verified-fix) | current-code | - |
| Review coverage declaration (not a defect — no action) | unverifiable (no-evidence) | - | - |
| Pinned Swift baseline never falls back to headSha: an unresolvable-check failure silently substitutes a post-build base and masks stale artifacts | addressed (verified-fix) | current-code | - |
| Freshness check derives the stale range from a baseline it never proves is an ancestor of HEAD | addressed (verified-fix) | current-code | - |
| Stale report drops per-entry attribution, so a multi-rid lane emits indistinguishable duplicate alerts | addressed (verified-fix) | current-code | - |
| [DX-01] Pin the Node runtime in the freshness workflow before running node tooling | unverifiable (budget) | - | - |
| Nightly freshness run stays green when a committed sidecar is missing or malformed | unverifiable (budget) | - | - |
| [DOCS-02] Freshness workflow header states the Swift base precedence backwards | unverifiable (budget) | - | - |
Linked-issue AC
none — the PR links no issue; the description carries no external acceptance criteria to score.
✅ Verified
- All seven prior findings revalidated as addressed (verified-fix): exit-2 cause preserved before the generic alert, Node 24 pin in the nightly job, DX-03 error propagation, workflow header baseline ordering, removal of the headSha fallback, ancestry proof for the derived stale range, and per-entry attribution for multi-rid staleness.
- Freshness gate now keys on provenance build-input revisions per lane (C++ includes crates/spoke-connect-capi; Swift selects spoke-connect), with recipe revisions kept lane-specific.
- Invalid-state policy is explicit in the diff: missing/malformed sidecar, missing/malformed/unresolvable revision, or a revision outside HEAD history all yield invalid and exit 1.
- Review tally is clean at 100% (mergeable): must-fix 0, should-fix 0, may-fix 0, nit 0, findings empty.
- ❓ PR-body claim that node --test tooling/release/check-artifact-freshness.test.mjs passes 12/12 is not reproduced in the review document.
- ❓ PR-body claim that check-artifact-freshness.mjs --repo . exits 1 with stale Swift and both C++ rids is not reproduced in the review document.
- ❓ PR-body residual note that both lanes' recipeRevision values are fresh in this checkout is unverified here.
🗑️ Considered & rejected
- Concern that a docs/test-only commit should clear staleness: rejected — staleness must track recorded build inputs, not commit proximity, which was the original false-red defect.
- Concern that one refreshed C++ rid should clear another platform's staleness: rejected — per-rid bases are required precisely so independent refreshes stay isolated.
- Concern that an unresolvable revision should fall back to headSha: rejected — the prior finding established that substitution masks stale artifacts; failing closed is the intended behavior.
- Concern that an invalid lane could be reported as a soft pass: rejected — the never-green rule (exit 1) is correct, and the workflow now distinguishes stale from invalid in annotations and the summary.
- Concern that multi-rid staleness could stay unattributed: rejected — every stale entry now carries a provenance record label alongside base and commit.
- Concern that the gate should stay green between refreshes: rejected — the daily run is expected to remain red until a refresh rewrites the recorded revisions; that is the signal, not a regression.
🛠️ Plan to fix
Expand fix plan
none — no findings remain; the review verdict is ship it at 100% (mergeable), with all prior findings revalidated as verified-fix.Review 5 · commit 4a940c7
67fe3af to
13b647e
Compare
13b647e to
e96c69a
Compare
e96c69a to
f9b0f0a
Compare
…ions - Compare the recorded build-input revisions to HEAD: Swift `.xcframework.sourceRevision`/`.recipeRevision`; each C++ rid's own `sourceRevision`/`recipeRevision`, so a refreshed platform never clears another platform's staleness. - Split per-lane input sets: Swift excludes the capi crate, C++ includes it; recipes stay lane-specific. - Require every recorded revision to be a full resolvable commit that is an ancestor of HEAD; missing/malformed/unresolvable/non-ancestor records make the lane `invalid` instead of green. - Stale entries carry the provenance record label so multi-rid C++ staleness stays attributable. - CLI exits 0 all fresh, 1 stale or invalid, 2 when the check cannot run; the workflow surfaces the checker's error detail on exit 2. - Workflow pins Node 24, distinguishes stale vs invalid in annotations and summary, and rewrites the suite over throwaway git repos.
f9b0f0a to
4a940c7
Compare
Summary
The nightly
Artifact freshnessgate compared each provenance revision withgit log -1over the same path set at the then-current HEAD, so every later unrelated commit turned the lane red. This PR rewrites the check around the build-input revisions recorded in provenance.tooling/release/check-artifact-freshness.mjs.xcframework.sourceRevisionand.recipeRevision.nativeArtifacts[rid].sourceRevision/.recipeRevision, so one refreshed platform does not clear another platform's staleness.crates/spoke-connect-capi, Swift selectsspoke-connectonly; recipes stay lane-specific.git cat-file -e <sha>^{commit}and is an ancestor of HEAD (git merge-base --is-ancestor). Missing sidecar, malformed sidecar, missing/malformed/unresolvable revision, or a revision outside HEAD history → laneinvalid(never green).{lanes:[{lane,status:"fresh"|"stale"|"invalid",stale:[{base,label,commit}],errors}]}. Thelabelnames the provenance record (for examplenativeArtifacts.osx-arm64 sourceRevision) so multi-rid staleness stays attributable.{"error":…}).tooling/release/check-artifact-freshness.test.mjs— 12node:testcases over throwaway git repos with fixed identity/date: docs and test-only commits fresh; compiled-source change stale (asserts the record label); one refreshed C++ rid leaves the other stale; two stale rids keep distinct labels; capi-only change is stale for C++ and fresh for Swift; missing sidecar,[]/{}sidecar,sourceRevision: "HEAD", an unresolvable revision, and a sibling-branch revision outside HEAD history are invalid; CLI exit 2 when the check cannot run..github/workflows/ci-freshness.yml— pinsactions/setup-node(Node 24) and calls the checker for both lanes. Exit 1 produces::error::lines plus summary entries showing base, record label and commit, distinguishingstalefrominvalid. Exit 2 reads the report and surfaces.error(or a bounded raw prefix) in the annotation and summary, then fails. Exit 0 passes.contents: read, schedule and permissions unchanged.package.json— registers the new suite intest:release.Verification
The daily run stays red until a refresh rewrites the recorded revisions; docs/test-only commits and per-platform refreshes no longer do that.
Residual
recipeRevisionfor both lanes resolves to3f0840a9…(Swift) /ac508b0e…(C++) and is fresh in this checkout; no action needed.