From 770d2f60aa948cfdb61c71304be2f3e35f673840 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Fri, 9 Oct 2026 00:29:24 +0800 Subject: [PATCH] test(workflows): verify residual questions in CLI snapshots --- .../directAnalysisSnapshotReplay.test.ts | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/composition/directAnalysisSnapshotReplay.test.ts b/tests/composition/directAnalysisSnapshotReplay.test.ts index 9f5d09ce4..7596f0608 100644 --- a/tests/composition/directAnalysisSnapshotReplay.test.ts +++ b/tests/composition/directAnalysisSnapshotReplay.test.ts @@ -77,6 +77,35 @@ const functionDossier = { limitations: [], }; +const expectWorkflowQuestionsRetained = ( + snapshot: AnalysisSnapshot, + operation: string, +): void => { + const evidence = snapshot.evidence_bundle.records.find( + (record) => record.operation === operation, + ); + const result = evidence?.normalized_result; + if ( + evidence === undefined || + typeof result !== "object" || + result === null || + Array.isArray(result) || + !Array.isArray(result.residual_unknowns) + ) + throw new Error("Fixture workflow did not return residual questions"); + expect(result.residual_unknowns.length).toBeGreaterThan(0); + expect(snapshot.evidence_bundle.unknowns).toEqual( + expect.arrayContaining( + result.residual_unknowns.map((question) => + expect.objectContaining({ + question, + supporting_evidence_ids: [evidence.evidence_id], + }), + ), + ), + ); +}; + const makeProvider = ( starts: string[], calls: string[], @@ -348,6 +377,8 @@ describe("direct analysis composed snapshot replay", () => { expect( loaded.value.workflow_entries?.map(({ operation }) => operation), ).toContain(scenario.tool); + if (scenario.tool === "inspect_native_api") + expectWorkflowQuestionsRetained(loaded.value, scenario.tool); const second = await runDirectAnalysis( dependencies,