refactor(web): remove the dead right-panel and subagent-preview code
v0.1.1 replaced both surfaces: the session tray took the right panel's todo/tasks, and the in-place `?sub=` child view took the subagent preview. - delete `features/chat/side-panel.tsx` (nothing imported it since the tray landed) - delete `SubagentModal` and its private helpers (`SUB_BADGE`, `SUB_DOT`, `SubagentEntry`, `parseSubagentLines`, `SUB_ROLES`); the child view builds its timeline from the parent's entries instead of `subagent.read` - drop `chatCommands.readSubagent` (its only caller is gone) - drop the deprecated store slice `PreviewTarget` / `preview` / `setPreview`, including the session-migration re-key and the `PanelTab` alias - drop their exclusive CSS (`.sub-item*`, `.sub-preview*`, `.sub-steer`) and the 6 orphan catalog keys (chat.subagentTitle, chat.preview, chat.previewNote, chat.task, chat.currentSubagents, chat.steerRequired) - tests: remove the two SubagentModal cases and the preview/readSubagent expectations (295 tests, down from 297 — exactly the deleted cases) Verification: typecheck clean, vitest 295/295, vite build green, visual matrix 24/24 clean.
This commit is contained in:
1 parent
bcf50b516f
commit
3789394c85
12 files changed
+12
-653
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { SubagentModal, TaskOutputModal } from "@/features/chat/modals";
|
||||
import { TaskOutputModal } from "@/features/chat/modals";
|
||||
import { setLanguage } from "@/lib/i18n";
|
||||
|
||||
import { sessionFixture, subagentFixture, taskFixture, taskOutputFixture } from "./chat-fixtures";
|
||||
import { sessionFixture, taskFixture, taskOutputFixture } from "./chat-fixtures";
|
||||
import { mockApi } from "./helpers/api-mock";
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -78,57 +78,3 @@ describe("task output modal", () => {
|
||||
expect(screen.queryByText("(no output)")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("subagent preview modal", () => {
|
||||
it("renders the raw pi entries from subagent.read (sessionFile + lines)", async () => {
|
||||
mockCommands({
|
||||
"subagent.read": {
|
||||
status: 202,
|
||||
body: {
|
||||
sessionFile: "/tmp/pi2-subsessions/researcher.jsonl",
|
||||
lines: ["[1] user: fix the auth flow", "[2] assistant: looking at it now", "[3] tool result: ok"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
render(
|
||||
<SubagentModal
|
||||
open
|
||||
session={sessionFixture()}
|
||||
subagent={subagentFixture()}
|
||||
onClose={vi.fn()}
|
||||
onBack={vi.fn()}
|
||||
onSteer={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(await screen.findByText("fix the auth flow")).toBeInTheDocument();
|
||||
expect(screen.getByText("looking at it now")).toBeInTheDocument();
|
||||
expect(screen.getByText("/tmp/pi2-subsessions/researcher.jsonl")).toBeInTheDocument();
|
||||
expect(screen.getByText("fix the auth flow").closest("article")).toHaveAttribute("data-role", "user");
|
||||
expect(screen.getByText("looking at it now").closest("article")).toHaveAttribute("data-role", "assistant");
|
||||
// No synthetic "preview" copy.
|
||||
expect(screen.queryByText(/Got it\. I'll run with/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows an error state when the sub-session cannot be read", async () => {
|
||||
mockCommands({
|
||||
"subagent.read": {
|
||||
status: 404,
|
||||
body: { error: { code: "E_NOT_FOUND", message: "unknown sub-agent session file", retryable: false } },
|
||||
},
|
||||
});
|
||||
render(
|
||||
<SubagentModal
|
||||
open
|
||||
session={sessionFixture()}
|
||||
subagent={subagentFixture()}
|
||||
onClose={vi.fn()}
|
||||
onBack={vi.fn()}
|
||||
onSteer={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(await screen.findByRole("alert")).toHaveTextContent("Not found");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user