← Back to Pull requests

feat(ci): add static artifact cache index and lookup #10026

Closed
unknown closed this pull request without merging on Nov 20, 2026 00:20 UTC
View on GitHub
unknown unknown commented on Nov 17, 2026 00:50 UTC
Author

Summary

Issue: #8651

Add a prototype, statically maintained artifact cache index and a CLI that decides whether artifacts from previous CI runs match a build's fingerprints.
This is the "static index + lookup" step (Phase 2) of RFC0016 and provides the planning step for future CI cache reuse. It only writes a plan: it does not download archives, restore stages, or skip compilation.

By default only amd-llvm artifacts are used. Other artifacts work the same way through include and exclude patterns.

Design

record: update the index from a CI run

record
  --> list the run's artifacts, keep those matching the patterns (default: amd-llvm)
  --> for each artifact: has a .fprint file?
        --- no  --> skip it and report it
        --- yes --> read its .fprint and .sha256sum (never the archive)
  --> merge into the index
        --- same fingerprint      --> keep the existing entry
        --- different fingerprint --> replace it
        --- not in the index      --> add it
  --> write the index

error, index unchanged:
  --- a .fprint without a .sha256sum, or any invalid file
  --- components of one artifact with different fingerprints

lookup: decide whether a build can reuse artifacts

lookup 
  --> read the local .fprint files, keep those matching the patterns
  --> group them by artifact (name + target),
      add the index's components of the same artifacts
  --> for each artifact: is its fingerprint in the index (same platform)?
        --- yes --> hit (the plan lists where to get it)
        --- no  --> miss, with a reason
  --> group rule: one component misses --> all components of that artifact miss
  --> summarize the whole build (overall action):
        --- every artifact hit --> populate
        --- any artifact missed --> build
            (hits stay in the plan, so a later step can still reuse them)
  --> write the plan

Changes

New directory build_tools/artifact_cache/:

  • prototype_artifact_cache_index.json: a manually maintained, prototype index

  • of artifact fingerprints, archive locations, checksums, and source CI runs.
    It holds metadata only, and a dynamic index is planned to replace it.
  • artifact_cache.py with two subcommands:

  • - record: read a CI run's fingerprint (.fprint) and checksum
    (.sha256sum) files through the artifact backend in _therock_utils and
    update the index. A changed fingerprint replaces only the entry for the same
    platform, name, component, and target; matching entries keep their original
    run. Archives are never downloaded.
    - lookup: compare the build's local .fprint files with the index by name,
    component, target, fingerprint, and platform, and write a JSON plan. Only
    artifacts the build produces are checked.
  • tests/artifact_cache_test.py: unit tests using simulated CI runs in a temporary

  • directory (no network or AWS access).
  • README.md: the directory overview, index maintenance, usage, and a manual test

  • procedure.

    Both subcommands take INCLUDE... and --exclude regular expressions, as
    fetch_artifacts.py does. They default to amd-llvm, and . selects everything.
    Artifact names, the S3/local backend, and filtering reuse
    _therock_utils/artifacts.py, _therock_utils/artifact_backend.py, and
    fetch_artifacts.py.

    Lookup plan

  • Each artifact is a hit (with its provenance and outputs) or a miss with

  • a reason.
  • All components of one artifact (same name and target) are reused together.

  • If one misses, or their fingerprints differ, the whole group misses, so there
    is no partial reuse.
  • The plan's action is populate only when every artifact in the plan hits,

  • and build otherwise.
  • Hits and misses both exit with 0; input or I/O errors exit with 2.

  • Artifacts without a .fprint file, such as split per-target artifacts, are

  • reported as skipped by record and never appear in a plan.

    Validation

  • All 51 unit tests pass.

  • Ran the manual test procedure from the README against CI run 43936062480

  • (Linux), and all five plan checks passed:
    - record: five amd-llvm components added; repeating it leaves the index
    unchanged.
    - lookup with an empty fingerprints directory: MISS, no_local_fingerprints.
    - lookup with the run's own fingerprints: HIT for all five components.
    - lookup with changed fingerprints: MISS, no_matching_index_entry.
    - lookup with one component removed: MISS, incomplete_group for the others.
    - record and lookup for base with --exclude _dbg_: HIT for all five.
    - lookup with . while the index also holds base: HIT, with base ignored.
  • Regenerating the index for Linux and Windows from run 43936062480 reproduces

  • the checked-in file exactly.

    The controlled HITs validate the lookup behavior; they do not establish
    compatibility between a local build and that CI run.

    Known limitations

  • record does not check that a CI run succeeded; choose a run whose jobs

  • uploaded complete artifacts. The index is trusted input.
  • A hit identifies candidates only. A later step must verify that the archives

  • still exist and match their checksums.
  • The plan alone does not say whether a build stage can be skipped, because

  • artifacts without fingerprints are not in it.

    Follow-up work

    Artifact copying, archive-content checksum verification, prebuilt-stage
    restoration, CI workflow integration, and the dynamic index backend. This PR
    generates the reuse plan; it does not skip LLVM compilation.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: erman-gurses Review duration: 4289m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #10026"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%
    Repository