fix: resolve main-branch CI test failures

Two failures surfaced in the full-suite run on main (28697507894):

1. dashboard session-reconnect.test.ts — real bug. The planning
   "replays buffered events" test hung at the 15s timeout because
   FN-7444 (planning summary deepening checkpoint) now holds the
   completed summary behind a mandatory checkpoint question instead
   of finalizing on the agent's "complete" payload. The stream route
   never observed session.summary and subscribed forever. Fix: respond
   to the deepening checkpoint with the reserved proceed option so
   finalizePendingSummary runs, session.summary is set, and the
   summary/complete events are buffered for SSE replay. Reproduced
   locally (15s hang) and verified green (4/4).

2. cli extension.test.ts — loaded-lane CI flake. The built-dist-barrel
   fn_task_list test timed out at 5000ms under 4-shard contention while
   passing locally (~1.2s body) and in 3 of the 4 surrounding runs.
   Root cause is in-test dist-barrel recompilation inside the default
   5s timeout (vi.resetModules + vi.importActual of the full core dist
   + fresh dynamic import), the same signature rescued in
   FN-6483/FN-6705/FN-6795/FN-6839. Quarantined on sight per the
   flaky-test rule (ledger + matching vitest exclude) rather than
   widening the timeout or loosening assertions; the sibling
   source-@fusion/core test covers the identical truncation invariant.
This commit is contained in:
gsxdsm
2026-07-04 00:26:49 -07:00
parent 046d2d3f72
commit 7ecf5e2b9c
3 changed files with 26 additions and 3 deletions

View File

@@ -42,7 +42,11 @@ const quarantinedCliTests: string[] = [
FNXC:CliTests 2026-06-27-10:05:
FN-7119 re-ran extension.test.ts twice with the exclude removed and the fn_delegate_task null-target symptom no longer reproduces at HEAD. Keep this list empty so delegate-task validation coverage stays active in the package lane.
FNXC:CliTests 2026-07-04-10:40:
FN-7447 re-quarantines extension.test.ts after its built-dist-barrel fn_task_list test (line ~3084) timed out at 5000ms in full-suite shard 4/4 (run 28697507894) while passing locally at ~1.2s and in 3 of the 4 surrounding CI runs. The root-cause invariant is the loaded-lane signature: in-test dist-barrel recompilation (vi.resetModules + vi.importActual of the full @fusion/core dist barrel + a fresh dynamic import of extension.js) inside the default 5s timeout is CPU-bound and degrades non-linearly under 4-shard CI contention. This is the same signature rescued in FN-6483/FN-6705/FN-6795/FN-6839; widening the timeout is forbidden by the flaky-test rule and removing the recompilation removes the test's only purpose, so the file is excluded per the deletion ratchet rather than re-attempting a fifth fixture rescue. Mirrors scripts/lib/test-quarantine.json; collateral is the ~68 otherwise-stable tests in this file, recoverable via rescue before the 2026-07-18 deletion deadline.
*/
"src/__tests__/extension.test.ts",
];
export default defineConfig({

View File

@@ -11,7 +11,12 @@ import { rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { beforeEach, afterEach, describe, expect, it, vi } from "vitest";
import { Database, TaskStore } from "@fusion/core";
import {
Database,
TaskStore,
PLANNING_DEEPEN_CHECKPOINT_ID,
PLANNING_DEEPEN_PROCEED_OPTION_ID,
} from "@fusion/core";
import { createApiRoutes } from "../routes.js";
import { request, get } from "../test-request.js";
import { AiSessionStore, type AiSessionRow } from "../ai-session-store.js";
@@ -205,7 +210,15 @@ describe("session reconnect + replay", () => {
const { sessionId } = await createSession("127.0.0.11", "Build reconnect tests", store, "/tmp/project");
await submitResponse(sessionId, { "q-1": "medium" }, "/tmp/project");
await submitResponse(sessionId, { "q-2": "none" }, "/tmp/project");
/*
FNXC:DashboardSessionTests 2026-07-04-10:30:
FN-7444 holds the completed planning summary behind a mandatory deepening checkpoint before finalization. The agent's third response returns a "complete" payload, which now sets a pending summary plus checkpoint question instead of finalizing. Respond with the reserved proceed option so finalizePendingSummary runs, session.summary is set, and the summary/complete events are buffered for SSE replay.
*/
await submitResponse(
sessionId,
{ [PLANNING_DEEPEN_CHECKPOINT_ID]: [PLANNING_DEEPEN_PROCEED_OPTION_ID] },
"/tmp/project",
);
const firstStream = await get(app, `/api/planning/${sessionId}/stream?lastEventId=0`);
expect(firstStream.status).toBe(200);
const firstBody = String(firstStream.body);

View File

@@ -1,4 +1,10 @@
{
"$comment": "Flaky-test quarantine ledger (deletion ratchet — see AGENTS.md 'Flaky tests: quarantine on sight' and docs/testing.md 'Quarantine ledger and the deletion ratchet'). A test observed failing without a corresponding real bug is quarantined ON SIGHT: add an entry here AND a matching one-line `exclude` entry in that package's vitest config, in the same commit. Every entry needs a non-empty `reason` (link the failing run) and a `quarantinedAt` date — the entry expires 14 days later, at which point the test file is DELETED unless someone rescues it with evidence it catches real regressions plus a root-cause fix (never appeasement). There is deliberately no loader module and no automation around this file: it is a dated record, the vitest config exclude is the mechanism, and the sweep is policy executed by whoever touches the suite.",
"entries": []
"entries": [
{
"file": "packages/cli/src/__tests__/extension.test.ts",
"reason": "Loaded-lane CI timeout: the dist-barrel fn_task_list test (extension.test.ts line ~3084) timed out at 5000ms in the full-suite shard 4/4 while passing locally in ~1.2s and in 3 of the 4 surrounding CI runs. Root-cause invariant: the test does in-test module recompilation (vi.resetModules + vi.importActual of the full @fusion/core dist barrel + a fresh dynamic import of extension.js) inside the default 5s test timeout; that work is CPU-bound and degrades non-linearly under 4-shard CI contention. This is the same loaded-lane signature rescued in FN-6483/FN-6705/FN-6795/FN-6839; widening the timeout is forbidden by the flaky-test rule and removing the recompilation removes the test's only purpose. The sibling source-@fusion/core test 'bounds large column-filtered listings' covers the identical truncation invariant, so the dist-barrel slice's marginal coverage is dist-resolution, which has been stable. Collateral: file-granular exclude also drops ~68 otherwise-stable tests in this file until a rescue. Failing run: https://github.com/Runfusion/Fusion/actions/runs/28697507894 (Test shard 4/4).",
"quarantinedAt": "2026-07-04"
}
]
}