Commit Graph

2 Commits

Author SHA1 Message Date
Fusion Agent
1c26a4bf4b fix(dashboard): report the cause of a failed query, not the statement that failed
Reported from a task chat: a screenful of column names from `project.chat_sessions` and
nothing about what broke.

That message is, by construction, the useless half. Drizzle wraps a query failure in an
error whose message is `Failed query: <the whole statement> params: …` and puts the real
PostgresError — `column "x" does not exist`, `permission denied`, `connection terminated` —
in `cause`. `rethrowAsApiError` read `error.message` alone, so the reason was dropped before
it ever reached the operator. `startup-factory` already carried a private chain walker
because field reports of exactly this shape were undiagnosable; the dashboard never got one.

The walker is now shared (`describeErrorChain` for logs, `summarizeErrorForOperator` for
operator surfaces). The inversion is keyed narrowly on the `Failed query:` wrapper, never on
guessing which message reads better: an application-authored message is deliberate prose and
still leads, so the API boundary contract and its 29 tests are unchanged. Only the
machine-generated frame is demoted to truncated context behind its cause.

This does not fix the underlying query failure — it makes it reportable. The next occurrence
will name the column or condition that failed instead of the statement that contained it.

pnpm lint 0 errors, test:gate green, core + dashboard typecheck clean, 7 new tests.
2026-08-26 08:57:31 +00:00
gsxdsm
cb57093d03 refactor: domain folder layout (types, API, core, engine) (#2398)
## Summary

Wave 17 organizes Fusion into **domain folders** (stacks on #2397).

### Layout
- **core/types/** — board, task, agents, settings, merge, workflow,
mesh, …
- **core/src/** — agents, ai, async-stores, workflows, tasks, config,
db, …
- **dashboard/app/api/** — client, tasks, agents, git, missions,
planning, …
- **engine/src/** — agents, auth, execution, merge, missions, overseer,
worktree, …

Root keepers retained for large entrypoints (`store.ts`, `executor.ts`,
`merger.ts`, …).

Public barrels (`@fusion/core`, `@fusion/engine`, `app/api.ts` → legacy)
stay stable.

## Test plan
- [x] `@fusion/core` typecheck
- [x] `@fusion/engine` typecheck (pre-existing playwright-core noise
only)
- [ ] CI merge gate

**Stack:** #2394 → #2397 → **this PR**
2026-08-03 00:20:53 -07:00