From 2047072f85cf671e22cb179b501b57cc588263aa Mon Sep 17 00:00:00 2001 From: reoring Date: Thu, 12 Nov 2026 12:19:15 +0900 Subject: [PATCH] web: request the plan for a draft without creationExecutions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Platform API omits an empty creationExecutions array. generate() read its length unguarded, so every never-executed draft threw before the plan generation request and showed 計画を作れませんでした (APT-748, APT-749). --- web/src/features/build/use-build-session.test.tsx | 10 ++++++++++ web/src/features/build/use-build-session.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/web/src/features/build/use-build-session.test.tsx b/web/src/features/build/use-build-session.test.tsx index 363d40b..faf4176 100644 --- a/web/src/features/build/use-build-session.test.tsx +++ b/web/src/features/build/use-build-session.test.tsx @@ -189,6 +189,16 @@ describe('kickoff to plan handoff', () => { expect(generation).toHaveBeenCalledTimes(1) }) + test('a draft the API returns without creationExecutions still requests its plan', async () => { + const generation = mockGeneration() + // The Platform API omits an empty creationExecutions array from the draft JSON. + const { creationExecutions: _omitted, ...neverExecuted } = unplanned + client.setQueryData(queryKey, neverExecuted) + await render() + expect(generation).toHaveBeenCalledTimes(1) + expect(build.failure).toBeUndefined() + }) + test.each(['pending', 'succeeded'] as const)('reload observes an existing %s generation instead of sending another', async (status) => { const generation = mockGeneration() const current: ApplicationDraft = { diff --git a/web/src/features/build/use-build-session.ts b/web/src/features/build/use-build-session.ts index 268ff3b..58f3dcf 100644 --- a/web/src/features/build/use-build-session.ts +++ b/web/src/features/build/use-build-session.ts @@ -253,7 +253,7 @@ export function useBuildSession(draft: ApplicationDraft, me: Me, groupId: string const current = await api.getDraft(projectId, draft.id) receive(current) const latestGeneration = current.creationPlanGenerations?.at(-1) - if (current.createdApplicationStackId || current.creationExecutions.length + if (current.createdApplicationStackId || current.creationExecutions?.length || latestGeneration?.id !== previousGenerationId || !needsPlanRefresh(current, store.state.lastPlannedIntent)) { patch({ planRequested: false })