feat(explorer): quiet, repo-scoped keyword loading#55
Merged
Conversation
Switching files in the Explorer re-ran RobotEditor's file-switch watcher → explorer.refreshKeywords(), which invalidated the backend libdoc cache and refetched the whole repo keyword set every time — wasteful (keyword data is repo-scoped: the env's installed libraries and the repo's project keywords don't change between files) and it re-flashed the prominent full-width loading bar on each switch. - Repo-scoped idempotent cache: a new `keywordsRepoId` anchor lets `preloadKeywords` no-op when the repo is already cached; the file-switch watcher now "ensures loaded" instead of invalidating + refetching. Genuine invalidation (libraries-changed, install, save) still uses `refreshKeywords`. - Latest-wins scheduling so a fast repo switch mid-load isn't dropped; error path clears the anchor so it never advertises an unloaded repo. - Subtle loading indicator: a slim 2px indeterminate line + small muted label (role="status", reduced-motion aware) replacing the full-width bar — and it now only appears on first repo open, not per file switch. Three-reviewer pass (blind / edge-case / acceptance); findings folded in as patches. Unit tests pin idempotency, cross-repo reload, the race, and the error anchor. type-check + build + store suite + explorer/resource-ux e2e green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related Flow Editor / Explorer keyword-loading improvements (one cohesive change — same root cause), via the bmad-quick-dev flow (clarify → plan → implement → 3-reviewer pass → present).
Problem: Switching files re-ran
RobotEditor's file-switch watcher →explorer.refreshKeywords(), which invalidated the backend libdoc cache and refetched the whole repo keyword set on every switch — wasteful (keyword data is repo-scoped: installed libraries + project keywords don't change between files) and it re-flashed the prominent full-width loading bar each time.Changes
keywordsRepoIdanchor;preloadKeywordsno-ops when the repo is already cached. File-switch watcher now ensures loaded instead of invalidate+refetch. Genuine invalidation (libraries-changed, install, save) still usesrefreshKeywords.role="status", reduced-motion aware) replacing the full-width bar; now only appears on first repo open, not per file switch.Verification
Spec:
_bmad-output/implementation-artifacts/spec-keyword-loading-quiet-and-cached.md🤖 Generated with Claude Code