Commit Graph

7226 Commits

Author SHA1 Message Date
gsxdsm
329b74416d fix(dashboard): plumb TaskStore through submit/retry/rewind planning APIs
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>
2026-05-19 18:21:35 -07:00
gsxdsm
44f662e8ce test(dashboard): pass store to createSession in session-reconnect test
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>
2026-05-19 18:11:58 -07:00
gsxdsm
8e2d0b6d20 test(dashboard): satisfy server.ts contract on sandbox-audit MockStore
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>
2026-05-19 18:09:35 -07:00
gsxdsm
8809bc9ea5 revert(dashboard): keep MissionManager dual mobile/desktop title spans
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>
2026-05-19 18:04:08 -07:00
gsxdsm
acfc55b804 fix(dashboard): stop MissionManager rendering mobile+desktop title together
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>
2026-05-19 18:03:12 -07:00
gsxdsm
f55b051163 test(dashboard): clear localStorage in MailboxModal beforeEach
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>
2026-05-19 17:57:10 -07:00
gsxdsm
24c15bc660 test(dashboard): extract .data from SWR cache envelope in cache tests
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>
2026-05-19 17:54:43 -07:00
gsxdsm
e47c5e4507 test(dashboard): extract .data from SWR cache envelope in hook tests
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>
2026-05-19 17:53:59 -07:00
gsxdsm
38adeba79f test(dashboard): stub getSelfHealingManager on remote-access engine mock
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>
2026-05-19 17:51:40 -07:00
gsxdsm
061d28a8a6 test(dashboard): fix insight-run-sweeper Database constructor usage
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>
2026-05-19 17:51:07 -07:00
gsxdsm
d9f105baf2 fix(dashboard): defend MissionManager.loadMissions against non-array fetch results
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>
2026-05-19 17:48:23 -07:00
gsxdsm
2a8e6574de test(dashboard): add fetchProjects to settings test ../../api mocks
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>
2026-05-19 17:45:36 -07:00
gsxdsm
cfd20d319a test(dashboard): add deterministicGuardLocks to @fusion/core mocks
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>
2026-05-19 17:44:53 -07:00
Fusion (runfusion.ai)
7dafde4c43 feat(FN-5188): complete Step 6 — document bootstrap guard
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:21 -07:00
Fusion (runfusion.ai)
7fe6cd362a fix(FN-5188): complete Step 5 — restore green verification
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:21 -07:00
Fusion (runfusion.ai)
9c59f1da0d test(FN-5188): add orphan-rescue fresh-db reliability backstop
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:20 -07:00
Fusion (runfusion.ai)
4b2a77b631 feat(FN-5188): complete Step 3 — gate fresh-db orphan rescue
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:20 -07:00
Fusion (runfusion.ai)
2c75ac6227 feat(FN-5188): complete Step 2 — persist bootstrappedAt
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:20 -07:00
Fusion (runfusion.ai)
1565b6dc52 feat(FN-5188): complete Step 1 — linked worktree refusal
Fusion-Task-Id: FN-5188
Fusion-Task-Lineage: 6d238ff1-2d69-44e7-8694-ec19e412f8ef
2026-05-19 17:27:20 -07:00
Fusion (runfusion.ai)
d475c355e5 test(FN-5189): clean lint warning during verification
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:03 -07:00
Fusion (runfusion.ai)
92c5af9d7d fix(FN-5189): tighten detached spawn allowlist matching
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:03 -07:00
Fusion (runfusion.ai)
c48f9cbcad docs(FN-5189): add process supervision guidance
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:03 -07:00
Fusion (runfusion.ai)
8c05682ab4 feat(FN-5189): complete Step 5 — guard against nohup regressions
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:03 -07:00
Fusion (runfusion.ai)
dc8dd33f80 test(FN-5189): complete Step 4 — add supervision regression test
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:03 -07:00
Fusion (runfusion.ai)
818db4a714 feat(FN-5189): complete Step 3 — migrate supervised spawns
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:02 -07:00
Fusion (runfusion.ai)
87ea63c7c3 feat(FN-5189): complete Step 2 — implement process supervisor
Fusion-Task-Id: FN-5189
Fusion-Task-Lineage: 4caa3f0a-af81-4c60-88e8-de229ed72e08
2026-05-19 17:19:02 -07:00
gsxdsm
19e2ff0279 fix(core): suppress activity-log writes for polling-emitted events
When multiple TaskStore instances watch the same SQLite DB (dashboard +
engine runtime + per-project stores in one dashboard process), every
column move was recorded once per polling instance — inflating
task:moved rows 3x and amplifying failure noise (146k+ moves and 781
task:failed events in 24h against ~165 real done tasks).

