Skip to content

Local: skip offscreen folder widgets and show browsed hidden paths - #3045

Merged
aiongg merged 2 commits into
storytold:mainfrom
dotCooCoo:fix/local-skips-windows-hidden-folders
Oct 27, 2026
Merged

aiongg merged 2 commits into
storytold:mainfrom
dotCooCoo:fix/local-skips-windows-hidden-folders

Conversation

@dotCooCoo

@dotCooCoo dotCooCoo commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Local skips interactive widgets for offscreen folder rows and reuses cached folder listings through Arc. Offscreen rows remain registered for scrolling, and expanded folders retain their child rows.

Folder walks, nonrecursive browsing, import scanning, and Local use shared hidden-entry checks. The checks exclude dot-prefixed names, Windows FILE_ATTRIBUTE_HIDDEN, and macOS UF_HIDDEN. An explicitly browsed folder below a hidden ancestor gets a session root in Local. Browsing below that root retains it until the user moves elsewhere.

Services::local_places lets headless tests supply their own places. The panel tests use an empty list; the desktop app uses the host's home folder and built-in places.

Tests cover a 500-row viewport, injected places, session roots below hidden ancestors, hidden directory listings, and bounded folder walks. The viewport regression fails with culling disabled because all 500 rows create interactive widgets. All 13 Local tests and four folder-walk tests passed on Windows. The original local_photos_cannot_be_added_to_albums_until_they_join_my_photos regression passed in 1.86 seconds.

The Windows hidden-attribute branch was exercised with attrib +h. The macOS branch has a conditional chflags hidden test, but it has not been run on macOS here.

The Windows gate completed all eight stages on main 662df66f plus this change: 5,214 reported passes, zero failures, and 42 ignored tests. Of those passes, 149 returned early for unavailable corpus, model, font, GPU, or system resources. The validation worktree also included the separate fixes from #2746, #2547, #2723, #2627, and #3020. Those fixes are not included in this branch. A headless screenshot shows the selected session root below a hidden ancestor.

Merge checks covered 130 other open PRs touching current or former paths changed here. Compared with their conflicts against main, this branch adds conflicting paths with #2459 and #3074 in crates/engine/src/walk.rs, #2478 in crates/engine/src/cmd/browse.rs, and #3055, #3077, and #3080 in crates/ui-egui/src/dialogs/import/scan.rs. #2478 and #3074 already conflict with main in other files.

Summary by CodeRabbit

  • New Features
    • Local browsing can use explicitly configured locations; otherwise, it uses the host’s home folder.
  • Bug Fixes
    • Hidden files and folders are now identified using platform hidden attributes as well as dot-prefixed names, and are excluded from browse and folder listings.
    • Dot-prefixed files that are not marked hidden by the platform can now appear if they meet the supported-file criteria.
    • Hidden folders no longer show rows or context menus in the folder panel.

…ppData

The Local trees left out folders whose names start with a dot, but on
Windows a folder is hidden by its attribute. Home's tree listed
AppData, and browsing a folder inside the temp folder opened Home's
tree down through AppData\Local\Temp, drawing one row for every folder
there on each frame. On a machine with 148,400 folders in Temp each
frame took about 4 s, and
tests_panels::local_photos_cannot_be_added_to_albums_until_they_join_my_photos
timed out on its ui.drag.

list_subfolders now also skips folders with FILE_ATTRIBUTE_HIDDEN set.
Test: panels::left::tests::subfolders_leave_out_hidden_folders.
@coderabbitai

coderabbitai Bot commented Oct 26, 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 1bb11ff and d826e79.

Files selected for processing: 9
  • apps/lightcraft-web/src/web.rs
  • apps/lightcraft/src/session.rs
  • crates/engine/src/cmd/browse.rs
  • crates/engine/src/walk.rs
  • crates/ui-egui/src/dialogs/import/scan.rs
  • crates/ui-egui/src/panels/left/folders.rs
  • crates/ui-egui/src/panels/left/local.rs
  • crates/ui-egui/src/services.rs
  • crates/ui-egui/src/tests/panels.rs

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

Walkthrough

The change adds injectable Local places, expands hidden-entry detection to platform metadata, and applies hidden-entry checks to browsing and folder listings. Local-place selection accounts for unlisted ancestors, and the folder tree skips rendering offscreen rows.

Changes: Local Browsing and Hidden Entries

