The planning routes no longer pass { invokeTaskCreatedHook: false } as
the second arg to store.createTask — they let the hook fire so
GitHub tracking and other post-creation listeners run. The
toHaveBeenCalledWith assertions still expected the legacy second arg
and failed across 12 test cases.
Strip the second argument from each toHaveBeenCalledWith spec. Fixes 8
failing tests in routes-planning.test.ts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
createMissionInterviewSession, submitMissionInterviewResponse,
retryMissionInterviewSession, and submitTargetInterviewResponse now
take a TaskStore as an additional argument (after rootDir). The e2e
expectations still asserted on the pre-store positional shape and
failed. Insert expect.anything() in the store slot of each
toHaveBeenCalledWith assertion.
Fixes 10 failing tests in mission-e2e.test.ts (interview start/respond/
retry scoping suite + milestone interview respond regression).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8 more test files were failing to load because their vi.mock("@fusion/core")
factories didn't include the deterministicGuardLocks export that
register-task-workflow-routes pulls in at module-load time. Add the
empty Map to each mock's return object. Unblocks the suite-level
collection for these files (previously the entire file's tests counted
as 0/failed because the module never loaded).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirror the planning.ts fix: capture store/rootDir on MissionInterviewSession
at creation, fall back to the captured values in
ensureMissionInterviewAgent when callers don't plumb them through. Then
update the session/mission test files so their createSession,
createMissionInterviewSession, and rehydrated submitResponse/retry calls
pass a real TaskStore where they were previously passing undefined.
Fixes 10 failing tests across mission-interview.test.ts,
milestone-slice-interview.test.ts, session-error-recovery.test.ts,
session-persistence-roundtrip.test.ts, session-resume-history.test.ts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
createSession captured a TaskStore but submitResponse/retrySession/
rewindSession had no way to receive one — so rehydrated sessions
(loaded from SQLite, no prior createSession call) failed with
"Planning session has no task store and cannot be resumed without
project context" when they needed to rebuild an agent.
- Add optional `store` to Session and capture it on createSession.
- Extend submitResponse, retrySession, rewindSession to accept and
propagate a store argument; ensureSessionAgent falls back to the
session-captured value when the caller doesn't plumb one.
- Update planning.test.ts rehydration paths to pass MOCK_TASK_STORE
where they previously relied on the implicit error to test against.
Fixes 7 failing tests in planning.test.ts (rehydration + retry/rewind
flows). Same pattern applies to mission-interview.ts and the related
session-* test files but is deferred to a separate commit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
createSession now requires a TaskStore (planning.ts:765); the reconnect
test had a TaskStore in scope but was still passing undefined as the
third arg. Hook it up. Fixes the 1 failing test in this file.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
routes-sandbox-audit.test.ts mocked @fusion/core without
deterministicGuardLocks (causing the workflow-routes import to throw)
and its MockStore lacked getDatabase, which createServer now calls
when wiring ChatStore. Add both. Fixes 3 failing tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous commit collapsed both header spans into a single isMobile-
conditional render, but that broke 3 desktop-header tests that
intentionally assert on both spans being present (the CSS handles
visibility). The real fix for the "Found multiple elements" failures
was the localStorage.clear() in beforeEach; the structural change was
unnecessary. Restore the original dual-render markup.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The header rendered both a "Missions" desktop span AND a mobile span
containing the selected mission title simultaneously, relying on CSS to
hide the inactive variant. jsdom doesn't apply media queries, so
testing-library's getByText found the mission title in both the body
cards and the otherwise-hidden mobile header — failing 49 tests with
"Found multiple elements with the text: <title>". Render only the
active variant based on isMobile.
Also clear localStorage in beforeEach so the SWR mission cache from
prior tests doesn't pre-hydrate into the next render and surface its
own fixtures as duplicates.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The skeleton-loading test failed because earlier tests in the file
populated the SWR cache, so MailboxModal hydrated inbox from
localStorage and skipped the loading skeleton. Reset localStorage in
beforeEach so each test starts with a clean cache.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MissionManager.cache and MailboxModal.cache tests parsed the raw
localStorage entry as the payload, but writeCache wraps values in
{ savedAt, data }. Pull .data out before asserting on length or
nested fields. Fixes 3 failing tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
swrCache.writeCache wraps values in a { savedAt, data } envelope, but
useChatRooms/useEvals/useInsights/useResearch tests still parsed
localStorage entries as bare arrays. Pull the .data field out before
indexing so the cache assertions hit the actual payload. Fixes 6
failing tests across the four hook test files.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
server.ts createServer now invokes engine.getSelfHealingManager() to
wire the self-healing branch-rebind hook. The headless engine fake in
remote-access-headless.test.ts hadn't been updated. Add a vi.fn() stub
so the mock satisfies the engine surface contract.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
createDatabase(":memory:") fails the absolute-path guard added to the
Database constructor. Use a real tmp dir with inMemory: true, and call
db.init() to materialize project_insight_runs before InsightStore is
constructed. Fixes 5 failing tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When fetchMissions returns a non-array (envelope shape, error path, or
mocked detail object) setMissions(data) leaks the bad shape into render,
where missions.filter() throws "is not a function" and crashes the
entire MissionManager test file. Coerce to [] before storing, matching
the existing defenses on the useState init and cache-hydration paths.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SettingsModalNodeRouting and settings-mobile both mock ../../api but
omit fetchProjects, which the SettingsModal now calls during mount.
Add a stub returning an empty list. Drops SettingsModalNodeRouting
failures from 14 → 0 and settings-mobile from 9 → 1 (residual failure
is unrelated and tracked separately).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
proxy-routes and routes-agent-skills tests mock @fusion/core but omit
the deterministicGuardLocks Map that register-task-workflow-routes
imports at module-load time. Add the export so the mock satisfies the
shape consumers expect. Fixes 24 failing tests across the two files.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Stabilizes mobile keyboard viewport metrics in the `useMobileKeyboard` hook, with tests covering the hook and `ChatView` integration; a minor dashboard command adjustment is included.
Fusion-Task-Id: FN-5155
- Add dashboard routes to generate PR title/body metadata for task branches
- Add PR preflight diagnostics for base branch resolution, remote branch checks, commit summaries, changed files, conflicts, and gh auth state
- Cover the new Create PR route contracts and metadata preflight behavior with dashboard tests
- Add a changeset for the published @runfusion/fusion package
Fusion-Task-Id: FN-5144