Files
fusion/packages/dashboard/package.json
gsxdsm daa34fbc38 fix: refineTask/duplicateTask fail in backend (PostgreSQL) mode (#2253)
## Summary

Eliminates the remaining backend/PostgreSQL-mode sync-SQLite
(`store.db`) call sites — both the crashing ones and the
try/catch-masked ones that silently degraded features. Found via a full
audit of `store.db`/`archiveDb` residue after the PG cutover's per-site
routing missed them.

**Crashes fixed:**
1. **refineTask / duplicateTask** threw `TaskStore.db: SQLite Database
is not available in backend mode`. Both create rows through
`createTaskWithId` callbacks calling `store.atomicCreateTaskJson()`
directly, bypassing `_createTaskInternal`'s backend routing. The shared
helper now routes itself (soft-delete conflict check + non-destructive
insert in one AsyncDataLayer transaction).
2. **Merger verification cache**: `getVerificationCacheHit` ran sync
SQLite unguarded *outside* any try/catch in
`runDeterministicVerification`; `recordVerificationCachePass` was
swallowed so the cache never warmed. Both are now async with a PG
branch.

**Silent degradations fixed (features that were dead on PG):**
- Workflow run-branch + foreach step-instance persistence
(`saveWorkflowRunBranch`, `loadWorkflowRunBranches`,
`clearWorkflowRunBranches`, `saveWorkflowRunStepInstance`,
`loadWorkflowRunStepInstances`, `clearWorkflowRunStepInstances`) —
executor crash-resume checkpoints were silently never persisted.
- `getBranchProgressByTask` — returned an empty map, dropping
`branchProgress` from task payloads.
- `runPluginColumnTransitionHooks` — plugin `onEnter`/`onExit`
column-transition hooks never fired (marker bookkeeping + non-locking
task read now async).
- `getTaskColumns` — dashboard treated all agent-linked tasks as
non-terminal.
- `getWorkflowStep` / `listWorkflowSteps` — stored workflow-step rows
now read from `project.workflow_steps` (listing previously returned
plugin steps only); `getLegacyWorkflowStepSnapshot` returns `undefined`
on PG (legacy snapshot exists only in pre-migration SQLite).
- `readRawProjectSettings` / `listWorkflowPromptOverridesForProject` —
now read via the async layer.

These store methods became **async**; engine/dashboard callers await
them (the workflow persistence interfaces already accepted
`Promise`-returning impls).

**PG gotcha encoded in the fixes:** migration `0006_project_ownership`
rebuilds every project-schema PK to lead with `project_id`, so
column-list `ON CONFLICT` inference fails (42P10) — upserts target the
PK by constraint name.

## Surface Enumeration

- Creators through `atomicCreateTaskJson`: `refineTaskImpl`,
`duplicateTaskImpl` (fixed); `_createTaskInternalImpl` unaffected
(already routed).
- Verification-cache callers (all merger, all 3 sites now awaited).
- Run-branch/step-instance callers: executor persistence adapters,
parse-steps foreach probe, integration-queue flip, crash-resume
reconcile, graph-reset cleanup; triage replan cleanup; dashboard
spec-rebuild pin clears; agent-reflection rework summing — all awaited.
- Audit classified everything else as guarded or sync-mode-only (dead in
production — every entry point constructs stores via
`createTaskStoreForBackend`).

## Symptom Verification

- **Original symptoms:** refinement/duplicate creation threw; merge
verification threw; workflow checkpoints/branch progress/plugin
hooks/task-column lookups silently no-oped on PostgreSQL.
- **Exact reproduction:** `refine-duplicate-task.pg.test.ts`,
`verification-cache.pg.test.ts`, and
`sync-db-residue-backend.pg.test.ts` exercise each surface against
embedded-PostgreSQL backend-mode TaskStores.
- **Assertion it is gone:** all suites pass (14 + 5 tests), plus
`transition-pending-and-status-clear.pg.test.ts`,
`create-task-reserved-id.pg.test.ts`, dashboard `routes-github.test.ts`
(123), engine `triage.test.ts` (221) and `agent-reflection.test.ts`
(31). Core/engine/dashboard typecheck fully clean: the 13 errors from
the FN-8142 pi SDK migration are fixed by bumping
@earendil-works/pi-ai/pi-coding-agent to ^0.80.10 (FN-8142 used APIs
absent from the previously locked 0.80.6). Locally green: `pnpm
verify:fast` (scoped typecheck + build + CLI build + boot smoke), `pnpm
test:gate`, and `pnpm lint`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Fixed refinement/duplication task creation in PostgreSQL-backed
backend mode.
* Improved backend-mode persistence for workflow checkpoints,
foreach-step instances, branch progress, and cleanup flows (including
retries/resets/transitions), so stored data reliably round-trips.
* Hardened backend-mode reads for workflow steps, task columns, project
settings, and prompt overrides.
* Made verification-cache reads/writes complete reliably, including
command-specific cache behavior.
* **Tests**
* Added PostgreSQL integration/regression coverage for
refinement/duplication, sync residue, and verification caching.
* **Chores**
* Bumped `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent`
to `^0.80.10`.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 22:35:01 -07:00

177 lines
9.2 KiB
JSON

{
"name": "@fusion/dashboard",
"version": "0.60.0",
"license": "MIT",
"description": "Fusion dashboard: React UI and HTTP API server for monitoring and controlling the Fusion AI coding agent.",
"homepage": "https://github.com/Runfusion/Fusion#readme",
"repository": {
"type": "git",
"url": "https://github.com/Runfusion/Fusion",
"directory": "packages/dashboard"
},
"bugs": {
"url": "https://github.com/Runfusion/Fusion/issues"
},
"type": "module",
"exports": {
".": {
"types": "./src/index.ts",
"source": "./src/index.ts",
"import": "./dist/index.js"
},
"./planning": {
"types": "./src/planning.ts",
"import": "./src/planning.ts"
},
"./app/components/TaskCard": {
"types": "./app/components/TaskCard.tsx",
"import": "./app/components/TaskCard.tsx"
},
"./app/components/ViewHeader": {
"types": "./app/components/ViewHeader.tsx",
"import": "./app/components/ViewHeader.tsx"
},
"./app/utils/taskStuck": {
"types": "./app/utils/taskStuck.ts",
"import": "./app/utils/taskStuck.ts"
},
"./app/utils/copyToClipboard": {
"types": "./app/utils/copyToClipboard.ts",
"import": "./app/utils/copyToClipboard.ts"
},
"./app/utils/projectStorage": {
"types": "./app/utils/projectStorage.ts",
"import": "./app/utils/projectStorage.ts"
},
"./app/plugins/pluginViewRegistry": {
"types": "./app/plugins/pluginViewRegistry.tsx",
"import": "./app/plugins/pluginViewRegistry.tsx"
},
"./app/plugins/types": {
"types": "./app/plugins/types.ts",
"import": "./app/plugins/types.ts"
}
},
"publishConfig": {
"access": "public"
},
"files": [
"dist",
"README.md"
],
"scripts": {
"gen:locales": "node scripts/sync-locales.mjs",
"verify:locale-chunks": "node scripts/assert-locale-chunks.mjs",
"prebuild": "node scripts/sync-locales.mjs",
"build": "vite build && tsc && node -e \"require('node:fs').copyFileSync('src/registry-manifest.json','dist/registry-manifest.json')\"",
"prebuild:client": "node scripts/sync-locales.mjs",
"build:client": "vite build",
"predev:serve": "node scripts/sync-locales.mjs",
"dev": "pnpm build && pnpm typecheck && pnpm dev:serve",
"dev:serve": "vite dev",
"pretest": "node ../../scripts/ensure-test-artifacts.mjs",
"test": "node scripts/run-quality-tests.mjs",
"test:quality:app": "node scripts/run-quality-tests.mjs --group app",
"test:quality:app:foundation-api": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-foundation-api --silent=passed-only --reporter=dot --exclude '**/build-output.test.ts'",
"test:quality:app:foundation-ui": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-foundation-ui --silent=passed-only --reporter=dot --exclude '**/build-output.test.ts'",
"test:quality:app:foundation-hooks-utils": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-foundation-hooks-utils --silent=passed-only --reporter=dot --exclude '**/build-output.test.ts'",
"test:quality:app:components-a": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-components-a --silent=passed-only --reporter=dot --exclude '**/build-output.test.ts'",
"test:quality:app:components-b": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-components-b --silent=passed-only --reporter=dot --exclude '**/build-output.test.ts'",
"test:quality:app:app": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-app --reporter=default --silent=passed-only --exclude '**/build-output.test.ts'",
"test:quality:app:chat": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-chat --reporter=default --silent=passed-only --exclude '**/build-output.test.ts'",
"test:quality:app:settings": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-settings --reporter=default --silent=passed-only --exclude '**/build-output.test.ts'",
"test:quality:app:backfill": "pnpm run test:quality:app:backfill-1 && pnpm run test:quality:app:backfill-2 && pnpm run test:quality:app:backfill-3 && pnpm run test:quality:app:backfill-4",
"test:quality:app:backfill-1": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-backfill --silent=passed-only --reporter=dot --shard=1/4",
"test:quality:app:backfill-2": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-backfill --silent=passed-only --reporter=dot --shard=2/4",
"test:quality:app:backfill-3": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-backfill --silent=passed-only --reporter=dot --shard=3/4",
"test:quality:app:backfill-4": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-app-quality-backfill --silent=passed-only --reporter=dot --shard=4/4",
"test:quality:api": "node scripts/run-quality-tests.mjs --group api",
"test:quality:api:curated": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-api-quality --silent=passed-only --reporter=dot --exclude '**/build-output.test.ts'",
"test:quality:api:backfill": "pnpm run test:quality:api:backfill-1 && pnpm run test:quality:api:backfill-2",
"test:app": "FUSION_DASHBOARD_DEEP=1 vitest run --project dashboard-app --silent=passed-only --reporter=dot --exclude '**/build-output.test.ts'",
"test:api": "FUSION_DASHBOARD_DEEP=1 vitest run --project dashboard-api --silent=passed-only --reporter=dot",
"test:deep": "FUSION_DASHBOARD_DEEP=1 vitest run --project dashboard-app --project dashboard-api --silent=passed-only --reporter=dot --exclude '**/build-output.test.ts'",
"test:browser-smoke": "node scripts/browser-layout-smoke.mjs",
"test:build": "pnpm build && FUSION_DASHBOARD_DEEP=1 vitest run --project dashboard-app --project dashboard-api --silent=passed-only --reporter=dot app/__tests__/build-output.test.ts src/__tests__/plugin-registry-dist.test.ts",
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.app.json",
"test:quality:api:backfill-1": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-api-quality-backfill --silent=passed-only --reporter=dot --shard=1/2",
"test:quality:api:backfill-2": "node scripts/run-vitest-with-heap.mjs --heap=6144 run --project dashboard-api-quality-backfill --silent=passed-only --reporter=dot --shard=2/2"
},
"dependencies": {
"@codemirror/lang-css": "^6.3.1",
"@codemirror/lang-javascript": "^6.2.3",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-markdown": "^6.3.2",
"@codemirror/language": "^6.12.3",
"@codemirror/state": "^6.5.2",
"@codemirror/theme-one-dark": "^6.1.2",
"@codemirror/view": "^6.36.4",
"@earendil-works/pi-coding-agent": "^0.80.10",
"@fusion-plugin-examples/cli-printing-press": "workspace:*",
"@fusion-plugin-examples/compound-engineering": "workspace:*",
"@fusion-plugin-examples/cursor-runtime": "workspace:*",
"@fusion-plugin-examples/dependency-graph": "workspace:*",
"@fusion-plugin-examples/droid-runtime": "workspace:*",
"@fusion-plugin-examples/grok-runtime": "workspace:*",
"@fusion-plugin-examples/hermes-runtime": "workspace:*",
"@fusion-plugin-examples/omp-runtime": "workspace:*",
"@fusion-plugin-examples/openclaw-runtime": "workspace:*",
"@fusion-plugin-examples/paperclip-runtime": "workspace:*",
"@fusion-plugin-examples/quality": "workspace:*",
"@fusion-plugin-examples/roadmap": "workspace:*",
"@fusion/core": "workspace:*",
"@fusion/engine": "workspace:*",
"@fusion/i18n": "workspace:*",
"@types/multer": "^2.1.0",
"@xterm/addon-fit": "^0.10.0",
"@xterm/addon-search": "^0.15.0",
"@xterm/addon-unicode11": "^0.8.0",
"@xterm/addon-web-links": "^0.11.0",
"@xterm/addon-webgl": "^0.18.0",
"@xterm/xterm": "^5.5.0",
"@xyflow/react": "^12.11.0",
"archiver": "^7.0.1",
"express": "^5.1.0",
"i18next": "^26.3.1",
"i18next-browser-languagedetector": "^8.2.1",
"i18next-resources-to-backend": "^1.2.1",
"ioredis": "^5.6.0",
"lucide-react": "^1.7.0",
"mermaid": "^11.4.0",
"multer": "^2.1.1",
"node-pty": "npm:@homebridge/node-pty-prebuilt-multiarch@^0.13.1",
"qrcode": "^1.5.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-i18next": "^17.0.8",
"react-markdown": "^10.1.0",
"recharts": "^3.8.1",
"rehype-raw": "^7.0.0",
"rehype-sanitize": "^6.0.0",
"remark-gfm": "^4.0.1",
"unified": "^11.0.5",
"ws": "^8.18.0",
"zod": "^3.25.76"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.5.0",
"@types/archiver": "^7.0.0",
"@types/express": "^5.0.0",
"@types/node": "^22.0.0",
"@types/qrcode": "^1.5.6",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/ws": "^8.5.0",
"@vitejs/plugin-react": "^4.3.0",
"@vitest/coverage-v8": "^4.1.0",
"jsdom": "^29.0.1",
"tinyrainbow": "^2.0.0",
"typescript": "^5.7.0",
"vite": "^6.0.0",
"vitest": "^4.1.0"
},
"private": true
}