feat(build): Longshot's object and lift stores in the build files folder, so switching versions reuses earlier builds' work #72
No reviewers
Labels
No labels
area/build
area/install
area/saves
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!72
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/LongshotLauncher:build/stores"
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?
Switching between builds (stable and nightly, or going back a version) compiles almost the whole game again, because after each build the work folder keeps only that build's compiled objects. Longshot's object and lift stores (MagicBeanDev/Longshot#371, MagicBeanDev/Longshot#372) keep earlier builds' objects and translations; this turns them on for launcher builds.
What changed
Core/MakeGameCommand.csFor, both systems:LONGSHOT_OBJ_STORE=<work>/obj-storeandLONGSHOT_LIFT_STORE=<work>/lift-store, where<work>is the player's chosen build files folder or the launcher's own. Inside the work folder, so always on its drive (the objects are hard links there; a copy across drives).LONGSHOT_OBJ_STORE_GB=4(Longshot's default is 8) andLONGSHOT_LIFT_STORE_KEEP=2(default 3); Longshot's 14-day expiry is kept.Core/Disk.cs:obj-storeandlift-storeare inWorkParts, so Free up space counts and clears them.WorkBytescounts an object that is in bothobjcacheand the store once (one hard-linked file), matched by name in the store's folder for the work folder'ssystem_headers.txt, asnx2/object_store.pyfoldernames it.tests/launcher_core/Program.cschecks the variables on Windows (default work folder) and Linux (a chosen one);ScreenChecks.cshas a Free up space case with both stores (an object in both counted once, another compiler's counted, both stores deleted, the player's other files kept).Disk cost
objcache's, so it costs nothing. Objects no build holds go after 14 days, and oldest first past 4 GB, about four versions' own objects (a build's are ~1 GB).Disk.BuildBytesstays 45 GB: what the stores keep is on the disk already, and a build adds at most one translation while it runs.make_game.py's comments, not measured.Testing
Not compiled or run yet: neither
dotnet buildnorpython -I tests/test_launcher_core.py(the author runs no checks on their PC, and the lab machine has no .NET). Checked by reading against Longshot'snx2/object_store.py,lift_store.pyandmake_game.pyon main: make_game deletes onlyexefs,probeandsaafter a build and trimsobjcache, so a store inside the work folder is left alone; the lift store's path is not part of the lift key.Must be tested:
python -I tests/test_launcher_core.py --strict --longshot <Longshot main>on Linux and Windows; a build, then a build of another version, then the first again on one PC: the third should compile almost nothing (its log's compile count) and translate nothing.Risks
The disk use above. Reverting the commit turns the stores off; Free up space clears what they hold.
🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8e3MfaADZobPGhWJk77
Review notes (C# compiled and launcher-core checks passed on a scratch copy with this applied: 1048 checks):
system_headers.txtcrashesDisk.WorkBytes(Core/Disk.cs,ObjectStoreBytes). A file of NUL bytes, which a crash or power loss can leave behind, passesTrim()and the length check.Path.Combine(store, stamp[..16])then throwsArgumentException, which isn't caught. InSettingsViewModel.MeasureWorkthat leavesmeasuringtrue for good, so the note stays on "Measuring…" and Free up space stays disabled, the very button that would clear the bad file. Fix: require 16 lowercase hex characters, asobject_store.folderdoes, and catchArgumentException._placecopies whenos.linkfails, which happens on exFAT/FAT drives and some SMB shares.WorkBytesstill subtracts any store object named like one inobjcache, so it under-counts by about 1 GB there. The new test writes two separate files, so it asserts this under-count rather than a hard link. Only subtract when the two are the same file (link count or file ID).lift_share_keyhashes the work folder's currentimage/chunks.txtandhot_pieces.txtbefore the lift, and the other version's build has rewritten them. The planned third build will likely translate again on the first round. That's Longshot's behaviour (#372), but the README and test plan should say so.🤖 Review drafted with Claude Code
d102db372463760b51faRebased onto main (
4bab213, #82, no conflicts), and the review's fixes are in63760b51:ObjectStoreBytestakes the stamp only when its first 16 characters are lowercase hex (asobject_store.folder), and also catchesArgumentException. A NUL-filled or junksystem_headers.txtno longer hangs "Measuring…".FileLinks.SameFile(link count > 1 and the same file:statxdevice and inode on Linux,GetFileInformationByHandlevolume serial and file index on Windows). When it can't tell, the file counts twice. The test uses a real hard link and checks that a copy counts twice.chunks.txt/hot_pieces.txt).Not compiled or run yet. The
statxP/Invoke (a fixed 256-byte layout) needs a build and a run on Linux before this leaves WIP.🤖 Drafted with Claude Code
WIP: feat(build): Longshot's object and lift stores in the build files folder, so switching versions reuses earlier builds' workto feat(build): Longshot's object and lift stores in the build files folder, so switching versions reuses earlier builds' work