Skip to content

LRC-SS-PLAYBACK: the slideshow prefetch test no longer races its simulated clock - #2861

Closed
nledford wants to merge 1 commit into
storytold:mainfrom
nledford:slideshow-prep-flake
Closed

nledford wants to merge 1 commit into
storytold:mainfrom
nledford:slideshow-prep-flake

Conversation

@nledford

@nledford nledford commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Off main.

Problem

tests_slideshow::next_slides_are_prepared_before_they_are_due fails under load. Run 60 times at 8 at once beside 4 busy loops on current main, it failed 51 times, every time at assert!(h.time() - start < 60.0, "before the first is due"), and passed 9. At 4 test threads it passes.

The cause is in the test, not the app. The headless harness advances its clock by 1/60 s per frame whatever the frame costs, and step_until sleeps 1 ms per frame. Waiting for the renders of the slide up and the next two therefore spans as many frames as the renders take in wall time. On a loaded machine they take seconds, so 3,600 frames (the slide's 60 s) pass before the renders land and the slide is due by the test's own clock. The app is right to move on then.

Change

The test pauses the slideshow right after starting it. A paused slide cannot come due however many frames pass, and wanted() in panels/slideshow.rs asks for the slides ahead whether or not playback is paused, so the test still checks that they are rendered and that the first slide is still up. The simulated-time assertion is removed. Raising the interval would not help: the engine caps a slide at 120 s (SLIDE_MAX), which is only twice the old margin.

The second half of the test (prepare off, not paused) is unchanged and does not depend on load: the slide's clock only starts once it is rendered, and it then runs 30 frames.

Not in this PR: any change to the app or to the harness's clock.

How it was checked

  • Before: The test on main, 60 runs of cargo test -p lightcraft-ui-egui --lib tests_slideshow::next_slides_are_prepared_before_they_are_due at 8 at once with 4 busy loops: 51 failed at the line above, 9 passed.
  • After, same load: 60 of 60 passed.
  • Forced race (throwaway, not committed): 8,000 extra h.step() calls (about 133 simulated seconds, the effect of a slow render) before the wait. The old test fails at before the first is due; the fixed test passes.
  • cargo xtask ci: all 8 steps passed (fmt, clippy, heif, test, parity, layers, assets, wasm).
  • A fresh reviewer read the final diff. It confirmed that a paused playback still prepares the slides ahead and that nothing else in the test depends on load. (An earlier version of the fix used a 3,600 s interval; the first reviewer showed the engine clamps it to 120 s, so it was replaced.)

Screenshots

None: test-only change.

Merging

Overlap: none. #2786 also touches tests_slideshow.rs but adds a different test; #2848 fixes a different slideshow test's layout shift. No new crates, no catalog or settings format change, no UI strings.

Checklist

  • Test-only; no docs or What's New entry needed

Summary by CodeRabbit

  • Tests
    • Updated slideshow coverage to verify that the current and upcoming slides render while playback is paused.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 38f8d25 and d5afc8b.

Files selected for processing: 1
  • crates/ui-egui/src/tests_slideshow.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

The slideshow test now pauses playback before checking that the current slide and both upcoming slides render. It also asserts that playback is paused and removes the elapsed-time assertion.

Changes: Slideshow rendering test

Layer / File(s) Summary
Check rendering while paused
crates/ui-egui/src/tests_slideshow.rs
The test pauses playback before checking the current slide and both upcoming slides. It asserts the paused state and removes the elapsed-time check.

Priority: Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: bitshiftza

Merge Risk: Minimal · up to d5afc

The test change preserves the intended slideshow prefetch coverage without changing production behavior.

Architecture risk: Low · up to d5afc

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/ui-egui/src/tests_slideshow.rs: The test now pauses the slideshow before checking that the current slide and both upcoming slides render, and asserts that playback is paused. It removes the elapsed-time check that required those renders to finish in under 60 seconds.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the slideshow prefetch test and the simulated-clock race it fixes. It is concise and specific.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Clippy (1.99.0)

Clippy execution timed out

Comment @coderabbitai help to get the list of available commands.

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff, which is test-only: the slideshow prefetch test pauses the slideshow so the slide cannot come due while a slow render spans many simulated frames, and the assertion that the renders finish before the first slide is due is dropped since pausing makes it meaningless. The remaining checks still require the current and next two slides to be rendered while the first stays up. That does mean the test no longer checks the timing of the preparation. Gate and SonarCloud are green at this head. I read the code and the CI results; the app was not run.

deunderscorepaul referenced this pull request in deunderscorepaul/lightcraft-classic Oct 25, 2026
…r races its simulated clock

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nledford

Copy link
Copy Markdown
Contributor Author

Closing this as superseded by #2975, which rewrote next_slides_are_prepared_before_they_are_due around a gated fixture: renders are held until the gate opens and then run inside one poll, so simulated time no longer spans them, which was the race this PR fixed.

Measured with the same stress run this PR used (60 runs, 8 at once, beside 4 busy loops): on the main of the time it failed 51 of 60, always at assert!(h.time() - start < 60.0, "before the first is due"); on today's main (662df66, with #2975) it passes 60 of 60.

@FredApps thanks for the approval; nothing here is needed any more.

@nledford nledford closed this Oct 27, 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.

2 participants