fix(ci): a release's warm build no longer compiles the api crate and the builder again for its freshly generated shaders #3063
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3063
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/ci-cache"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.hheaders itsSTAMPlists). They are untracked, soscripts/ci_source_times.pydid not record them or date them back after a cache restore.game/crates/api's buildscript 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.pynow records and dates the generated shaders the same way as tracked files: by content, never bytime. A changed output still stays new.
Read first:
scripts/ci_source_times.py(generated(),files()), thentests/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.aand 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.mddescribes both.Testing
Tested:
python -I -B tests/test_ci_source_times.pyruns on Linux in a made-up git tree with no game files. Itpasses here. On
mainit fails: "gpu/vk/shaders/blit_spv.h is unchanged but was left new".Still to test:
shaders, no
Compiling api/build-driver/longshot-builderlines on a commit that doesn't touch them, andthe 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
main; the title is a Conventional Commit.mise run testpasses. (tests/run_all.pyon this branch: 869 passed, 12 skipped, 3 failed, none through this change, which touches onlyci_source_times.py, its test and a doc:test_vk_wb_cpu_words_fast,test_i18n_complete(fixed by #3065) andtest_lifter(every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split), all on thismain.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.Assisted-by:/Co-Authored-By:trailers.🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8e2fJhRpDrY7pgVx6oJ
Full test run done on this branch; results in the checklist.
WIP: fix(ci): a release's warm build no longer compiles the api crate and the builder again for its freshly generated shadersto fix(ci): a release's warm build no longer compiles the api crate and the builder again for its freshly generated shadersRecommendation: 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.
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.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.@fixcan do L1 and L2.Questions (1) (not confirmed from the code; they don't hold the recommendation)
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:
a2e8f60cbcagainst2ca7d4f741: 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:
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.
@ -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 fileeach 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 notL2 (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)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.