Repository navigation
test(setup-environment): check the cache fallback within a version; tidy up after #206 - #208
Conversation
…idy up after #206 #206 tested one half of #205: a cache-version bump restores nothing. Nothing checked the other half, that an edited environment file under the same version still restores through the fallback. A change that dropped the fallback would have left the harness green while every edit cost a full build. - New harness job, env-file-edit: env-seed's salted fixture plus one line, so only the fallback can match, and conda-cache-hit must be 'false'. env-seed has saved a cache under the same version, so the result is deterministic. - setup-environment's closing summary tells the fallback case apart ("Restored from an earlier cache, then updated from the environment file") instead of reporting it as "Installed fresh". - env-seed's success line no longer claims the environment was created fresh: it usually comes from another run's cache through the fallback. - TESTING.md: the stale cache-key debug snippet becomes a pointer to the cache step's log and the chapter's key table; the coverage row gains the new job. CHANGELOG's #205 entry covers both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Correctness hinges on GitHub Actions cross-job cache fallback semantics that cannot be executed or verified in this review environment, warranting a human's final confirmation.
Review effort: Balanced
Findings: None
What changed in this PR
This PR is a follow-up to #206/#205 that fills the missing half of the setup-environment Conda-cache test coverage. #206 proved that bumping cache-version restores nothing (a fresh build); this PR adds the complementary proof that an edited environment file within the same cache-version still restores the latest environment through the restore-keys fallback and then updates it, so an edit does not cost a full build. It also tightens two log messages that misreported a fallback restore as a fresh install, and refreshes the now-stale cache-key debug guidance in the testing docs.
Changes:
- New harness job
env-file-editintest-actions.ymlassertingconda-cache-hit == 'false'after editing the salted environment file, with the job wired into theharness-summaryanchor. setup-environment's standard-mode summary now distinguishes a fallback restore (conda-cache-hit == 'false') from a true fresh install, andenv-seed's success line no longer overclaims "created fresh".- Docs/CHANGELOG updates: the TESTING.md coverage row and debug snippet, plus a CHANGELOG note covering both new jobs and the summary wording.
| File | Description |
|---|---|
.github/workflows/test-actions.yml |
Adds env-file-edit job (salted fixture + extra line so only the fallback matches), asserts conda-cache-hit=='false' and the env imports myst_nb; softens env-seed's success message; registers the job in harness-summary needs. |
setup-environment/action.yml |
Adds an elif for conda-cache-hit=='false' in the standard-mode summary to report a fallback-restore-then-update instead of "Installed fresh". |
docs/dev/TESTING.md |
Updates the setup-environment coverage row to mention the new job and replaces the stale cache-key debug snippet with a pointer to the cache step log and the chapter's key table. |
CHANGELOG.md |
Expands the #205 Fixed entry to cover env-file-edit and the summary wording change. |
I verified the determinism argument: env-file-edit needs: env-seed, so env-seed's cache is saved (under a per-run-unique salted key sharing the default cache-version/environment-name/python-version prefix) before this job runs; the appended # harness-edit line changes only the file hash, so the exact key misses while the conda-<os>-<name>-<cache-version>-py<python>- fallback matches, yielding 'false'. The doc link anchor (#standard-mode) and target file both exist, and the summary elif is correctly scoped inside the standard-runner branch. No blocking issues found.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Follow-up to #206 (#205), and tidy-up before #190.
The missing half of #205's test
#206's
env-version-bumpproves acache-versionbump restores nothing. Nothing checked the other half: that an edited environment file under the same version still restores through the fallback and is then updated. That fallback is why #206 kept a fallback at all, instead of droppingrestore-keys. A change that dropped it would have left the harness green while every edit toenvironment.ymlcost a full build.New job,
env-file-edit:env-seed's salted fixture plus one extra line, so the file's hash differs from every cache and only the fallback can match.conda-cache-hitis'false'and that the environment works.env-seedhas already saved a cache under the samecache-version, so the result is deterministic.env-version-bumpwould fail instead.Log accuracy
setup-environment's closing summary said "Installed fresh" whenever there was no exact hit, including after a fallback restore. It now says "Restored from an earlier cache, then updated from the environment file" in that case.env-seed's success line claimed "environment created fresh". Its log shows it usually restores another run's cache through the fallback, so the line now says so.Docs
docs/dev/TESTING.md: the cache-key debug snippet was already stale and fix(setup-environment): bumping cache-version builds a fresh Conda environment (#205) #206 made it wrong. It now points to the cache step's log and the chapter's key table. The coverage row lists the new job.Testing
scripts/generate-docs.py --check --check-examples --actionlintpasses.conda-cache-hitastrue,falseand empty prints each of the three lines.🤖 Generated with Claude Code
https://claude.ai/code/session_01FeKTxWtkzVMyPbqeSgM2Tb
Generated by Claude Code