Skip to content

LR-BEHAV-SIDEBAR-SECTIONS: Folders sits above Local in the sidebar - #3895

Open
nledford wants to merge 2 commits into
storytold:mainfrom
nledford:sidebar-folders-above-local
Open

nledford wants to merge 2 commits into
storytold:mainfrom
nledford:sidebar-folders-above-local

Conversation

@nledford

@nledford nledford commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Off main.

Problem

The sidebar lists Albums, Local, By Date, Folders, Keywords. Folders is the library's own tree of imported folders, the thing a person reaches for after Albums, but it sits below Local (a browser for any folder on the disk) and By Date. A new library should list it right under Albums. A person who already has the old order must not be left behind, and a person who arranged the sidebar themselves must not have it rearranged.

Change

  • A new sidebar, and Reset Sidebar Sections, list Albums, Folders, Local, By Date, Keywords (SidebarSection::ALL).
  • Saved layouts move once. UiState has a new sidebarOrderVersion (absent in settings files saved before this: read as 0). On load, UiState::sanitized calls SidebarLayout::adopt_order_version: a layout that is exactly the old usual order (Albums, Local, By Date, Folders, Keywords; hidden and folded flags ignored when comparing) gets Folders put just above Local, every hidden and folded flag kept. sanitized then records the current version.
  • The version is what makes the move happen once: a person who later drags Folders back below Local is saved with version 1 and is not moved again at the next start. Any other order is left as it is, and so is a layout from a newer build (its version is kept, not lowered).
  • Reading stays lenient: a corrupt or partial sidebar list is made whole as before (unknown and repeated entries dropped, missing sections follow in the usual order), and a sidebarOrderVersion that is not a whole number reads as 0 instead of failing the whole settings file.
  • docs/whats-new.md has an entry; docs/parity-checklist.md rows LR-BEHAV-SIDEBAR-COLLAPSE, -SECTIONS, -HIDE, -REORDER and LRC-LIB-LIBFOLDERS name the new order and the one-time move. No new strings, so no locale catalog changes.

Not in this PR: the sidebar's other section changes (an empty Folders offering the import, the "By Keyword" heading, the Local hover line); they are separate PRs. A layout that only looks like the old order (a partial list that is made whole into something else) is not moved: only the exact old usual order is. Someone who deliberately saved the old usual order before this version is moved once too, because a saved file cannot tell it from the old default; dragging Folders back keeps it.

