fix(web): fence plan mode projection races

This commit is contained in:
fz
2026-07-24 13:16:26 +08:00
parent bc63b5fe00
commit ced6ab9d14
13 changed files with 119 additions and 32 deletions

View File

@@ -113,7 +113,10 @@ export const sessionCancelValueSchema = z.object({
export const planModeStateSchema = z.object({
active: z.boolean(),
pending: z.boolean().optional(),
}) satisfies z.ZodType<Wire<PlanModeState>>
}).refine(
state => state.pending === undefined || state.pending !== state.active,
{ message: 'pending must differ from active when present', path: ['pending'] },
) satisfies z.ZodType<Wire<PlanModeState>>
/** session.planMode request payload. */
export const sessionPlanModeRequestSchema = z.object({

View File

@@ -47,7 +47,7 @@ export interface SessionSummary {
/**
* Plan collaboration state exposed to clients. `active` is the logged state
* shaping the current request; `pending`, when present, is the user's
* next-boundary selection.
* next-boundary selection and differs from `active`.
*/
export interface PlanModeState {
active: boolean