Layer / File(s) Summary
Detect and filter hidden entries
crates/engine/src/walk.rs, crates/engine/src/cmd/browse.rs, crates/ui-egui/src/dialogs/import/scan.rs
Hidden-entry checks now include dot-prefixed names and platform-specific metadata. Engine browsing and import scans filter entries using the shared check.
Configure Local places and select eligible roots
crates/ui-egui/src/services.rs, apps/lightcraft-web/src/web.rs, apps/lightcraft/src/session.rs, crates/ui-egui/src/panels/left/local.rs, crates/ui-egui/src/tests/panels.rs
Services accepts optional Local places, and initializers set the field. Local-place selection uses injected locations and accounts for unlisted ancestors when choosing roots and owners.
Filter folder listings and render visible rows
crates/ui-egui/src/panels/left/local.rs, crates/ui-egui/src/panels/left/folders.rs
Subfolder listings filter hidden entries. The folder tree skips rows and context menus when out_of_sight is true.

Priority: Normal

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

Change: Feature

Suggested reviewers: aiongg

Merge Risk: Minimal · up to d826e

Hidden-entry filtering is consistent across the examined browse paths, and no merge-blocking issue remains identified.

Security architecture risk: Low · up to d826e

The inspected changes preserve existing filesystem authority and do not demonstrate a new security vulnerability. Shared filtering and session-root selection deserve attention because platform-specific behavior and interrupted or failed lookups remain only partly validated.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected exposure remains within filesystem operations available to the running application. The caller still chooses the starting directory; recursive traversal retains depth and entry bounds, canonical skip checks, and symlink-loop protection.

Security Findings and Attack Paths

  • inferred — No new authority escalation is demonstrated by the inspected entrypoints. Configured roots affect presentation rather than restricting browse authority, and folder browsing or filesystem-changing menu actions remain explicitly user-triggered. A temporarily stale root therefore does not establish a new authorization bypass.

Trust Boundaries and Controls

  • observed — Viewport culling skips interactive folder-row construction, not authorization checks. Offscreen rows retain layout and scroll registration, and expanded-child traversal remains outside the visibility guard. Culling itself does not issue a browse command.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv… 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 and concisely describes the two main changes: skipping offscreen folder widgets and displaying browsed paths below hidden folders.
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 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 21 functions across 9 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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.

Reviewed at SHA 1bb11ff.

What it does: list_subfolders now also leaves out folders that carry the Windows hidden attribute (such as AppData), using a #[cfg(windows)] hidden_attribute helper. On other platforms the helper returns false, so behaviour there is unchanged. This stops Local's Home tree opening down through AppData into the temp folder, which made local_photos_cannot_be_added_to_albums_until_they_join_my_photos time out on Windows.

Checked: the filter is applied alongside the existing dot-name rule, and metadata() errors count as not hidden. The new test creates Shown, .dot and Hidden folders, sets the attribute with attrib +h on Windows and expects only Shown there (Hidden and Shown elsewhere). It cleans up afterwards.

Not verified: I did not run this on Windows, and the hosted run is the Linux gate, so the Windows-specific path and test are unexercised by it. The test shells out to attrib, which exists on all Windows installs. The approval rests on the hosted checks being green at this head.

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

Thanks for tracking this down on Windows; the 148k-folder Temp explanation is spot on. I don't think hiding AppData fixes it, though. Two things made that test slow, and both survive this PR:

  1. Local's tree draws every row every frame. folder_tree (panels/left/folders.rs) has no out_of_sight culling, which the Library-folders and Keywords trees got in #1011, and fs_cached clones the listing each frame. Any big folder that isn't hidden (a dated photo archive, a busy Downloads) gives the same multi-second frames on every OS. Culling plus an Arc'd listing would fix the whole class.
  2. The test depends on the machine's home folder. On Windows temp_dir() is under USERPROFILE, and Local builds Home from the real home, so the test's speed depends on what's on the machine. Could the headless harness inject Local's home/places (e.g. through Services) so the test is hermetic?

Hiding attribute-hidden folders is still a nice behaviour, but then I'd like it to be one helper used everywhere we decide "hidden": engine/src/walk.rs, cmd/browse.rs and dialogs/import/scan.rs still check only for a leading dot. It should probably include macOS's UF_HIDDEN (~/Library) too.

The "Not in this PR" case also matters more on Windows now: browsing anything under %TEMP% (common for photos opened from a zip) leaves no highlighted row in Local, because Home owns the path but its tree stops at the hidden AppData. If local_places treated a browsed folder inside an unlisted (dot or hidden) folder as outside that place, it would get its own session root on every platform.

