fix: add Workbench projection read model
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
// SPEC: PJ2026-010401 Web工作台 draft-2026-06-18-r1; PJ2026-0104010803 唯一投影 draft-2026-06-18-p0-unique-projection; PJ2026-010403 API契约 draft-2026-06-18-r1.
|
||||
// Responsibility: Regression tests for Workbench route parsing, server-state projection, and session tab status authority.
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import type { WorkbenchSessionRecord } from "../src/types/index.ts";
|
||||
import { initialWorkbenchSessionIdFromLocation } from "../src/stores/workbench-projection.ts";
|
||||
import { createWorkbenchServerState, reduceWorkbenchServerState, selectActiveMessages, selectActiveSession, selectTraceAuthorityById } from "../src/stores/workbench-server-state.ts";
|
||||
import { createWorkbenchServerState, reduceWorkbenchServerState, selectActiveMessages, selectActiveSession, selectSessionStatusAuthority, selectTraceAuthorityById } from "../src/stores/workbench-server-state.ts";
|
||||
import { sessionToSessionTab, stableSessionList } from "../src/stores/workbench-session.ts";
|
||||
|
||||
test("Workbench route parsing accepts only session routes", () => {
|
||||
@@ -75,3 +78,25 @@ test("Workbench session tab status is read from server projection", () => {
|
||||
assert.equal(tab.status, "running");
|
||||
assert.equal(tab.running, true);
|
||||
});
|
||||
|
||||
test("Workbench server-state session detail updates session status authority", () => {
|
||||
let state = createWorkbenchServerState();
|
||||
state = reduceWorkbenchServerState(state, {
|
||||
type: "session.status",
|
||||
session: { sessionId: "ses_backfill", status: "running" }
|
||||
});
|
||||
state = reduceWorkbenchServerState(state, {
|
||||
type: "session.detail",
|
||||
session: {
|
||||
sessionId: "ses_backfill",
|
||||
threadId: "thr_backfill",
|
||||
status: "completed",
|
||||
lastTraceId: "trc_backfill",
|
||||
updatedAt: "2026-06-18T00:00:03.000Z"
|
||||
}
|
||||
});
|
||||
|
||||
const authority = selectSessionStatusAuthority(state).ses_backfill;
|
||||
assert.equal(authority?.status, "completed");
|
||||
assert.equal(authority?.lastTraceId, "trc_backfill");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user