fix(ci): a release's warm build no longer compiles the api crate and the builder again for its freshly generated shaders #3063

Merged
HumanBean merged 1 commit from HumanBean/Longshot:fix/ci-cache into main 2026-12-03 15:04:59 +00:00
Owner

Summary

Since the mod API landed (#2822), the release build writes Longshot's compiled shaders fresh in every run
(scripts/ci_shaders.sh: gen/shaders/ and the _spv.h headers its STAMP lists). They are untracked, so
scripts/ci_source_times.py did not record them or date them back after a cache restore. game/crates/api's build
script watches them, so after every restore cargo compiled api, build-driver and longshot-builder again, followed by
the thin-LTO link, even when the cache hit.

ci_source_times.py now records and dates the generated shaders the same way as tracked files: by content, never by
time. A changed output still stays new.

Read first: scripts/ci_source_times.py (generated(), files()), then tests/test_ci_source_times.py.

This goes with a MagicBeanAdmin/Release change, kept as a separate commit and not pushed. That change adds the
liblongshot_rs.a and RenHDrum target folders (rust-game-work, rust-renhdrum-work) to the Rust cache. Before it,
they were never cached. It also saves the cache after their compiles and keys it by the pinned Rust first. The
paragraph in docs/dev/reference/ci.md describes both.

Testing

Tested: python -I -B tests/test_ci_source_times.py runs on Linux in a made-up git tree with no game files. It
passes here. On main it fails: "gpu/vk/shaders/blit_spv.h is unchanged but was left new".

Still to test:

  • A release run on each trusted runner, after the Release change. Expect "N files unchanged" to count the generated
    shaders, no Compiling api / build-driver / longshot-builder lines on a commit that doesn't touch them, and
    the second run on a runner restoring the new key (by hand, from the release job logs).

Measurements

Nothing to measure here: the gain shows only in a real release job (cold times from run 1215 on the lab: packager 1m53, game Rust 1m40, builder 2m37).

Risks

CI only; players are not affected. If a generated file were wrongly dated back, cargo would keep a stale build. That
can't happen for an unchanged file, because dating goes by its SHA-256. Revert the commit to undo.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, as Testing says. (Nothing the game runs; the release run itself is under Still to test.)
  • mise run test passes. (tests/run_all.py on this branch: 869 passed, 12 skipped, 3 failed, none through this change, which touches only ci_source_times.py, its test and a doc: test_vk_wb_cpu_words_fast, test_i18n_complete (fixed by #3065) and test_lifter (every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split), all on this main.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e2fJhRpDrY7pgVx6oJ

## Summary Since the mod API landed (#2822), the release build writes Longshot's compiled shaders fresh in every run (`scripts/ci_shaders.sh`: `gen/shaders/` and the `_spv.h` headers its `STAMP` lists). They are untracked, so `scripts/ci_source_times.py` did not record them or date them back after a cache restore. `game/crates/api`'s build script watches them, so after every restore cargo compiled api, build-driver and longshot-builder again, followed by the thin-LTO link, even when the cache hit. `ci_source_times.py` now records and dates the generated shaders the same way as tracked files: by content, never by time. A changed output still stays new. Read first: `scripts/ci_source_times.py` (`generated()`, `files()`), then `tests/test_ci_source_times.py`. This goes with a MagicBeanAdmin/Release change, kept as a separate commit and not pushed. That change adds the `liblongshot_rs.a` and RenHDrum target folders (`rust-game-work`, `rust-renhdrum-work`) to the Rust cache. Before it, they were never cached. It also saves the cache after their compiles and keys it by the pinned Rust first. The paragraph in `docs/dev/reference/ci.md` describes both. ## Testing **Tested:** `python -I -B tests/test_ci_source_times.py` runs on Linux in a made-up git tree with no game files. It passes here. On `main` it fails: "gpu/vk/shaders/blit_spv.h is unchanged but was left new". **Still to test:** - A release run on each trusted runner, after the Release change. Expect "N files unchanged" to count the generated shaders, no `Compiling api` / `build-driver` / `longshot-builder` lines on a commit that doesn't touch them, and the second run on a runner restoring the new key (by hand, from the release job logs). ## Measurements Nothing to measure here: the gain shows only in a real release job (cold times from run 1215 on the lab: packager 1m53, game Rust 1m40, builder 2m37). ## Risks CI only; players are not affected. If a generated file were wrongly dated back, cargo would keep a stale build. That can't happen for an unchanged file, because dating goes by its SHA-256. Revert the commit to undo. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, as Testing says. *(Nothing the game runs; the release run itself is under Still to test.)* - [x] `mise run test` passes. *(`tests/run_all.py` on this branch: 869 passed, 12 skipped, 3 failed, none through this change, which touches only `ci_source_times.py`, its test and a doc: `test_vk_wb_cpu_words_fast`, `test_i18n_complete` (fixed by #3065) and `test_lifter` (`every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split`), all on this `main`.)* - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e2fJhRpDrY7pgVx6oJ
fix(ci): a release's warm build no longer compiles the api crate and the builder again for its freshly generated shaders
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 11s
PR description / Title and description (pull_request_target) Successful in 5s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 19s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m25s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m43s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 16m43s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m15s
CI / Website build and checks (pull_request) Failing after 40s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Successful in 50m36s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m5s
a2e8f60cbc
ci_source_times.py records and dates back the generated shaders (gen/shaders/ and the outputs its STAMP names) as it
does the tracked files: game/crates/api's build script watches them, and each release writes them anew, so api,
build-driver and longshot-builder compiled again after every cache restore since the mod API landed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e2fJhRpDrY7pgVx6oJ
Author
Owner

Full test run done on this branch; results in the checklist.

Full test run done on this branch; results in the checklist.
HumanBean changed title from WIP: fix(ci): a release's warm build no longer compiles the api crate and the builder again for its freshly generated shaders to fix(ci): a release's warm build no longer compiles the api crate and the builder again for its freshly generated shaders 2026-12-03 09:15:11 +00:00
BeanBot left a comment

Recommendation: Approve. The file timestamp test supports the basic fix, but it does not show that a warm release build avoids recompilation or saves time. The release workflow change and its runs are still outstanding. Nothing blocking is left. Recommend approval; not approved on the forge.

The script records generated shader hashes alongside tracked files and dates unchanged outputs back after a cache restore. This may avoid unnecessary release-build work, at the cost of hashing the generated files.

Should fix (2): not blocking, but worth doing before merging.

  • L1 tests/test_ci_source_times.py:46: The test's temporary Git commit inherits the user's Git configuration and hooks. (more on the line) Do: Remove the unnecessary commit: git ls-files sees the staged files after git add. Isolate the temporary Git commands from inherited Git environment and configuration as well.
  • L2 docs/dev/reference/ci.md:108: The cache description states that the game Rust and RenHDrum target folders are already cached, although the accompanying Release change has not been pushed. (more on the line) Do: Describe the current workflow until the Release change lands, or make the documentation update depend on that change being merged.

@fix can do L1 and L2.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • After the Release change is available, do repeated warm builds on each trusted runner omit the stated recompiles, and how do their times compare with the base under the same cache conditions?

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven. The author reports that the synthetic test passes on this branch and fails on main, but provides no comparable warm release timings. The reported cold times—1m53 for the packager, 1m40 for game Rust and 2m37 for the builder—are from one existing run and do not measure this change.

Other systems: The script affects release cargo caches, including builds that consume the generated shader files; it does not run in the game. The API build script watches the compiled effects and shader inputs, but the actual release workflow and its cache ordering could not be inspected in this checkout. Release runs on the trusted runners remain outstanding.

Switches: None.

Reviewed: a2e8f60cbc against 2ca7d4f741: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the applicable standards, all three changed files and the full diff and commit. Read scripts/ci_shaders.sh, game/crates/api/build.rs, and the relevant shader generation and packaging code. Skimmed references to shader stamps and CI callers. docs/review-checklist.md and the adjacent Tooling checkout were absent; the separate Release workflow was unavailable.; nothing run (a code review).

Checked and fine:

  • The test checks both unchanged generated files and a changed generated file, and the reported failure on main exercises the new behavior.
  • The commit records AI assistance; no compiled shader outputs or game-derived files are added.
  • The change adds no player switch or renderer API change.

Testing: No commands from the project were run, as requested. The author reports the synthetic Linux test passing; the listed CI checks were still running.

Overlaps and merge order: The described MagicBeanAdmin/Release cache change is separate and unpushed; its merge order and behavior could not be verified here. No other overlaps found in the supplied information.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as HumanBean took it out of WIP. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The file timestamp test supports the basic fix, but it does not show that a warm release build avoids recompilation or saves time. The release workflow change and its runs are still outstanding. Nothing blocking is left. Recommend approval; not approved on the forge. The script records generated shader hashes alongside tracked files and dates unchanged outputs back after a cache restore. This may avoid unnecessary release-build work, at the cost of hashing the generated files. **Should fix (2)**: not blocking, but worth doing before merging. - **L1** `tests/test_ci_source_times.py:46`: The test's temporary Git commit inherits the user's Git configuration and hooks. (more on the line) **Do:** Remove the unnecessary commit: git ls-files sees the staged files after git add. Isolate the temporary Git commands from inherited Git environment and configuration as well. - **L2** `docs/dev/reference/ci.md:108`: The cache description states that the game Rust and RenHDrum target folders are already cached, although the accompanying Release change has not been pushed. (more on the line) **Do:** Describe the current workflow until the Release change lands, or make the documentation update depend on that change being merged. `@fix` can do L1 and L2. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - After the Release change is available, do repeated warm builds on each trusted runner omit the stated recompiles, and how do their times compare with the base under the same cache conditions? **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven. The author reports that the synthetic test passes on this branch and fails on main, but provides no comparable warm release timings. The reported cold times—1m53 for the packager, 1m40 for game Rust and 2m37 for the builder—are from one existing run and do not measure this change. **Other systems:** The script affects release cargo caches, including builds that consume the generated shader files; it does not run in the game. The API build script watches the compiled effects and shader inputs, but the actual release workflow and its cache ordering could not be inspected in this checkout. Release runs on the trusted runners remain outstanding. **Switches:** None. **Reviewed:** a2e8f60cbc24 against 2ca7d4f74182: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the applicable standards, all three changed files and the full diff and commit. Read scripts/ci_shaders.sh, game/crates/api/build.rs, and the relevant shader generation and packaging code. Skimmed references to shader stamps and CI callers. docs/review-checklist.md and the adjacent Tooling checkout were absent; the separate Release workflow was unavailable.; nothing run (a code review). **Checked and fine:** - The test checks both unchanged generated files and a changed generated file, and the reported failure on main exercises the new behavior. - The commit records AI assistance; no compiled shader outputs or game-derived files are added. - The change adds no player switch or renderer API change. **Testing:** No commands from the project were run, as requested. The author reports the synthetic Linux test passing; the listed CI checks were still running. **Overlaps and merge order:** The described MagicBeanAdmin/Release cache change is separate and unpushed; its merge order and behavior could not be verified here. No other overlaps found in the supplied information. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as HumanBean took it out of WIP. Nothing was run; a maintainer decides.</sub>
@ -107,2 +107,2 @@
each checked by its SHA-256 every time it is used, and cargo's target folder of the shipped builder's and
`longshot-packager`'s compiles, which is not checked again. Cargo takes a workspace crate's files' times for whether it changed, and a checkout makes every file
each checked by its SHA-256 every time it is used, and cargo's target folders (the shipped builder's and
`longshot-packager`'s compiles, `liblongshot_rs.a`'s, RenHDrum's and the generated shaders' tools'), which are not
Member

L2 (should fix): The cache description states that the game Rust and RenHDrum target folders are already cached, although the accompanying Release change has not been pushed.

When: A maintainer reading this after this pull request merges but before the separate Release change lands is told those folders are cached when they are not.

Do: Describe the current workflow until the Release change lands, or make the documentation update depend on that change being merged.

**L2** (should fix): The cache description states that the game Rust and RenHDrum target folders are already cached, although the accompanying Release change has not been pushed. *When:* A maintainer reading this after this pull request merges but before the separate Release change lands is told those folders are cached when they are not. **Do:** Describe the current workflow until the Release change lands, or make the documentation update depend on that change being merged.
@ -0,0 +43,4 @@
write(tree, "src/changed.rs", "pub fn b() {}\n")
write(tree, "gpu/vk/shaders/blit.comp", "void main() {}\n")
subprocess.run(git + ["add", "-A"], check=True)
subprocess.run(git + ["commit", "-q", "-m", "t"], check=True)
Member

L1 (should fix): The test's temporary Git commit inherits the user's Git configuration and hooks.

When: With commit.gpgSign enabled and no usable signing key, the commit fails before the timestamp assertions run. A configured commit hook can also run during the test.

Do: Remove the unnecessary commit: git ls-files sees the staged files after git add. Isolate the temporary Git commands from inherited Git environment and configuration as well.

**L1** (should fix): The test's temporary Git commit inherits the user's Git configuration and hooks. *When:* With commit.gpgSign enabled and no usable signing key, the commit fails before the timestamp assertions run. A configured commit hook can also run during the test. **Do:** Remove the unnecessary commit: git ls-files sees the staged files after git add. Isolate the temporary Git commands from inherited Git environment and configuration as well.
HumanBean deleted branch fix/ci-cache 2026-12-03 15:04:59 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!3063
No description provided.