← Back to Pull requests

fix: save cache after inexact cache restore #646

Closed
unknown closed this pull request without merging on Oct 03, 2026 22:49 UTC
View on GitHub
unknown unknown commented on Oct 03, 2026 22:28 UTC
Author

<!-- entire-trail-link-start -->
https://entire.io/gh/jdx/mise-action/trails/21
<!-- entire-trail-link-end -->

Summary


  • restoreMiseCache returned undefined on every hit, so when @actions/cache restored a different key via prefix match, the cache was never saved under the primary key and the same rebuild repeated on every run.

  • It now returns the primary key when the restored key differs from it. Exact hits still skip the save.
  • Addresses problem 2 of #382. Problem 1 (conditional template segments creating prefix relationships) is left as-is since changing the default key would invalidate everyone's caches.

    🤖 Generated with Claude Code

    <!-- CURSOR_SUMMARY -->
    ---

    [!NOTE]

    Low Risk

    Narrow change to cache save gating after restore; exact cache hits behave as before and unit tests cover the decision helper.

    > Overview

    Fixes mise GitHub Actions cache behavior when @actions/cache restores from a prefix-matched key instead of the computed primary key.

    > restoreMiseCache previously returned a save key only on a full miss; any successful restore left cacheKey undefined, so post-install saveCache never ran and workflows kept reinstalling on every run. A new cacheKeyToSave helper returns the primary key for misses and prefix hits, and undefined when the restored key exactly matches the primary (no redundant save).

    > Bundled dist/index.js reflects the same logic for the published action entrypoint.

    > <sup>Reviewed by Cursor Bugbot for commit 858cea0206dc996dfeb8f5f02d4772de2d5cf17d. Bugbot is set up for automated code reviews on this repo. Configure here.</sup>

    <!-- /CURSOR_SUMMARY -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Bug Fixes
    Improved cache reuse by saving restored entries found under related keys under the primary key, making them available for subsequent runs. When the restored entry already matches the primary key exactly, no additional save is triggered, avoiding redundant cache work while preserving the existing behavior for exact matches.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 287 lines (+215 / -72) across 3 files Reviewer: jdx Review duration: 21m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 287 lines diff across 3 files
    0.45
    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%
    60%
    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.339
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #646"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 17.7% · Safe to merge
    17.7%