fix(workstate): normalisation du work-state pour éviter l'onglet Work vide
Normalise l'état Work pour empêcher l'affichage d'un onglet Work vide. QA VERT : tsc --noEmit exit 0 ; vitest run 42 fichiers / 407 tests passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -68,6 +68,7 @@ import type {
|
||||
TerminalHandle,
|
||||
WorkStateGateway,
|
||||
} from "@/ports";
|
||||
import { normalizeProjectWorkState } from "../workStateNormalization";
|
||||
import { applyOperation, singleLeafTree } from "@/features/layout/layout";
|
||||
|
||||
export class MockSystemGateway implements SystemGateway {
|
||||
@ -1681,10 +1682,7 @@ export class MockWorkStateGateway implements WorkStateGateway {
|
||||
private states = new Map<string, ProjectWorkState>();
|
||||
|
||||
/** Seeds the read-model returned for a project (deterministic tests/dev). */
|
||||
_setProjectWorkState(
|
||||
projectId: string,
|
||||
state: ProjectWorkState | LegacyProjectWorkState,
|
||||
): void {
|
||||
_setProjectWorkState(projectId: string, state: unknown): void {
|
||||
this.states.set(projectId, normalizeProjectWorkState(state));
|
||||
}
|
||||
|
||||
@ -1695,25 +1693,6 @@ export class MockWorkStateGateway implements WorkStateGateway {
|
||||
}
|
||||
}
|
||||
|
||||
type LegacyProjectWorkState = {
|
||||
agents: Array<Omit<ProjectWorkState["agents"][number], "tickets"> & {
|
||||
tickets?: ProjectWorkState["agents"][number]["tickets"];
|
||||
}>;
|
||||
conversations?: ProjectWorkState["conversations"];
|
||||
};
|
||||
|
||||
function normalizeProjectWorkState(
|
||||
state: ProjectWorkState | LegacyProjectWorkState,
|
||||
): ProjectWorkState {
|
||||
return {
|
||||
agents: state.agents.map((agent) => ({
|
||||
...structuredClone(agent),
|
||||
tickets: structuredClone(agent.tickets ?? []),
|
||||
})),
|
||||
conversations: structuredClone(state.conversations ?? []),
|
||||
};
|
||||
}
|
||||
|
||||
function mostRestrictive(
|
||||
project?: PermissionSet["fallback"],
|
||||
agent?: PermissionSet["fallback"],
|
||||
|
||||
Reference in New Issue
Block a user