Skip to content

fix(effects): bound simulation checkpoint retention (#1238) - #1354

Closed
LabDennis wants to merge 1 commit into
storytold:mainfrom
LabDennis:fix/bounded-simulation-checkpoints
Closed

LabDennis wants to merge 1 commit into
storytold:mainfrom
LabDennis:fix/bounded-simulation-checkpoints

Conversation

@LabDennis

@LabDennis LabDennis commented Oct 13, 2026 •

Copy link
Copy Markdown

Long simulation seeks collected every 15-step snapshot before eviction. The final one-time thinning could still leave more than the intended 256 checkpoints, and peak state storage grew with the entire seek distance.

Refs #1238: addresses checkpoint accumulation and the retained-count limit.

One insertion helper now enforces the 256-checkpoint limit both while generating snapshots and while merging them into a cache entry. It drops off-grid targets first, thins aligned snapshots when needed, and keeps the new exact target. The simulator still executes the same steps and returns the same state; repeated requests for the latest target reuse its Arc directly.

Validation on Windows / Rust 1.95, upstream 549e9d82:

  • Both new regressions fail with the original production code because the retained checkpoint count exceeds 256.
  • All 457 Effects tests pass, including particle/simulation image hashes. The final cache tests and strict all-target Effects Clippy also pass.
  • An instrumented small synthetic state verifies retained counts and a peak bound of 514 live states across sequential warm-cache seeks (up to 256 old snapshots + 256 fresh snapshots + working state/pending clone). No large particle buffers or memory-exhaustion tests are needed.
  • Forward/backward seeks, repeated targets and key eviction match a fresh deterministic simulation.
  • Formatting, assets, layers and the full WASM gate (32 crates, one existing UI dead-code warning) pass. Full xtask ci stops at the unchanged collapsible_match finding in crates/model/src/stl.rs:179; this PR does not claim a green full workspace CI run.

The limit counts snapshots, not bytes: variable-sized states and concurrent runs still need a broader memory-budget design. Very large advances still execute synchronously and are not cancellable. Those remaining parts of #1238 are deliberately not marked closed by this focused fix.

Upstream main, issue status and open PRs were checked before publication. Existing broad performance PR #856 changes plane transposition in the same source file but does not touch SimCache; #885 also does not provide this checkpoint fix.

The branch is now based on upstream 05955c08b4fd. History: 1 → 1 commits. The rewritten file tree was checked against the previous PR plus current upstream, preserving prior integration resolutions.

Scoped Windows regression checks: 1 passed, 0 ignored, zero failures. Formatting, locked Cargo metadata, asset and layer checks passed. This is scoped validation, not a new full-workspace or cross-platform CI claim.

@LabDennis
LabDennis force-pushed the fix/bounded-simulation-checkpoints branch from c8eb9f9 to ab4269f Compare October 14, 2026 17:33
@LabDennis LabDennis closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant