Skip to content

fix(cache): avoid misleading message on refs not built "on purpose"#41983

Draft
marcelolynch wants to merge 2 commits into
leanprover-community:masterfrom
marcelolynch:2026/07/CacheMissKeyedHints
Draft

fix(cache): avoid misleading message on refs not built "on purpose"#41983
marcelolynch wants to merge 2 commits into
leanprover-community:masterfrom
marcelolynch:2026/07/CacheMissKeyedHints

Conversation

@marcelolynch

@marcelolynch marcelolynch commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

cache get on a fork printed a "no cache found for HEAD" note whenever the per-SHA fork marker was absent, even when every file was then served from mathlib's master cache — which is always the case for a tooling-only PR (its CI build stages zero files, so the upload job and the marker are skipped by design). Reported in #41707 (comment).

The note is now printed after the download rounds and only when files are actually missing; cache query's no-result message names both possible causes (CI hasn't built the commits, or its builds had nothing fork-specific to upload) instead of claiming the first.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

PR summary a022a0f01d

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ DownloadResult
+ containsSub
+ forkHintSHA?
+ missingFilesForkLines
+ missingFilesGenericLines
+ test_forkHintSHA_guards
+ test_missingFilesLines
+ warnIfMissingFiles
- informIfHeadNotBuilt

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit a022a0f).

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit a022a0f01d
Reference commit 3de5ed81cc

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the CI Modifies the continuous integration setup or other automation label Jul 21, 2026
@marcelolynch marcelolynch changed the title fix(cache): key missing-file guidance on download outcome, not marker absence fix(cache): avoid misleading message on refs not built "on purpose" Jul 21, 2026
marcelolynch and others added 2 commits July 21, 2026 14:32
… absence

`cache get` on a fork printed an alarming "no cache found for HEAD" note
whenever the per-SHA fork marker was absent, even when every file was then
served from mathlib's master cache. A tooling-only PR (no Lean module
changes) always hits this: its CI build has a 100% master-cache hit, stages
zero files, skips the upload job, and so never writes the marker — nothing
failed, but the note (and `cache query`'s "CI hasn't built any of these
commits yet") said otherwise.

The note is now printed after the download rounds and only when files are
actually missing: `downloadFiles` returns hard-failure and miss counts
(`DownloadResult`), `getFiles` propagates the miss count, and
`warnIfMissingFiles` picks between the fork-workflow hint (`cache query` /
`--scope`) and the generic divergence warning. A read fully served by the
containers prints nothing, which also retires the upfront marker probe and
the ancestor-of-master special case — proxies for the consequence this now
measures directly.

`cache query` distinguishes the two causes of a missing marker: when the
branch changes no cache-relevant file (module trees, toolchain, lakefile,
manifest) it explains that CI builds of it upload nothing fork-specific,
instead of claiming CI hasn't built the commits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An empty `cache query` result has two causes — CI hasn't built the commits,
or its builds had nothing fork-specific to upload — and the tool cannot
reliably tell them apart, so the message now states both instead of guessing
one via a git-diff path heuristic.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@marcelolynch
marcelolynch force-pushed the 2026/07/CacheMissKeyedHints branch from 7b57596 to a022a0f Compare July 21, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Modifies the continuous integration setup or other automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant