refactor(client): share filesystem browse navigation - #4797
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Co-authored-by: codex <codex@users.noreply.github.com>
f789747 to
a508142
Compare
ApprovabilityVerdict: Approved Mechanical refactor extracting shared filesystem browse navigation logic from web and mobile apps into the client-runtime package. The implementations are functionally equivalent with consistent call site updates and preserved tests. You can customize Macroscope's approvability policy. Learn more. |
What changed
Web and mobile independently derived filesystem browse paths and filtered directory entries, so the same behavior lived in both apps and had already drifted around hidden directories.
This follow-up moves the React-free browse model into
client-runtime: target-directory derivation, leaf filtering, parent navigation, hidden-directory visibility, and exact matches. It relocates the existing web deferred-navigation coordinator and preload policy beside that model. Web and mobile are now thin consumers that provide the current query and render the returned state; mobile keeps its existing immediate-navigation behavior without a second app-specific state machine.Mobile and web now expose hidden directories consistently when the typed leaf starts with
.. Desktop inherits the web behavior. No provider or wire-contract changes are involved.Diff accounting:
+126 / -140— net-14+70 / -64— net+6, consolidated underclient-runtime+196 / -204— net-8Validation
vp test run packages/client-runtime/src/state/filesystem.test.ts apps/web/src/components/CommandPalette.logic.test.ts— 10 tests passedvp run --filter @t3tools/client-runtime typecheckvp run --filter @t3tools/web typecheckvp run --filter @t3tools/mobile typecheckvp lint --report-unused-disable-directivesfor all changed filesvp run lint:mobile— SwiftLint, ktlint, and detekt passedvp fmt --checkfor all changed filesGPT-5.6-sol via the Codex harness in T3 Code.
Note
Low Risk
Refactor with behavior preserved via moved tests; no auth, RPC, or data-model changes—main risk is subtle browse UX regressions in add-project flows.
Overview
Moves filesystem browse logic out of web and mobile into
@t3tools/client-runtime/state/filesystem: path derivation (getFilesystemBrowsePath), entry filtering (filterFilesystemBrowseEntries), deferred navigation (createBrowseNavigationCoordinator), and browse preload gating (canPreloadBrowsePath).Web command palette and mobile add-project folder browser now call those helpers instead of duplicating browse-path math, filtering, and coordinator code in
CommandPalette.logic/AddProjectScreen. Browse-related tests move fromCommandPalette.logic.test.tstofilesystem.test.ts.Shared filtering aligns hidden-directory behavior (e.g. showing dot-prefixed folders when the typed leaf starts with
.) across platforms without wire or provider changes.Reviewed by Cursor Bugbot for commit a508142. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Share filesystem browse navigation utilities across mobile and web clients
getFilesystemBrowsePath,filterFilesystemBrowseEntries,createBrowseNavigationCoordinator, andcanPreloadBrowsePathtopackages/client-runtime/src/state/filesystem.tsas shared utilities.CommandPalette.tsxandAddProjectScreen.tsxto use these shared utilities instead of duplicated local logic.createBrowseNavigationCoordinator,canPreloadBrowsePath, andfilterBrowseEntriesfromCommandPalette.logic.tsalong with their tests.FolderBrowserare no longer sorted alphabetically; they now render in source order.Macroscope summarized a508142.