Set suppressActivityLogForPollingEmit while checkForChanges fires
re-emit events, and skip the activity-log listeners when it's set. The
originating instance's in-process emit path remains the sole writer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 16:25:53 -07:00
Fusion (runfusion.ai)
95707dc98f fix(FN-5168): harden db temp-dir cleanup
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:25 -07:00
Fusion (runfusion.ai)
dac2ebbbf3 fix(FN-5168): stabilize cli worktree root test timeout
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:25 -07:00
Fusion (runfusion.ai)
23dae4b495 test(FN-5168): complete Step 6 — verification gates green
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:25 -07:00
Fusion (runfusion.ai)
7ac8a73f1b test(FN-5168): complete Step 5 — reliability interaction regression
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:25 -07:00
Fusion (runfusion.ai)
368c4c37fe feat(FN-5168): complete Step 3 — no-progress churn terminalization
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:25 -07:00
Fusion (runfusion.ai)
af830a74cc fix(FN-5168): preserve tracking through loop recovery
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:24 -07:00
Fusion (runfusion.ai)
af16608810 feat(FN-5168): complete Step 2 — executor feeds ignored step-update churn
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:24 -07:00
Fusion (runfusion.ai)
913167c736 feat(FN-5168): complete Step 1 — detector signal for ignored step-update churn
Fusion-Task-Id: FN-5168
Fusion-Task-Lineage: 0c865d3e-0886-4e51-a7ff-cb4c713dcc54
2026-05-19 16:15:24 -07:00
Fusion (runfusion.ai)
87c266d497 test(FN-5160): complete Step 3 — add mobile layout contracts
Fusion-Task-Id: FN-5160
Fusion-Task-Lineage: 4817bb14-178e-4914-aa60-d0184fba653b
2026-05-19 15:53:11 -07:00
Fusion (runfusion.ai)
16c87c0722 feat(FN-5160): complete Step 2 — add modal body hooks
Fusion-Task-Id: FN-5160
Fusion-Task-Lineage: 4817bb14-178e-4914-aa60-d0184fba653b
2026-05-19 15:53:11 -07:00
Fusion (runfusion.ai)
0f29c0d1bb feat(FN-5160): complete Step 1 — polish SecretsView CSS
Fusion-Task-Id: FN-5160
Fusion-Task-Lineage: 4817bb14-178e-4914-aa60-d0184fba653b
2026-05-19 15:53:10 -07:00
Fusion (runfusion.ai)
b39c2dd071 feat(FN-5153): deliver soft-delete verification gate
Completes FN-5153 by delivering the soft-delete verification gate with a new end-to-end test suite covering the full soft-delete lifecycle and a documentation matrix summarizing the gate behavior. Updates the dashboard test file and adds a brief entry to AGENTS.md to surface the new feature.

Fusion-Task-Id: FN-5153
2026-05-19 15:52:09 -07:00
gsxdsm
b7e57f84a9 chore: minor cleanups — docs index, test-project fixture, empty catches, triage timestamp guard
- Add diagnostics.md and FN-4886/FN-5048 entries to docs/README.md index
- Fix test-project.test.ts spy target (updateSettings → init) to match fixture flow
- Remove unused DEFAULT_PROJECT_SETTINGS import and skip empty settings patch
- Add explanatory comments to empty catch blocks in secrets-env-writer
- Refine near-duplicate timestamp guard in triage for cleaner NaN handling
2026-05-19 14:22:11 -07:00
Fusion (runfusion.ai)
587e9b416c feat(FN-5155): stabilize mobile keyboard viewport metrics
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
2026-05-19 13:38:31 -07:00
Fusion (runfusion.ai)
41d18b3f6d fix(FN-5150): unblock workspace gates with near-duplicate timestamp guard
Fusion-Task-Id: FN-5150
Fusion-Task-Lineage: 09bf24f1-5d23-4049-bd5e-7afbea0a59ae
2026-05-19 12:13:46 -07:00
Fusion (runfusion.ai)
356411ef06 test(FN-5150): complete Step 2 — cover review-tab create PR path
Fusion-Task-Id: FN-5150
Fusion-Task-Lineage: 09bf24f1-5d23-4049-bd5e-7afbea0a59ae
2026-05-19 12:13:46 -07:00
Fusion (runfusion.ai)
7be22cc07e fix(FN-5150): complete Step 1 — mount PrCreateModal tab-agnostically
Fusion-Task-Id: FN-5150
Fusion-Task-Lineage: 09bf24f1-5d23-4049-bd5e-7afbea0a59ae
2026-05-19 12:13:46 -07:00
Fusion (runfusion.ai)
4d9068d927 test(FN-5152): cover same-millisecond near-duplicate finalize race
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00
Fusion (runfusion.ai)
80ffed7a47 fix(FN-5152): clarify newer-task near-duplicate archive rule
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00
Fusion (runfusion.ai)
2be6cf2ff8 feat(FN-5152): complete Step 8 — add delivery docs and changeset
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00
Fusion (runfusion.ai)
2c6662f13b fix(FN-5152): complete Step 7 — clear verification lint issue
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00
Fusion (runfusion.ai)
8364be83d6 test(FN-5152): complete Step 6 — add near-duplicate reliability interaction tests
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00
Fusion (runfusion.ai)
d9a66571d0 feat(FN-5152): complete Step 5 — add triage near-duplicate backstop
Fusion-Task-Id: FN-5152
Fusion-Task-Lineage: 954570d8-82e1-4519-a739-c52ee790d2db
2026-05-19 11:30:55 -07:00