Fix ai-gate cardgen cache inputs#5469
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new GitHub composite action, AI card data cache, designed to cache and restore MTGJSON and generated card data for AI gate jobs. The feedback suggests optimizing the MTGJSON download step by replacing the shell-level file existence check with a step-level if conditional that checks the cache-hit output of the preceding cache step, which is more idiomatic and efficient.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| - name: Download MTGJSON data | ||
| shell: bash | ||
| run: | | ||
| if [ ! -f data/mtgjson/AtomicCards.json ]; then | ||
| mkdir -p data/mtgjson | ||
| source scripts/lib/mtgjson-fetch.sh | ||
| mtgjson_download AtomicCards.json data/mtgjson/AtomicCards.json | ||
| fi |
There was a problem hiding this comment.
This step uses a shell if to check for the existence of the cached file. A more idiomatic approach in GitHub Actions is to use a step-level if conditional with the cache-hit output from the preceding cache step. This makes the workflow's control flow more explicit and avoids executing the shell: bash step entirely when the cache is hit, which is slightly more efficient. This pattern is also flagged by actionlint as shell-if.
- name: Download MTGJSON data
if: steps.mtgjson-cache.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir -p data/mtgjson
source scripts/lib/mtgjson-fetch.sh
mtgjson_download AtomicCards.json data/mtgjson/AtomicCards.jsonThere was a problem hiding this comment.
Not applying this suggestion.
This step intentionally gates on file existence rather than steps.mtgjson-cache.outputs.cache-hit, matching .github/workflows/ci.yml. The CI workflow documents the failure mode we are preserving against: cache restore can report a hit for a poisoned/partial entry while data/mtgjson/AtomicCards.json is absent, and a cache-hit step condition would then skip the download and break oracle-gen. The shell step is cheap on a warm cache and self-heals missing-file restores.
|
Thanks for this — the direction is right, and the cache key correctly picks up However this PR is a hard stop for the automated contributor-review path: every file it touches is on the repo's hard-stop list.
Changes to CI workflows — and especially a new composite action that populates the This needs direct maintainer handling. Two specific things a maintainer will need to check before it can land:
Leaving this open for a maintainer to pick up directly. Not enqueuing. |
|
Follow-up to my earlier comment — I've now done the full review, and both concerns I raised there are resolved. Correcting the record: 1. Cache-writer ownership — not a problem, by a design that predates this PR. 2. Key drift vs Verification that the fix actually works. Green CI alone couldn't prove this: if
Same digest. MTGJSON restores before the key is evaluated, Also confirmed: both workflows run the byte-identical One non-blocking follow-up. The Approving and enqueuing. Note for the record: this PR touches Nice diagnosis on the |
matthewevans
left a comment
There was a problem hiding this comment.
Approved. Fixes a real, silent CI defect (#5456), verified end-to-end against the run logs: ai-gate and ci.yml now evaluate the identical cardgen-ade68e79… digest, so cross-workflow cache sharing genuinely works and the key invalidates on the weekly MTGJSON refresh. Validate/coverage remain gated on the separate cardgen-gates-v1- key, so a shared cardgen entry cannot license a false green. Details in the comment above.
Summary
Fixes the ai-gate cardgen cache ordering for issue #5456.
Closes #5456.
Files changed
.github/actions/ai-card-data-cache/action.yml.github/workflows/ai-gate.yml.github/workflows/ci.ymlCR references
None.
Track
Developer
LLM
Model: codex-5
Thinking: medium
Tier: Standard
Anchored on
.github/workflows/ci.yml:153— existing weeklymtgjson-atomic-*cache key setup before generated card-data cache evaluation..github/workflows/ci.yml:174— existing file-existence-gated MTGJSON download that self-heals missing or partial cache restores..github/workflows/ci.yml:188— existing generated card-data cache key that hashesAtomicCards.json, engine source, engine embedded data, build script, and lockfile..github/actions/create-auto-merge-pr/action.yml:24— existing local composite action structure usingruns: using: composite.Gate A
./scripts/check-parser-combinators.sh— clean, exit 0, no output.Verification
cargo fmt --all -- --check— clean./scripts/check-parser-combinators.sh— clean/tmp/actionlint-bin/actionlint .github/workflows/ai-gate.yml .github/workflows/ci.yml— cleanpython3 -c 'import yaml, sys; [yaml.safe_load(open(f)) for f in sys.argv[1:]]; print("ok")' .github/workflows/ai-gate.yml .github/workflows/ci.yml .github/actions/ai-card-data-cache/action.yml— cleandoc-guardian— cleancode-reviewer— approvedqa-tester— READY FOR PRScope Expansion
None.
Validation Failures
None.
CI Failures
None.