WIP: fix(cache): ignore NaN retention settings #1022
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1022
Loading…
Reference in a new issue
No description provided.
Delete branch "NitnekLeBorgne/Longshot-contributions:fix/object-store-nan-retention-20261116"
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?
Type: fix · Risk: low · Tested on: Linux and native Windows CLI, game-free Python/filesystem checks (GPU unused) · Needs: no remaining Windows public-fixture gate; production use remains untested
Why
A cache retention setting of
NaNcurrently becomes zero instead of using the default. An otherwise reusable, two-day-old object held only by the shared store is then deleted unnecessarily. This can cause avoidable recompilation; no incorrect game output or reported player incident is claimed.The parent searched the public corpus (265 issues, title/body; 230 complete public PR file lists) and admitted these two paths with no production/test intersection. No matching issue is claimed, and this is not a guarantee about private work.
How to reproduce
Seen on: Linux; GPU and driver unused.
Settings and switches:
LONGSHOT_OBJ_STORE_DAYS=NaN,LONGSHOT_OBJ_STORE_GB=8; alternatively days14and GBNaN.Steps: run
python -I -B tests/test_object_store_retention_values.py. The test authors a small.oplaceholder in its own temporary namespace, timestamps it two days before an explicitnow, and calls the realprunefunction. No human cache or compiled game object is touched.Expected: use the default 14 days or 8 GiB for NaN; preserve this object and report
(0, 0)removed/freed.Actual: pinned main reports
(1, 48)and deletes the object, becausemax(0.0, float("NaN"))yields zero.What changed
NaN now uses the existing default, just like an unparseable word. Finite limits and existing infinite-limit semantics are preserved.
nx2/object_store.py,_number: parse once, detectmath.isnan, otherwise retain the existing nonnegative clamp. No catch-all exception handling.tests/test_object_store_retention_values.py: six discovered tests exercise actual temporary filesystem pruning, both NaN settings, NaN spelling variants for GB, default age expiry, finite zero/negative/positive/fractional limits, invalid-word/empty fallback, and positive/negative infinities. Verify removed counts, freed bytes, existence and retained bytes.Measurements
Verdict: the observed accidental NaN eviction is fixed; correctness change only, so there is no performance measurement or median claim.
Flags and settings
No new settings or changed shipping defaults. Only invalid NaN handling changes for existing cache settings:
LONGSHOT_OBJ_STORE_DAYSLONGSHOT_OBJ_STORE_GBParser results for positive and negative infinity remain unchanged. This PR does not claim to fix other nonfinite behavior or introduce a new retention policy.
Testing
python -I -B tests/test_object_store_retention_values.py -vpasses all six methods (with their filesystem subcases); unchangedpython -I -B tests/test_object_store.pyexits 0. The latter is one top-level assertion script, not additional unittest methods. Tests ran in an accented path (épreuve) with private D: temporary files and no human cache access.Tested: commit
84b9eba764179bd391eca21131491303041de174, tree8df089da2be7bf8f94668ffce5b238d96da7ad12, direct parentd9486a0846e90905e2ee0bdc4a0d6df96c547c87.tests/test_object_store.pypasses. Normal discovery lists the new test.python -I -B tests/run_all.py --jobs 3: 538 passed, 22 failed, 92 skipped, 652 checks, native exit 1, 256.5460848270013 seconds wall time. No selection/skip override, isolated HOME/XDG/TMP, baseline-identical PATH, no compiler hiding; four C++ checks pass.test_bug_report.py,test_hardware_report.py) contain different absolute missing sibling Tooling paths. A separate literal replacement of only those exact paths makes them equal. All 22 signatures then match; no blanket claim that the baseline failures are upstream bugs, no CI-green claim..batcheckout CRLF conversion explicitly checked, not mislabeled full blob-byte equivalence.AGENTS.mdmaterialized; its original opaque index/tree entry preserved. Two unchanged SwitchesRemoved methods additionally pass with the public blob supplied only in memory. This is normal source-only runner qualification, not exact-tree hosted CI.Existing baseline failures retained:
tests/test_appimage_player_build.pytests/test_bake_portability.pytests/test_bug_report.pytests/test_crash_dialog.pytests/test_crt_options.pytests/test_env_on.pytests/test_guest_imported.pytests/test_hardware_report.pytests/test_lift_cleanup_error.pytests/test_link_skip.pytests/test_linux_update.pytests/test_make_game_cache.pytests/test_missing_nup.pytests/test_mods_size_table.pytests/test_options_budget_once.pytests/test_pending_guest_import.pytests/test_pipeline_tour.pytests/test_readback_late.pytests/test_run_all_changed.pytests/test_vk_occlusion_queries.pytests/test_vk_pgo.pytests/test_walk_key.pyNot tested: a real human cache, a game or GPU runtime, remote CI. These are game-free cache retention changes; game/GPU testing is not invented as an acceptance gate. No auth/API/push/publication action occurred.
Must be tested: None for the public-fixture regression; the Windows CLI checks above are complete. Production use and the other exclusions under Not tested remain unqualified.
Risks
What could break: a user who intentionally entered NaN to mean immediate eviction instead receives documented defaults. Explicit zero remains immediate eviction for non-recent unlinked objects; negative finite values retain their clamp. Recent-object and hard-link protections are untouched.
Turning it off: revert the commit.
Compatibility: no format, key, ABI, save, shader, runtime or shipping-default changes. Valid finite limits and parser infinity results are unchanged; no human cache was touched.
Checklist
Everyone
type(scope): description) of the status line's type.can't be run by hand is in Testing's Not testable by hand, with why. Not ticked yet: Testing's Tested names only game-free Windows CLI checks, and the change touches nx2/, which the game runs.
in Risks.
mainat frozen intake (d9486a0846e90905e2ee0bdc4a0d6df96c547c87). Public main has since advanced; no rebase to that later tip is claimed. Relevant source closure is checked again before publication, without transferring full-suite results to another tree.python -I -B tests/run_all.pyqualified against its exact pinned-main baseline: native exit 1 is preserved, all 22 existing failures are named above, and no new failure or changed skip status was found. This does not assert a wholly passing suite.third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.Existing settings and shipping defaults are unchanged; the new-switch documentation checklist item does not apply. This fixes the parser handling of invalid NaN values only.
mainand passing here.Source export scope: unchanged gpu/build-shadertool.bat has the recorded .gitattributes LF-to-CRLF conversion. Candidate production and test files match native Git blobs; source/modes are unchanged across each run. Tooling is absent in the isolated runner context: two corresponding failure messages require only an exact sibling-path substitution; the original strict comparison remains false. This is not hosted-CI or literal exact-tree equivalence.
Windows qualification caveats: Native CPython 3.14.7 used a new independent copy of an existing pinned-dependency runtime, not a venv or a replacement product runner. Each candidate used its own full frozen-head public Git-blob export (2652 tree entries; 2651 files materialized;
AGENTS.mdkept opaque and never materialized). Production/test SHA-256 and all exported file bytes were verified before/after; Git modes remain metadata, not a claim of POSIX permission semantics on NTFS. Normal public test sources and commands were unchanged. Full stdout/stderr and exact native executable/argv/cwd/exit records are retained. A post-test harness assertion exited 1 because five CPython encoding bytecode cache files appeared only in the new owned runtime copy; independent readback confirmed no existing runtime file changed, the original runtime stayed byte-identical, and all test invocations exited 0. No full Windows suite, real compiler, game, GUI, hosted CI or publication qualification is claimed. Existing Linux full-suite results above are unchanged and are not transferred to Windows.WIP: fix(cache): ignore NaN retention settingsto fix(cache): ignore NaN retention settingsCode-only review of
84b9eba764; informational findings, with final approval left to another reviewer.No introduced correctness defect found. The shared parser now rejects NaN before the nonnegative clamp, preserving the 14-day / 8-GB defaults instead of turning invalid input into immediate eviction. Finite limits, infinities, recent-object protection and hard-link protection retain their existing behavior.
The new tests exercise real temporary files through
prune(), checking removal counts, bytes and surviving contents. Reverting the NaN guard would break the two-day retention cases; the 15-day case also checks that invalid input does not disable age expiry. I read both changed files, the full pruning implementation and existing object-store tests. The tests' filesystem changes stay inside their temporary fixtures.The PR reports Linux and native Windows fixture passes, plus a Linux full-suite comparison with 22 baseline failures explicitly retained. I did not reproduce those results or run tests, builds or game code. No overlapping open change to this implementation was found in the supplied inventory; the fix is not already present in the inspected main revision.
Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
**Not testable by hand:**line saying why and what stands in for it. Then tick it.It goes back to WIP until Tested on my own PC can be ticked;
pr readyit again then.fix(cache): ignore NaN retention settingsto WIP: fix(cache): ignore NaN retention settingsView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.