Skip to content

fix(ci): baseline artifact freshness on the artifact writeback - #231

Merged
auto-wood merged 1 commit into
mainfrom
fix/artifact-freshness-baseline
Nov 26, 2026
Merged

auto-wood merged 1 commit into
mainfrom
fix/artifact-freshness-baseline

Conversation

@auto-wood

@auto-wood auto-wood commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The nightly Artifact freshness gate compared each provenance revision with git log -1 over 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
    • Swift bases: .xcframework.sourceRevision and .recipeRevision.
    • C++ bases: every nativeArtifacts[rid].sourceRevision / .recipeRevision, so one refreshed platform does not clear another platform's staleness.
    • Per-lane input sets: C++ includes crates/spoke-connect-capi, Swift selects spoke-connect only; recipes stay lane-specific.
    • 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). Missing sidecar, malformed sidecar, missing/malformed/unresolvable revision, or a revision outside HEAD history → lane invalid (never green).
    • Result: {lanes:[{lane,status:"fresh"|"stale"|"invalid",stale:[{base,label,commit}],errors}]}. The label names the provenance record (for example nativeArtifacts.osx-arm64 sourceRevision) so multi-rid staleness stays attributable.
    • CLI exit 0 all fresh, 1 stale or invalid, 2 cannot run (prints {"error":…}).
  • tooling/release/check-artifact-freshness.test.mjs — 12 node:test cases 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 — pins actions/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, distinguishing stale from invalid. 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 in test:release.

Verification

node --test tooling/release/check-artifact-freshness.test.mjs
# 12 tests, 12 pass

node tooling/release/check-artifact-freshness.mjs --repo .
# swift stale: base 69094fc8b81291293a04c58eea09e690a3de1398
#              (xcframework sourceRevision) commit eb85069c0c4750b44196cd7b048f2232845212cb
# cpp   stale: base 69094fc8b81291293a04c58eea09e690a3de1398
#              (nativeArtifacts.osx-arm64 sourceRevision) commit eb85069c…
#              (nativeArtifacts.win-x64 sourceRevision)   commit eb85069c…
# exit 1 — the recorded source revisions predate real build-input changes.

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

  • The recorded recipeRevision for both lanes resolves to 3f0840a9… (Swift) / ac508b0e… (C++) and is fresh in this checkout; no action needed.

@auto-wood
auto-wood force-pushed the fix/artifact-freshness-baseline branch from 877d58d to 9f99c1a Compare November 26, 2026 03:55
@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Confidence Score: 3/5 · Fix the C++ and Swift baseline choices before merging; both can report old artifacts as fresh.RetriggerView in GreptileConfidence Score: 3/5

[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

  1. P1 One refresh hides stale platforms ▶
  2. P1 Older Swift builds appear fresh ▶
  3. P2 C++ changes wrongly flag Swift ▶
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.

Summary

Replaces the inline nightly comparisons with a shared checker that looks for build-input changes after an artifact baseline.

  • The freshness gate now checks build inputs since each artifact writeback.

Reviews (1) · Last reviewed commit: "fix(ci): baseline artifact freshness on ..." · Reviewed by Greptile

@auto-wood
auto-wood force-pushed the fix/artifact-freshness-baseline branch from 9f99c1a to c6b4690 Compare November 26, 2026 04:01
@m-inspector

m-inspector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Verdict: ship it · Score 100% (mergeable)

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 &lt;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

@m-inspector m-inspector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mstar-inspector line comments · round 1 · 877d58d

Comment thread .github/workflows/ci-freshness.yml Resolved
@auto-wood
auto-wood force-pushed the fix/artifact-freshness-baseline branch 3 times, most recently from 67fe3af to 13b647e Compare November 26, 2026 04:08

@m-inspector m-inspector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mstar-inspector line comments · round 2 · 2b7f455

Comment thread .github/workflows/ci-freshness.yml Resolved
@auto-wood
auto-wood force-pushed the fix/artifact-freshness-baseline branch from 13b647e to e96c69a Compare November 26, 2026 04:20

@m-inspector m-inspector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mstar-inspector line comments · round 3 · 13b647e

Comment thread .github/workflows/ci-freshness.yml Resolved
Comment thread .github/workflows/ci-freshness.yml Resolved
Comment thread .github/workflows/ci-freshness.yml Resolved
Comment thread .github/workflows/ci-freshness.yml Resolved
@auto-wood
auto-wood force-pushed the fix/artifact-freshness-baseline branch from e96c69a to f9b0f0a Compare November 26, 2026 04:23

@m-inspector m-inspector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mstar-inspector line comments · round 4 · f9b0f0a

Comment thread .github/workflows/ci-freshness.yml Resolved
…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.
@auto-wood
auto-wood force-pushed the fix/artifact-freshness-baseline branch from f9b0f0a to 4a940c7 Compare November 26, 2026 04:44
@auto-wood
auto-wood merged commit f4fdf93 into main Nov 26, 2026
34 checks passed
@auto-wood
auto-wood deleted the fix/artifact-freshness-baseline branch November 26, 2026 05:25
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.

2 participants