fix: remove workbench sync repair authority
This commit is contained in:
@@ -193,9 +193,9 @@ assertIncludes(workbenchColadaSource, "staleTime", "Workbench query min-interval
|
||||
assertIncludes(workbenchPerformanceSource, "recordWorkbenchRuntimeDiagnostic", "Workbench performance probe must record runtime diagnostics for monitor root cause visibility");
|
||||
assertIncludes(workbenchPerformanceSource, "clearResourceTimings", "Workbench performance probe must bound browser ResourceTiming retention after API enrichment");
|
||||
assertIncludes(workbenchStoreSource, "recordWorkbenchRuntimeDiagnostic", "Workbench store must surface SSE recovery diagnostics to the performance probe");
|
||||
assertIncludes(workbenchRealtimePlanSource, "recovery.actions.includes(\"sync-replay\")", "Realtime recovery planner must consume transport-owned actions explicitly");
|
||||
assertIncludes(workbenchRealtimePlanSource, "recovery.actions.includes(\"events-reconnect\")", "Realtime recovery planner must reconnect the projection SSE explicitly");
|
||||
assert.doesNotMatch(workbenchRealtimePlanSource, /schedule-session-list/u, "Realtime recovery planner must not restore legacy session-list repair actions");
|
||||
assertIncludes(workbenchRealtimePlanSource, "authority: \"automatic-recovery\"", "Realtime recovery planner must classify transport recovery as automatic recovery authority");
|
||||
assertIncludes(workbenchRealtimePlanSource, "afterOutboxSeq: finiteNumber(recovery.outboxSeq)", "Realtime recovery planner must resume projection SSE from the durable outbox cursor");
|
||||
assert.doesNotMatch(workbenchRealtimePlanSource, /force:\s*true/u, "Realtime recovery planner must not turn transport recovery into force-refresh work");
|
||||
assertIncludes(workbenchColadaSource, "const state = await queryCache.refresh(entry);", "Workbench reads must preserve Colada staleTime/min-interval governance");
|
||||
assert.doesNotMatch(workbenchColadaSource, /queryCache\.fetch\(entry/u, "Workbench reads must not call queryCache.fetch(entry), which bypasses Colada freshness governance");
|
||||
|
||||
@@ -23,7 +23,7 @@ import { WORKBENCH_TIMELINE_OPENCODE_PARITY, buildWorkbenchTimelineRows, normali
|
||||
import { reduceWorkbenchRealtimeEvent, workbenchRealtimeEventIsBusinessActivity } from "../src/stores/workbench-event-reducer.ts";
|
||||
import { reduceWorkbenchLiveKafkaMessageState, workbenchAgentMessageIdForTrace } from "../src/stores/workbench-live-kafka-event.ts";
|
||||
import { planWorkbenchRealtimeApply, planWorkbenchRealtimeRecovery } from "../src/stores/workbench-realtime-plan.ts";
|
||||
import { WORKBENCH_REALTIME_AUTHORITY_VERSION, workbenchRealtimePrimaryAuthorityDecision, workbenchSyncReplayEvents } from "../src/stores/workbench-realtime-authority.ts";
|
||||
import { WORKBENCH_REALTIME_AUTHORITY_VERSION, workbenchRealtimePrimaryAuthorityDecision } from "../src/stores/workbench-realtime-authority.ts";
|
||||
import { cleanupWorkbenchServerStateDroppedSessions, cleanupWorkbenchServerStateSessions, createWorkbenchServerState, reduceWorkbenchServerState } from "../src/stores/workbench-server-state.ts";
|
||||
import { cleanupDroppedWorkbenchSessionCaches, trimWorkbenchSessionCache } from "../src/stores/workbench-session-cache.ts";
|
||||
import { selectActiveTurnStatusRefreshTraceIds } from "../src/stores/workbench-session.ts";
|
||||
@@ -593,35 +593,30 @@ test("realtime apply planner turns reducer actions into store steps", () => {
|
||||
assert.deepEqual(ignored.steps, []);
|
||||
});
|
||||
|
||||
test("realtime recovery planner uses sync replay instead of legacy repair fan-out", () => {
|
||||
const recovery = recoveryEvent(["sync-replay"], { outboxSeq: 42 });
|
||||
test("realtime recovery planner reconnects the projection SSE from its outbox cursor", () => {
|
||||
const recovery = recoveryEvent(["events-reconnect"], { outboxSeq: 42 });
|
||||
const authorized = planWorkbenchRealtimeRecovery(recovery, { selectedSessionId: "ses_1", activeSessionId: "ses_1", fallbackTraceId: "trc_1", activeTraceAuthorized: true });
|
||||
assert.deepEqual(authorized.steps.map((step) => step.type), ["sync-replay"]);
|
||||
assert.deepEqual(authorized.steps.map((step) => step.authority), ["automatic-recovery"]);
|
||||
assert.equal(authorized.steps[0]?.sinceOutboxSeq, 42);
|
||||
assert.deepEqual(authorized.steps.map((step) => step.type), ["events-reconnect"]);
|
||||
assert.equal(authorized.steps[0]?.afterOutboxSeq, 42);
|
||||
assert.equal(authorized.sessionId, "ses_1");
|
||||
assert.equal(authorized.traceId, "trc_1");
|
||||
|
||||
const unauthorized = planWorkbenchRealtimeRecovery(recovery, { selectedSessionId: "ses_1", activeSessionId: "ses_1", fallbackTraceId: "trc_1", activeTraceAuthorized: false });
|
||||
assert.deepEqual(unauthorized.steps.map((step) => step.type), ["sync-replay"]);
|
||||
assert.deepEqual(unauthorized.steps.map((step) => step.type), ["events-reconnect"]);
|
||||
|
||||
const inactive = planWorkbenchRealtimeRecovery(recovery, { selectedSessionId: "ses_1", activeSessionId: "ses_other", fallbackTraceId: "trc_1", activeTraceAuthorized: true });
|
||||
assert.deepEqual(inactive.steps.map((step) => step.type), ["sync-replay"]);
|
||||
assert.deepEqual(inactive.steps.map((step) => step.type), ["events-reconnect"]);
|
||||
|
||||
const terminalSealed = planWorkbenchRealtimeRecovery(recovery, { selectedSessionId: "ses_1", activeSessionId: "ses_1", fallbackTraceId: "trc_1", activeTraceAuthorized: true, terminalTraceSealed: true });
|
||||
assert.deepEqual(terminalSealed.steps.map((step) => step.type), []);
|
||||
assert.deepEqual(terminalSealed.steps.map((step) => step.type), ["events-reconnect"]);
|
||||
});
|
||||
|
||||
test("realtime authority accepts events and sync replay through the same entity contract", () => {
|
||||
test("realtime authority accepts projection outbox replay and live events through one entity contract", () => {
|
||||
const event = realtimeEvent({ type: "message.snapshot", sessionId: "ses_1", message: agentMessage({ id: "msg_1", sessionId: "ses_1", status: "completed", text: "done" }), entity: { family: "messages", id: "msg_1", version: 7, outboxSeq: 12, projectionRevision: "prj_7" } });
|
||||
const decision = workbenchRealtimePrimaryAuthorityDecision(event);
|
||||
assert.equal(decision.accepted, true);
|
||||
assert.equal(decision.entity?.family, "messages");
|
||||
assert.equal(decision.entity?.version, 7);
|
||||
|
||||
const replay = workbenchSyncReplayEvents({ contractVersion: "workbench-sync-v1", realtimeAuthority: WORKBENCH_REALTIME_AUTHORITY_VERSION, events: [event], delta: [event] });
|
||||
assert.equal(replay.length, 1);
|
||||
assert.equal(replay[0]?.entity?.id, "msg_1");
|
||||
});
|
||||
|
||||
test("realtime authority rejects trace detail-only and incomplete contract payloads", () => {
|
||||
|
||||
Reference in New Issue
Block a user