Problem
Opening a folder with many files and deeply nested subdirectories can take a long time. The Explorer remains blank until its recursive scan finishes, so the extension can appear frozen.
Scope and outcome
Show an animated, indeterminate spinning progress indicator in the Explorer pane while a folder is being indexed. The status must be accessible, and scanning must yield enough for the browser to paint and process input. This issue retains eager full-tree indexing and existing file-fingerprint behavior; lazy directory expansion, pagination, and changes to fingerprint policy are out of scope.
Architecture decisions
- Transactional scan: Scan a selected or persisted directory handle into a local candidate index. Replace the live workspace handle, entries, files, fingerprints, and Git metadata only after the scan succeeds. Cancellation or a failed scan leaves the existing workspace usable and visible.
- Explicit lifecycle: Model
idle → scanning → ready | failed | cancelled; use finally to clear the loading state on every terminal path.
- Precise start signal: Add an API boundary (for example, an
onScanStart callback or separate handle-selection and scan operations) so the UI enters scanning after a handle is available and immediately before indexing—not while the directory picker is open. Apply the same lifecycle to openFolder() and openFolderFromHandle().
- Race safety: While scanning, disable actions that mutate or consume the workspace index. Guard completion with a monotonic request ID so a stale scan cannot replace a newer workspace.
- Cooperative scan: Yield to a browser task boundary before the first batch and after a bounded number of entries. The precise batch size is an implementation detail, but it must preserve deterministic final entries and fingerprints.
Implementation plan
Task 1: Define transactional scan and lifecycle contract
Refactor folder-open and persisted-handle scan paths to construct a local candidate snapshot, expose the scan lifecycle, and commit it atomically only after success.
Acceptance criteria:
Likely files: src/ui/filesystem.js, src/ui/session-persistence.mjs
Task 2: Add Explorer-pane progress UI
Render a dedicated loading row in the Explorer pane with an animated indeterminate spinner and aria-live status text such as Loading folder…. Show it only during scanning, remove it on every terminal state, and prevent workspace-dependent Explorer interactions during the scan.
Acceptance criteria:
Likely files: src/ui/toolbar.js, src/ui/index.html, src/ui/styles.css
Task 3: Make scanning cooperative
Yield during recursive indexing so the loading row paints before scanning and stays animated during large scans, while preserving the final sorted entries, file handles, and fingerprints.
Acceptance criteria:
Likely files: src/ui/filesystem.js
Task 4: Prove lifecycle, responsiveness, and compatibility
Extend the fake directory-handle tests with delayed, nested entries and add browser-level or manual verification for visible paint and animation.
Acceptance criteria:
Likely files: scripts/e2e-workspace-file-tracking.test.mjs, scripts/e2e-session-persistence.test.mjs, browser smoke-test support as needed.
Checkpoint
Risks and mitigations
| Risk |
Mitigation |
| Loader does not paint before synchronous scan work |
Yield to a browser task boundary immediately after setting scanning, then batch future yields. |
| A selected folder fails or is cancelled |
Keep all live workspace state unchanged until atomic commit. |
| Overlapping opens cause stale data |
Tie each scan to a request ID and ignore stale completion. |
| Large tree rendering is itself slow |
This issue addresses indexing feedback; profile rendering separately if it remains a bottleneck. |
Problem
Opening a folder with many files and deeply nested subdirectories can take a long time. The Explorer remains blank until its recursive scan finishes, so the extension can appear frozen.
Scope and outcome
Show an animated, indeterminate spinning progress indicator in the Explorer pane while a folder is being indexed. The status must be accessible, and scanning must yield enough for the browser to paint and process input. This issue retains eager full-tree indexing and existing file-fingerprint behavior; lazy directory expansion, pagination, and changes to fingerprint policy are out of scope.
Architecture decisions
idle → scanning → ready | failed | cancelled; usefinallyto clear the loading state on every terminal path.onScanStartcallback or separate handle-selection and scan operations) so the UI entersscanningafter a handle is available and immediately before indexing—not while the directory picker is open. Apply the same lifecycle toopenFolder()andopenFolderFromHandle().Implementation plan
Task 1: Define transactional scan and lifecycle contract
Refactor folder-open and persisted-handle scan paths to construct a local candidate snapshot, expose the scan lifecycle, and commit it atomically only after success.
Acceptance criteria:
Likely files:
src/ui/filesystem.js,src/ui/session-persistence.mjsTask 2: Add Explorer-pane progress UI
Render a dedicated loading row in the Explorer pane with an animated indeterminate spinner and
aria-livestatus text such asLoading folder…. Show it only duringscanning, remove it on every terminal state, and prevent workspace-dependent Explorer interactions during the scan.Acceptance criteria:
Likely files:
src/ui/toolbar.js,src/ui/index.html,src/ui/styles.cssTask 3: Make scanning cooperative
Yield during recursive indexing so the loading row paints before scanning and stays animated during large scans, while preserving the final sorted entries, file handles, and fingerprints.
Acceptance criteria:
Likely files:
src/ui/filesystem.jsTask 4: Prove lifecycle, responsiveness, and compatibility
Extend the fake directory-handle tests with delayed, nested entries and add browser-level or manual verification for visible paint and animation.
Acceptance criteria:
Likely files:
scripts/e2e-workspace-file-tracking.test.mjs,scripts/e2e-session-persistence.test.mjs, browser smoke-test support as needed.Checkpoint
npm run lintnpm run buildnpm run test:e2eRisks and mitigations
scanning, then batch future yields.