Skip to content

LRC-SS-LAYOUT: the Slideshow settings page no longer moves when the slide preview finishes rendering - #2848

Merged
aiongg merged 1 commit into
storytold:mainfrom
nledford:slideshow-flake
Oct 31, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
nledford:slideshow-flake

Conversation

@nledford

@nledford nledford commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Part of #3229

Off main.

Problem

tests_slideshow::playback_settings_drive_the_slideshow_and_bad_ones_are_refused fails on the hosted CI gate now and then, at the step_until after it clicks "Random order" (tests_slideshow.rs:245, "the checkbox goes through slideshow.playback"). It failed on runs 40117200403 (#2705), 40113566960 and 40113299031 (two other contributors' PRs), and once in a local full run. It passes alone, and 670fb9c (which made the test wait for the result instead of one frame) did not cure it: waiting didn't help because the click itself had missed.

The cause is a layout shift, not slowness. In Settings ▸ Slideshow the slide preview is pinned above the page, and settings::window takes the pinned block's height off the page's scroll area. slide_layout::preview returned early while the preview's render had not landed ("Rendering…"), which skipped the hint line under the preview. The render runs on a worker thread and lands on a frame nobody can name, so on that frame the pinned block grew by one line, the page's room shrank and everything in it moved down. A click made in that frame lands beside the control it aimed at. The test's reveal helper waits for the checkbox to hold still, but a render that is slow to land (a loaded CI runner) arrives after that.

Change

  • panels/slide_layout.rs: the preview's hint line is drawn while the preview is still rendering too, so the block has the same height before and after the render. Nothing else changes on screen.
  • tests_slideshow.rs: a new test, the_settings_page_does_not_move_when_the_slide_preview_finishes_rendering, holds the render back with RenderGate, lets it land, and checks that the page's room and the "Random order" checkbox keep their rectangles.
  • docs/whats-new.md: an entry.

The original test and the reveal helper are untouched: they are right once the page stops moving.

Not in this PR: the "Select a photo to preview its slide" state still has no hint line. Its height depends on the selection, not on a worker thread, so it cannot move under a click.

How it was checked

  • cargo xtask ci: the hosted CI gate passed at c32d776, the head rebased onto main's move of slide_layout.rs and tests_slideshow.rs (f6e6d5e); a line-by-line comparison of the old and new range shows no differing changed lines
  • A test that fails without this change: the new test fails on main: the page's room is the same before and after the render (left [[220.0 387.0] - [780.0 632.0]], right [[220.0 366.0] - [780.0 632.0]]), and passes with the change.
  • User-visible change: ran the app and looked at the result: not done; the egui test harness drives the page, and the settled page looks the same.
  • Forced race (a throwaway patch, not committed): the existing test with the renderer held back until just before its click. On main it fails at the same assertion, the checkbox goes through slideshow.playback, as on the hosted runs. With this change the same patch passes.
  • cargo test -p lightcraft-ui-egui --lib tests_slideshow: 19 passed (18 before, plus the new one).
  • Flaky counts on this Mac under load (4 runs at once beside 4 busy loops, 300 runs each): the original test passed 300 of 300 on main too, so a local run does not reproduce what a slow render on the hosted runner does (hence the forced race above), and 300 of 300 with this change. The new test: 300 of 300 with this change.
  • Markdown lint, spelling and link checks on the changed docs.
  • macOS-only paths: none touched.

Review: fresh reviewer at c32d776

Screenshots

None: the change is one hint line shown a moment earlier, and the settled page looks the same.

Merging

  • Overlap: none found. LRC-SS-PLAYBACK: a manual slideshow waits for the arrow keys #2786 also edits tests_slideshow.rs and panels/settings.rs (manual advance) but not slide_layout.rs.
  • Existing edits and libraries: unchanged: no catalog or settings-file change. A docs/whats-new.md entry under the 2026-10-24 heading.
  • Shared numbers taken: none.
  • New dependencies, unsafe, build scripts, network access, spawned processes, deleted files, CI or xtask gate changes: none (no new crates).

Checklist

  • No new panic path in non-test code
  • New text on screen goes through tr(): no new UI strings (the hint text is unchanged)
  • The feature's rows in docs/parity-checklist.md and its entry in docs/gaps.md: unchanged (a layout fix; docs/whats-new.md has the entry)
  • New code has a caller: no new code, only a changed early return
  • Every new image, icon or other asset has its entry: none added
  • Ready to merge: after cargo xtask ci passes and the review comments are settled

Summary by CodeRabbit

  • Bug Fixes

    • The explanatory text beneath the slide preview now appears immediately, including while the preview is rendering. This keeps slideshow settings in place as the preview loads and helps prevent clicks from landing on shifted controls.
  • Documentation

    • Updated the “What’s New” notes to describe the preview layout change and its effect on clicking settings.

@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 cb37e7b and c32d776.

Files selected for processing: 2
  • crates/ui-egui/src/dialogs/settings/slide_layout.rs
  • 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; 7 remain after this review.

Walkthrough

The Slideshow settings preview now displays its hint while a photo is rendering and after it appears. A regression test checks that the settings-page room and Random order checkbox do not move when rendering completes.

Changes: Slideshow preview layout

Layer / File(s) Summary
Render the hint consistently
crates/ui-egui/src/dialogs/settings/slide_layout.rs, crates/ui-egui/src/tests/slideshow.rs, docs/whats-new.md
The preview displays its hint in both render states. The regression test checks that two UI element positions remain unchanged after rendering. The What's New entry describes the layout shift.

Priority: Low

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • storytold/lightcraft issue 3229 describes the Slideshow preview layout shift moving a checkbox and canceling a click. This change addresses the same layout behavior.

Suggested reviewers: fredapps

Merge Risk: Minimal · up to c32d7

The slideshow layout change meets its stated objective without identified merge-blocking risk.

Architecture risk: Low · up to cb37e

The change affects 2 systems.

Changed systems: crates, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

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

Before / after behavior

  • observed — Modified behavior in crates/ui-egui/src/panels/slide_layout.rs: The preview defines a shared hint renderer and calls it in the pending-render path after drawing the backdrop and “Rendering…” message, before returning.
  • observed — Modified behavior in crates/ui-egui/src/panels/slide_layout.rs: The completed photo preview now calls the shared hint renderer instead of invoking hint directly.
  • observed — Modified behavior in crates/ui-egui/src/tests_slideshow.rs: Adds a regression test that opens Slideshow settings with rendering offloaded behind a gate, confirms the preview texture is absent, releases the render, and checks that the page room and random-order checkbox retain their original rectangles after the preview appears.
  • observed — Modified behavior in docs/whats-new.md: Adds a What's New entry stating that the Slideshow preview’s accompanying line appears immediately rather than after rendering, and describing the previous page shift.
Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing the Slideshow settings page from moving when the slide preview finishes rendering.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

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 change in slide_layout.rs. The hint line is now drawn on the Rendering placeholder path too, through one closure shared with the textured path, so the preview block keeps its height while the render lands. Nothing else changes. The gate and SonarCloud pass at this head. I read the code and CI and did not look at the page.

@nledford

Copy link
Copy Markdown
Contributor Author

This also fixes a second slideshow flake: tests_slideshow::a_manual_slideshow_waits_for_the_arrow_keys, which fails on main the same way when the Settings checkbox it clicks moves under the click.

Measured on this Mac: the test's binary run 100 times per build, 4 at a time, beside 4 busy loops:

Code Passed Failed
main bb08a697a4 94 6
main with this PR merged 100 0

The six failures on main: four ui.clickWidget canceled: widget check:settings.slideshowManual moved before its release and one "moved before its press" (both tests_slideshow.rs:206), and one the checkbox goes through slideshow.playback (tests_slideshow.rs:208). This PR's own head predates that test, so the second row is this PR merged onto current main (local merge, not pushed). No change to this PR.

nledford added a commit to nledford/lightcraft that referenced this pull request Oct 27, 2026
…s page no longer moves when the slide preview finishes rendering
nledford added a commit to nledford/lightcraft that referenced this pull request Oct 27, 2026
nledford added a commit to nledford/lightcraft that referenced this pull request Oct 28, 2026
…lide preview finishes rendering

The preview's hint line was drawn only after the render had landed, so the pinned preview block grew by a line on the frame the render arrived (a worker thread, so any frame) and the page below it moved down. A click made in that frame hit the wrong place: the gate's tests_slideshow::playback_settings_drive_the_slideshow_and_bad_ones_are_refused clicked "Random order" and the checkbox never changed.

The hint is drawn while the preview is still rendering too. A new test holds the render back, then lets it land, and checks that the page and a control keep their places.
@nledford

Copy link
Copy Markdown
Contributor Author

@FredApps this PR conflicted with main after the move of panels/slide_layout.rs to dialogs/settings/slide_layout.rs and of tests_slideshow.rs to tests/slideshow.rs (f6e6d5e), so I rebased it onto origin/main: new head c32d776. Nothing in the change is new: a line-by-line comparison of the old range against the new one reports 0 changed lines differing (apart from use/mod lines, also 0), and the one added test sits in crates/ui-egui/src/tests/slideshow.rs, beside the other slideshow tests, where the old file went. cargo check, clippy with -D warnings (with #2973's one-file clippy fix applied uncommitted) and the 26 slideshow tests pass on the new head. The PR is also a member of the integration PR #3074; its approved head there stays as it was.

@aiongg
aiongg merged commit c034f5b into storytold:main Oct 31, 2026
6 checks passed
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.

3 participants