Repository navigation
fix(code-index): refresh status routing on workspace-folder changes - #1957
Conversation
Status routing only refreshed on active-editor changes, so a workspace-folder change that switched the selected workspace left the UI subscribed to the previous manager until the editor changed. Closes Zoo-Code-Org#1857
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (5)Check persistence and lifecycle invariants: awaited atomic writes, rollback or explicit partial-failure behavior, cross-window state consistency, stale listeners/watchers, cancellation, idempotency, and safe restart/resume without lost or d...⚙️ CodeRabbit configuration file Files:
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.⚙️ CodeRabbit configuration file Files:
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.⚙️ CodeRabbit configuration file Files:
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure.⚙️ CodeRabbit configuration file Files:
Act as an adversarial second-opinion reviewer.⚙️ CodeRabbit configuration file Files:
📝 SummarySummary by CodeRabbit
Walkthrough
ChangesCode-index status routing
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The workspace-change status routing is mergeable after normal checks; no actionable lifecycle failure remains established. 🚥 Pre-merge checks | ✅ 7 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (7 passed)
Full details: Lifecycle Resource CleanupExplanation The new workspace-folder listener can leak on initialization failure. Resolution Make
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Review statusThanks for contributing. This comment tracks the review sequence and the next action. Current step: Awaiting fresh human maintainer or CODEOWNER approval. Automated review is complete for the latest commit but does not replace human approval. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
WebMad
left a comment
There was a problem hiding this comment.
Looks good to me! Thanks for the contribution. See you in the next PRs :)
(Not a core contributor, just a reviewer)
Related GitHub Issue
Closes: #1857
Description
CodeIndexStatusManagernow also subscribes tovscode.workspace.onDidChangeWorkspaceFoldersand routes it through the existingupdateSubscription(), so a workspace-folder change that changes the selected workspace switches the progress subscription and publishes the new manager's status immediately, without waiting for an active-editor change.updateSubscription(), whose "same manager" early return also prevents duplicate subscriptions and redundant publications when the selection doesn't change.dispose()releases it between the editor and progress subscriptions, and each cleanup is logged independently, so a failing cleanup doesn't stop the others; repeated disposal stays safe.Acceptance criteria → tests in
code-index-status-manager.spec.ts:switches to the newly selected workspace on a workspace-folder change alonekeeps the subscription when a workspace-folder change leaves the selection unchangedreleases the subscription when a workspace-folder change leaves no workspacereleases the workspace-folder listener on disposal even when its cleanup failsThe local
vscodemock gainsworkspace.onDidChangeWorkspaceFolders; the first test resolves the workspace through the real resolver by changingworkspaceFolders, with no editor event.Test Procedure
Run from
src/:pnpm exec vitest run services/code-index/__tests__/code-index-status-manager.spec.ts— before the fix the 4 new tests fail (no folder subscription exists); after it, 16/16 pass.pnpm exec vitest run __tests__/extension.spec.ts services/code-index— 36 files, 848 tests pass.pnpm exec vitest run(full suite) — 9,899 passed; the only failures are the 40 in__tests__/dist_assets.spec.ts, which check for build output indist/and fail identically onmainwithout a build.pnpm check-types✅,pnpm lint✅ (--max-warnings=0,eslint-suppressions.jsonunchanged), Prettier ✅.Not run: the manual multi-root VS Code scenario from the issue. The regression is covered by the deterministic unit tests above.
Pre-Submission Checklist
Visual Snapshots
N/A, no UI change.
Videos (interaction / animation only)
N/A.
Documentation Updates
Additional Notes
None.
Get in Touch
Discord: tosin.py