diff --git a/packages/extension/src/sidebar_bridge.ts b/packages/extension/src/sidebar_bridge.ts index e45a0067..310dcaee 100644 --- a/packages/extension/src/sidebar_bridge.ts +++ b/packages/extension/src/sidebar_bridge.ts @@ -52,10 +52,6 @@ export interface TreeEntry { type: "file" | "directory"; path: string; gitStatus?: "modified" | "added" | "deleted" | "untracked" | "ignored" | "conflict"; - /** Discriminant for the environment root row (#885). */ - entryKind?: "environment-root"; - /** Environment slug for coloring the environment root row (#885). */ - environmentSlug?: string; } // ── File operation types ───────────────────────────────────────────────────── diff --git a/packages/extension/src/sidebar_tree_service.ts b/packages/extension/src/sidebar_tree_service.ts index 7cb15818..d6bca217 100644 --- a/packages/extension/src/sidebar_tree_service.ts +++ b/packages/extension/src/sidebar_tree_service.ts @@ -40,8 +40,6 @@ export interface TreeServiceDeps { */ export class SidebarTreeService { private deps: TreeServiceDeps; - /** Map root path → resolved environment info from the last getRoots() call (#885). */ - private rootEnvironments = new Map(); constructor(deps: TreeServiceDeps) { this.deps = deps; @@ -64,7 +62,6 @@ export class SidebarTreeService { const envBySlug = new Map(); /** Track which slugs each research project resolves to, for boundProjectCount. */ const projectEnvSlugs: string[] = []; - this.rootEnvironments.clear(); // ── Pass 1: workspace folders ────────────────────────────────────────── for (const folder of workspaceFolders) { @@ -119,7 +116,6 @@ export class SidebarTreeService { path: env.path, colorIndex: envColorIndex(env.slug), }; - this.rootEnvironments.set(dir, { name: env.name, slug: env.slug, path: env.path }); projectEnvSlugs.push(env.slug); // Auto-surface resolved environments that aren't already in the map (#895) @@ -198,19 +194,6 @@ export class SidebarTreeService { path: `${dirPath}/${entry.name}`, })); - // If this is a project root with a bound environment, append the - // environment as the last child (#885) - const envInfo = this.rootEnvironments.get(dirPath); - if (envInfo) { - entries.push({ - name: envInfo.name, - type: "directory", - path: envInfo.path, - entryKind: "environment-root", - environmentSlug: envInfo.slug, - }); - } - return entries; } } diff --git a/packages/extension/src/sidebar_webview.ts b/packages/extension/src/sidebar_webview.ts index 2377e8de..3df76f2e 100644 --- a/packages/extension/src/sidebar_webview.ts +++ b/packages/extension/src/sidebar_webview.ts @@ -31,8 +31,6 @@ interface TreeEntry { type: "file" | "directory"; path: string; gitStatus?: string; - entryKind?: "environment-root"; - environmentSlug?: string; } // ── Icon theme data (embedded by the host in window.__iconTheme) ───────────── diff --git a/packages/extension/test/sidebar_env_tree.test.ts b/packages/extension/test/sidebar_env_tree.test.ts index 8cfc7912..99aa09f7 100644 --- a/packages/extension/test/sidebar_env_tree.test.ts +++ b/packages/extension/test/sidebar_env_tree.test.ts @@ -1,11 +1,12 @@ -// Sidebar environment tree — TreeService getChildren appends env row + getRoots environment discovery. -// Part of #885 (sub-issue of #880 Research Environments) and #895 (environment accordion section). +// Sidebar environment tree — getRoots environment discovery. +// Part of #895 (environment accordion section). The nested environment virtual +// child (#885) has been removed — environments have their own section now. import { describe, it, expect } from "vitest"; import { SidebarTreeService } from "../src/sidebar_tree_service"; import type { RawDirEntry } from "../src/sidebar_tree_service"; import { envColorIndex } from "../src/sidebar_bridge"; -describe("SidebarTreeService nested environment tree (#885)", () => { +describe("SidebarTreeService getChildren — no virtual environment child (#895)", () => { function makeService(env: { name: string; slug: string; path: string } | null = { path: "/env/transmon-oc", slug: "transmon-oc", @@ -32,43 +33,23 @@ describe("SidebarTreeService nested environment tree (#885)", () => { }); } - it("appends environment as last child of a bound project root (AC-11)", async () => { + it("getChildren returns only filesystem entries — no virtual environment child", async () => { const service = makeService(); - // Must call getRoots first to populate the environment map service.getRoots(); const children = await service.getChildren("/proj"); - expect(children.length).toBe(4); // 3 regular + 1 environment - const envEntry = children[children.length - 1]; - expect(envEntry.entryKind).toBe("environment-root"); - expect(envEntry.name).toBe("Transmon OC"); - expect(envEntry.path).toBe("/env/transmon-oc"); - expect(envEntry.environmentSlug).toBe("transmon-oc"); - expect(envEntry.type).toBe("directory"); + expect(children.length).toBe(3); // only the 3 real filesystem entries + expect(children.every((c) => !c.entryKind)).toBe(true); }); - it("no environment → no extra child", async () => { - const service = makeService(null); - service.getRoots(); - - const children = await service.getChildren("/proj"); - expect(children.length).toBe(3); // just the regular children - expect(children.find((c) => c.entryKind === "environment-root")).toBeUndefined(); - }); - - it("environment row is always last (after sorted files)", async () => { + it("children are sorted dirs-first then alphabetical", async () => { const service = makeService(); service.getRoots(); const children = await service.getChildren("/proj"); - // Regular entries should be sorted (dirs first, then files) - const regular = children.filter((c) => !c.entryKind); - expect(regular[0].name).toBe("data"); // dir - expect(regular[1].name).toBe("scripts"); // dir - expect(regular[2].name).toBe("README.md"); // file - - // Environment is last - expect(children[children.length - 1].entryKind).toBe("environment-root"); + expect(children[0].name).toBe("data"); // dir + expect(children[1].name).toBe("scripts"); // dir + expect(children[2].name).toBe("README.md"); // file }); });