ci: report cache restore route, state and duration

Merged
TE
2mo ago
+284-0

The cache-restore composite exposes only an exact-hit flag, which cannot explain whether a restore used a prefix, failed, or selected a different action route on another runner. Add one structured CMUX_CACHE_RESTORE receipt and job-summary entry per restore, including requested backend, selected action route, runner, key/matched key, outcome and elapsed time.

Keep the existing cache-hit output, selection conditions and backend default unchanged. Exact and prefix restores use the pinned actions' outputs. Failed/cancelled steps remain distinct; a successful action without a matched key reports miss_or_unavailable, since suppressed backend errors cannot be distinguished from a miss. Missing/ambiguous evidence remains unknown. Both measurement steps are non-blocking, and reporting does not hide a failed restore. No URLs, credentials or cache paths are recorded.

This complements #13268's optional artifact broker without changing its transport steps, #13260's checkout optimization, or the app-host payload/retention work. It changes no provider credentials, settings, restore order or cache writes.

Provider evidence matters for interpreting receipts: Blacksmith documents transparent cache interception on its Linux VM architecture and explicitly distinguishes ordinary artifact traffic; that is not proof of macOS interception. Warp's cache action supports exact/prefix semantics, while its artifact guide uses GitHub artifact actions. Therefore github-cache means the selected action route, not a verified physical store. R2 custom-domain caching is a separate deployment choice; this patch does not enable it.

Validation: five focused Python tests and the existing read-only cache guard pass, including 18 provider/outcome cases and execution of the actual composite clock/report shell with output-boundary fixtures. The composite-wiring test fails against the previous action and passes after the change. It checks default/output preservation, arbitrary key quoting, duration and summary emission; no provider network calls or native build were run. Mutation regressions confirm that altered measurement commands and overlapping cache routes still fail the exhaustive read-only guard. A path-filtered Linux workflow runs this contract. git diff --check passes.

No latency or dollar saving is claimed: the improvement is trustworthy cache-state evidence for future cohorts. Duration covers lookup, transfer and extraction, and hard runner termination may prevent a final receipt.

Summary by CodeRabbit

  • New Features

    • Cache restoration now produces an evidence receipt with the selected route, result, cache keys, hit status, and elapsed time.
    • Receipt details are added to the workflow summary when available.
  • Bug Fixes

    • Improved reporting for failed, cancelled, skipped, unknown, and unavailable cache outcomes.
  • Tests

    • Added automated checks for receipt classification, timing, workflow integration, and read-only cache validation.