Fix #799: use custom scheme for builder changed-file resourceUri#867
Conversation
The Builders view's changed-file rows render through `BuilderFileTreeItem.resourceUri`, which was a `file:` URI pointing into `.builders/<id>/…`. VSCode queries every registered FileDecorationProvider for every `file:` URI rendered anywhere in the editor — including the built-in Git decorator. Git sees the gitignored worktree path and tints the label with `gitDecoration.ignoredResourceForeground` (grey), winning the color merge against our SCM-style status colors, so Added isn't green, Modified isn't yellow, etc. Switch the scheme on these tree-item URIs to a custom `codev-builder-diff:` so the built-in Git decorator never fires on them. The file-type icon still resolves because `IFileIconTheme` keys off basename, not scheme. `BuilderDiffCache` builds URIs via the same factory and keys decorations by `uri.toString()` so the change event matches what the tree row carries (otherwise stale decorations leak across file-list refreshes). Adds 5 regression cases under `src/test/builder-file-tree-item.test.ts` asserting the scheme is non-`file`, decoration lookups match the helper-built URI, and the change event carries the custom scheme. [Bugfix #799]
Architect Integration ReviewSingle-model integration review (medium-risk PR per triage: 231/17 lines across 5 files, touches shared decoration infrastructure). Claude consult: APPROVE / HIGH confidence. Verified
Cross-cutting note (non-blocking, for #810)This PR locks in When #810 reaches spec phase, the spec should explicitly call out the scheme decision: stay with parallel schemes (current direction) or refactor both into a single namespaced scheme (e.g. Minor observation (non-blocking, optional follow-up)
Unchecked test-plan itemThe PR's visual confirmation in a running VS Code session is unchecked. The unit tests cover the URI scheme behavior and the consult validated the system-level impact, so the platform-behavior assumption (VS Code's Git decorator skips non- VerdictApproved. Please merge with: Architect integration review |
Summary
BuilderFileTreeItem.resourceUrifromfile:to a customcodev-builder-diff:scheme so VSCode's built-in Git FileDecorationProvider stops firing on these rows and overriding our SCM-style colors withgitDecoration.ignoredResourceForeground(grey).builderFileResourceUri(worktreePath, rel)helper used by bothBuilderFileTreeItemandBuilderDiffCache.syncDecorations, and switches the decoration map's keying touri.toString()so the URI fired throughonDidChangeFileDecorationsmatches what the tree row carries.src/test/builder-file-tree-item.test.ts) covering the scheme, the decoration lookup, and the change event.Fixes #799.
Why custom scheme
VSCode's
IDecorationServiceis global — every registeredFileDecorationProvideris queried for everyfile:URI rendered anywhere in the editor. For our changed-file rows pointing into gitignored.builders/<id>/…, the built-in Git decorator wins the color merge (it contributes no badge, so ours stays — but itsignoredResourceForegroundtint clobbers our status color). Using a non-file:scheme is the canonical workaround:IFileIconThemekeys off basename so the file-type icon still resolves, and Git's decorator only acts onscheme === 'file'.No
TextDocumentContentProvideris registered for the new scheme — these URIs are markers for the tree row only. The diff is opened via the existingcodev.openBuilderFileDiffcommand, which builds explicit left/right URIs and is unaffected by the scheme change.Test plan
pnpm exec tsc --noEmitcleanpnpm lintcleanpnpm test:unit(vitest) → 34/34 passingpnpm test(vscode-test) → 83/83 passing, includes the 5 new cases