Skip to content

feat(explorer): quiet, repo-scoped keyword loading#55

Merged
raffelino merged 1 commit into
mainfrom
feat/keyword-loading-quiet-and-cached
Jun 19, 2026
Merged

feat(explorer): quiet, repo-scoped keyword loading#55
raffelino merged 1 commit into
mainfrom
feat/keyword-loading-quiet-and-cached

Conversation

@raffelino

Copy link
Copy Markdown
Collaborator

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

  • Repo-scoped idempotent cache — new keywordsRepoId anchor; preloadKeywords no-ops when the repo is already cached. File-switch watcher now ensures loaded instead of invalidate+refetch. Genuine invalidation (libraries-changed, install, save) still uses refreshKeywords.
  • Latest-wins scheduling — a fast repo switch mid-load is no longer silently dropped; error path clears the anchor so it never advertises an unloaded repo. (Both from the review pass.)
  • Subtle indicator — slim 2px indeterminate line + small muted label (role="status", reduced-motion aware) replacing the full-width bar; now only appears on first repo open, not per file switch.

Verification

  • type-check clean · prod build clean
  • store unit suite 10/10 (idempotency, cross-repo reload, refresh-forces-reload, race, error-clears-anchor, clearAll)
  • e2e (explorer + flow-editor-resource-ux) 32/32

Spec: _bmad-output/implementation-artifacts/spec-keyword-loading-quiet-and-cached.md

🤖 Generated with Claude Code

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>
@raffelino raffelino merged commit e91a576 into main Jun 19, 2026
9 checks passed
@raffelino raffelino deleted the feat/keyword-loading-quiet-and-cached branch June 19, 2026 08:10
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.

1 participant