The new test only exercises the Windows branch on Windows, and the gate runs on Ubuntu. Also needs a rebase: list_subfolders moved to panels/left/local.rs.

Reuse cached folder listings through Arc and allow tests to inject Local places.
Show browsed folders below hidden ancestors as session roots. Apply the same
hidden-entry checks to folder walks, browsing, import scanning, and Local.
@dotCooCoo dotCooCoo changed the title Local: on Windows the folder trees leave out hidden folders such as AppData Local: skip offscreen folder widgets and show browsed hidden paths Oct 27, 2026
@dotCooCoo

Copy link
Copy Markdown
Contributor Author

Local now skips offscreen interactive widgets and shares its cached listings through Arc. The panel test harness supplies Services::local_places instead of reading the host's home folder.

Folder walks, browsing, import scanning, and Local share the hidden-entry helper. It checks dot-prefixed names, Windows hidden attributes, and macOS UF_HIDDEN. Browsing below an unlisted folder creates a selected session root. The changes use the extracted panels/left/local.rs and folders.rs modules.

The 500-row regression fails with culling disabled. All 13 Local tests, four folder-walk tests, and the original panel-drag regression passed on Windows. A headless screenshot shows the selected session root below a hidden ancestor. The macOS attribute test has not been run on macOS here.

The Windows gate completed all eight stages: 5,214 reported passes, zero failures, and 42 ignored tests. The pass count includes 149 tests that returned early for unavailable resources. Validation included the separate fixes from #2746, #2547, #2723, #2627, and #3020; this branch does not include them.

deunderscorepaul referenced this pull request in deunderscorepaul/lightcraft-classic Oct 27, 2026
…der tree

Ported from upstream #3045.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aiongg
aiongg merged commit 07bc200 into storytold:main Oct 27, 2026
6 checks passed
THEtheChad added a commit to THEtheChad/lightcraft that referenced this pull request Nov 2, 2026
…s a dangling one

Pins the rest of the watched folder's listing next to the hidden cases:
a symbolic link to a file is listed (as the file it names), a link to a
folder is not a file, and an entry whose metadata can't be read (a
dangling link) is left out without failing the listing. Unix only: making
links on Windows needs a privilege.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
THEtheChad added a commit to THEtheChad/lightcraft that referenced this pull request Nov 5, 2026
…mport skips hidden files

Follow-up to storytold#3045. `is_hidden_entry` read every entry's metadata to see
its hidden attribute: free on Windows, where the listing carries it, but an
lstat per file on macOS (a round trip each on a network share), which the
walk module says it avoids. The attribute is now read for folders only on
macOS (the cases that matter: ~/Library and friends hide whole trees) and
for every entry on Windows; dot names are hidden everywhere. The walk passes
the folder bit it already has from the listing.

Auto import listed only non-dot names, so a file with the Windows or macOS
hidden attribute was imported; it now checks the metadata it already reads
(`walk::is_hidden_with`). The platform bits and the read rule are a pure
`HiddenAttribute` tested on every platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
THEtheChad added a commit to THEtheChad/lightcraft that referenced this pull request Nov 5, 2026
…s a dangling one

Pins the rest of the watched folder's listing next to the hidden cases:
a symbolic link to a file is listed (as the file it names), a link to a
folder is not a file, and an entry whose metadata can't be read (a
dangling link) is left out without failing the listing. Unix only: making
links on Windows needs a privilege.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
THEtheChad added a commit to THEtheChad/lightcraft that referenced this pull request Nov 5, 2026
…the file's size

The listing test compared only paths; list_auto_import_folder also returns
sizes, read through the link. shown.jpg now has a size of its own, and the
test checks each (path, size) pair, so a link listed with the link's own
size (the length of the path it holds) fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
THEtheChad added a commit to THEtheChad/lightcraft that referenced this pull request Nov 5, 2026
…into it

On macOS a walk read the hidden flag only for entries listed as folders,
and a link is listed as a link, so a Finder-hidden link to a folder was
followed and its files walked. A link's own flag is now read like a
folder's: one lstat per link, still none per file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
THEtheChad added a commit to THEtheChad/lightcraft that referenced this pull request Nov 7, 2026
…ribute

list_auto_import_folder read the hidden attribute from fs::metadata, which
follows a link, so on macOS and Windows a hidden link to a visible photo was
listed and a visible link to a hidden photo left out, unlike a folder walk.
A link's own name and attribute now decide (walk::is_hidden_entry); the
target's metadata still gives its type and size.
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.

4 participants