How it was checked

  • cargo xtask ci passes on this branch, rebased on current main (a draft: the full run is the hosted gate's) (hosted CI gate passed at 019ea2d)
  • A test that fails without this change: each of the 7 new tests failed on the old behavior, seen on a throwaway branch: with the old section order and a no-op migration, 5 of the 7 failed (an_old_default_order_moves_once, a_partial_or_damaged_list_does_not_panic_and_still_lists_every_section_once, a_sidebar_in_the_old_usual_order_gets_folders_above_local_once, an_arranged_or_new_sidebar_is_not_moved, the_sidebar_lists_folders_above_local); with a migration that ignores the saved order and version and a strict version reader, the other 2 and 3 of the same 5 failed (a_custom_order_is_left_alone, a_corrupt_order_version_or_list_does_not_lose_the_settings). The updated a_new_sidebar_shows_every_section_open_in_the_usual_order, a_section_moves_above_another_or_to_the_end and a_section_moves_one_place_among_the_shown_ones failed on the old order before the change. The assertion that a newer saved version is kept failed when sanitized set the version instead of keeping the larger one
  • User-visible change: ran the app (release build on this Mac, demo library with --memory, scratch settings, control channel only) and looked at the result
  • cargo check --workspace --all-targets and the workspace clippy lints pass; cargo fmt --check is clean; cargo xtask parity passes; the whole lightcraft-ui-egui test suite passed at the first commit (1919 unit tests and the 32 integration tests in tests/it, 4 ignored measurements), and after the second commit the sidebar, header-drag and new tests (38 unit tests, 3 integration) pass again. One unrelated test (find_similar::stopping_leaves_the_view_alone_and_the_next_search_reads_only_the_rest) failed once under load in the first full run and passed alone and in the second full run
  • Review: reviewer subagent at 019ea2d (delta of 06deebd, which the first reviewer read with no P1 or P2: one test assertion and the new field's place in the struct; the second reviewer found no P1 or P2)

Screenshots

Before and after, demo library (--memory), scratch settings, 1280 × 1000 points. "Before" is the old usual order, set through ui.set, which is what a saved layout of an older version holds.

Before After
Before: Albums, Local, By Date, Folders, Keywords After: Albums, Folders, Local, By Date, Keywords

Merging

Checklist

  • No new panic path in non-test code: no unwrap / expect / panic!, no indexing or unchecked arithmetic on a number from a file, a person or an agent (get, checked_mul, NaN and char boundaries handled)
  • New text on screen goes through tr() and has its key in crates/ui-egui/locales/*.json; a new shortcut is free in docs/library-shortcuts.md (no new text, no new shortcut)
  • The feature's rows in docs/parity-checklist.md and its entry in docs/gaps.md are updated, honestly (rows updated; docs/gaps.md has no entry for the sidebar's order)
  • New code has a caller: no command, module or setting that nothing reaches yet
  • Every new image, icon or other asset has its entry in assets/ATTRIBUTION.md; no font or media files added
  • Ready to merge (otherwise open it as a draft)

Summary by CodeRabbit

  • New Features
    • Folders now appears immediately after Albums in the sidebar’s default and reset order.
    • Existing sidebars using the previous default order are updated once, while custom arrangements and hidden or collapsed sections are preserved.

nledford and others added 2 commits November 6, 2026 17:42
A new sidebar lists Albums, Folders, Local, By Date, Keywords. Settings saved in the
old usual order get Folders moved above Local once, keeping hidden and folded flags;
a version marker (sidebarOrderVersion) keeps a Folders dragged back from moving again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A settings file written by a newer build keeps its generation (the test pins it); the
new field sits after collapsed_sidebar so it does not touch the lines beside the
sidebar's other fields.

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

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The sidebar’s default order now places Folders after Albums and before Local. Saved layouts matching the previous default order migrate once, while custom arrangements and section visibility and collapsed states remain unchanged.

Changes: Sidebar order update

Layer / File(s) Summary
New order and generation-aware migration
crates/ui-egui/src/sidebar.rs, crates/ui-egui/src/state.rs
The default order places Folders before Local. The migration moves Folders before Local only when the saved generation is 0 and the completed order matches the previous default. State stores the generation and parses invalid or out-of-range values as 0.
Sanitization, tests, and documentation
crates/ui-egui/src/state.rs, crates/ui-egui/src/tests/panels.rs, docs/parity-checklist.md, docs/whats-new.md
Sanitization applies the saved generation and records at least the current generation. Tests and documentation cover migration, preserved section flags, custom orders, and the new default and reset order.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: aiongg

Merge Risk: Minimal · up to 019ea

No actionable merge-blocking issue is established for the sidebar order change. It is mergeable subject to normal checks.

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 describes the main sidebar order change.
Docstring Coverage Passed Docstring coverage is 91.67% 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. Documentati…
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 91.67% 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 12 functions across 3 files. (2 skipped: 2 unsupported.)

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8a0b91a and 019ea2d.

Files selected for processing: 5

  • crates/ui-egui/src/sidebar.rs
  • crates/ui-egui/src/state.rs
  • crates/ui-egui/src/tests/panels.rs
  • docs/parity-checklist.md
  • docs/whats-new.md

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

@vangel76 vangel76 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed 019ea2dc. No findings in the submitted change. I traced the one-time sidebar migration through settings load and checked default, manually ordered, and newer saved layouts. The submitted branch currently conflicts with main.

Source review only. I did not build the project, run tests, or check CI.

@wanikhawar wanikhawar 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.

This conflicts with main now. Please rebase so CI can run on the merged result.

This branch has not been deployed

No deployments
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