Skip to content

fix(FN-7952): complete PostgreSQL runtime cutover#2105

Closed
gsxdsm wants to merge 2 commits into
mainfrom
fix/fn-7952-postgres-runtime-cutover
Closed

fix(FN-7952): complete PostgreSQL runtime cutover#2105
gsxdsm wants to merge 2 commits into
mainfrom
fix/fn-7952-postgres-runtime-cutover

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fusion now uses PostgreSQL as the only live metadata backend. Before this cutover, several CLI, dashboard, runtime, archive, mission, session, and plugin paths could still fall back to SQLite, skip migrated state, or leave database ownership ambiguous; those paths now fail closed or use the shared PostgreSQL layer.

Legacy SQLite files remain supported only as read-only migration evidence. Normal runtime traffic cannot select them, and rollback is restore-only through a tested PostgreSQL backup rather than re-enabling SQLite.

Design decisions

Area Result
Runtime authority Embedded PostgreSQL or DATABASE_URL is mandatory; FUSION_NO_EMBEDDED_PG is rejected.
Legacy compatibility Exactly five read-only seams remain for explicit migration, identity import, validation, and first-boot central import.
Project isolation Active, archived, and plugin data is keyed by canonical project_id, with forced RLS, policies, ownership triggers, and steady-state audits.
Lifecycle ownership CLI, dashboard, desktop, and in-process runtimes retain one owner and unwind pools/postmasters exactly once on success, failure, cancellation, or shutdown.
Plugin compatibility Third-party plugins can declare PostgreSQL schema plans without receiving privileged database handles; plans are validated and applied before onLoad side effects.
Agent parity Reports and CLI Printing Press expose project-scoped tools that reuse their existing authorization and validation paths.

The cutover also completes PostgreSQL parity for cold archives, workflows, missions, knowledge, CLI sessions, maintenance, phantom reservations, bundled plugin stores, and operational repair scripts. Hot archive reads and plugin runtime catalogs are bounded to avoid loading unrelated project history.

Migration and operations

  • Includes a major changeset because the supported storage contract is now PostgreSQL-only.
  • Preserves legacy fusion.db, archive.db, and fusion-central.db as immutable import/recovery inputs, never write targets.
  • Requires a quiesced migration owner, project ownership reconciliation, and an isolated restore test before production writers resume.
  • Documents restore-only rollback and the final authority inventory in docs/postgres-migration-review-2026-07-14.md.

Validation

  • Core, engine, dashboard, CLI, and desktop typechecks passed.
  • pnpm lint and pnpm build passed.
  • pnpm test:gate passed: 40 files and 478 tests.
  • pnpm smoke:boot passed with CLI help, an ephemeral-port health check, and clean shutdown.
  • pnpm verify:fast passed.
  • Focused real-PostgreSQL suites covered migration stamping, archive isolation/search/restore, mission concurrency, runtime composition, plugin schema preflight, maintenance, sessions, and lifecycle failure paths.
  • Final static audit found no live SQLite persistence path outside the five documented read-only migration boundaries.

One unrelated dashboard CPU-sampling assertion flaked during the broader review run and was quarantined under the repository's deletion-ratchet policy; its timeout and assertion were not weakened.

New concepts

Declarative privilege separation for plugin schemas

A plugin describes the PostgreSQL tables it needs, but never receives the privileged connection that creates them. Fusion validates the declaration first, applies it through a short-lived migration executor, then starts the plugin with its ordinary project-scoped runtime connection.

Phase Privilege and responsibility
Declare Plugin returns idempotent, plugin-prefixed project-schema DDL.
Validate Fusion rejects unscoped, data-changing, administrative, or ownership-breaking SQL.
Apply A short-lived schema executor adds project defaults, forced RLS, policies, triggers, and runtime grants.
Run onLoad receives only the normal scoped plugin context after schema setup succeeds.

This avoids exposing a superuser-like handle to third-party runtime code while still allowing independently shipped plugins to own tables. It is not intended for arbitrary data migrations or cross-project administration; those remain operator-controlled migration work.

Make PostgreSQL the only live persistence backend, close lifecycle and
migration parity gaps, enforce project-scoped plugin schemas, and retain
SQLite only as read-only legacy migration input.

Add end-to-end regression coverage, operator documentation, and the major
release changeset for the completed cutover.

Fusion-Task-Id: FN-7952
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Too many files changed for review. (276 files found, 100 file limit)

Bypass the limit by tagging @greptile-apps to review.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 275 files, which is 125 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: de418c05-2879-4e91-977d-319d2d878521

📥 Commits

Reviewing files that changed from the base of the PR and between cdf67c1 and a0df023.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (275)
  • .changeset/finish-postgres-runtime-cutover.md
  • CONCEPTS.md
  • README.md
  • docs/PLUGIN_AUTHORING.md
  • docs/README.md
  • docs/architecture.md
  • docs/cli-reference.md
  • docs/dashboard-guide.md
  • docs/dashboard-realtime.md
  • docs/multi-project-sequencing.md
  • docs/multi-project.md
  • docs/performance/dashboard-load.md
  • docs/plugin-management.md
  • docs/postgres-migration-review-2026-06-26.md
  • docs/postgres-migration-review-2026-07-14.md
  • docs/research.md
  • docs/sandbox.md
  • docs/secrets.md
  • docs/settings-reference.md
  • docs/storage.md
  • docs/task-management.md
  • docs/todo-view.md
  • packages/cli/STANDALONE.md
  • packages/cli/skill/fusion/references/fusion-capabilities.md
  • packages/cli/skill/fusion/references/task-structure.md
  • packages/cli/src/__tests__/experiment-finalize.test.ts
  • packages/cli/src/__tests__/project-context-lifecycle.test.ts
  • packages/cli/src/__tests__/project-context.test.ts
  • packages/cli/src/__tests__/project-resolver.test.ts
  • packages/cli/src/commands/__tests__/agent-export.test.ts
  • packages/cli/src/commands/__tests__/agent-import.test.ts
  • packages/cli/src/commands/__tests__/agent.test.ts
  • packages/cli/src/commands/__tests__/desktop.test.ts
  • packages/cli/src/commands/__tests__/ensure-project-registered.test.ts
  • packages/cli/src/commands/__tests__/init.test.ts
  • packages/cli/src/commands/__tests__/message.test.ts
  • packages/cli/src/commands/__tests__/project-lock-retry.test.ts
  • packages/cli/src/commands/__tests__/research-lock-retry.test.ts
  • packages/cli/src/commands/__tests__/research.test.ts
  • packages/cli/src/commands/__tests__/serve.test.ts
  • packages/cli/src/commands/__tests__/settings-export.test.ts
  • packages/cli/src/commands/__tests__/settings-import-lock-retry.test.ts
  • packages/cli/src/commands/__tests__/settings-import.test.ts
  • packages/cli/src/commands/__tests__/task-lock-retry.test.ts
  • packages/cli/src/commands/agent-export.ts
  • packages/cli/src/commands/agent-import.ts
  • packages/cli/src/commands/agent.ts
  • packages/cli/src/commands/chat.ts
  • packages/cli/src/commands/daemon.ts
  • packages/cli/src/commands/dashboard.ts
  • packages/cli/src/commands/db.ts
  • packages/cli/src/commands/desktop.ts
  • packages/cli/src/commands/ensure-project-registered.ts
  • packages/cli/src/commands/experiment-finalize.ts
  • packages/cli/src/commands/init.ts
  • packages/cli/src/commands/message.ts
  • packages/cli/src/commands/mission.ts
  • packages/cli/src/commands/onboard-autolaunch.ts
  • packages/cli/src/commands/project.ts
  • packages/cli/src/commands/research.ts
  • packages/cli/src/commands/serve.ts
  • packages/cli/src/commands/settings-export.ts
  • packages/cli/src/commands/settings-import.ts
  • packages/cli/src/commands/workflow.ts
  • packages/cli/src/extension.ts
  • packages/cli/src/lock-retry.ts
  • packages/cli/src/project-context.ts
  • packages/cli/src/project-resolver.ts
  • packages/core/src/__tests__/planner-intervention.test.ts
  • packages/core/src/__tests__/planner-overseer-events.test.ts
  • packages/core/src/__tests__/plugin-hot-reload.test.ts
  • packages/core/src/__tests__/postgres-project-discovery.test.ts
  • packages/core/src/__tests__/postgres/archive-project-isolation.pg.test.ts
  • packages/core/src/__tests__/postgres/cli-session-store.pg.test.ts
  • packages/core/src/__tests__/postgres/embedded-lifecycle.test.ts
  • packages/core/src/__tests__/postgres/mission-store.pg.test.ts
  • packages/core/src/__tests__/postgres/operational-maintenance.pg.test.ts
  • packages/core/src/__tests__/postgres/plugin-schema-hook.test.ts
  • packages/core/src/__tests__/postgres/schema-applier.test.ts
  • packages/core/src/__tests__/postgres/startup-factory-integration.test.ts
  • packages/core/src/__tests__/postgres/startup-factory.test.ts
  • packages/core/src/__tests__/postgres/store-archive-reads.pg.test.ts
  • packages/core/src/__tests__/postgres/store-safe-defaults.pg.test.ts
  • packages/core/src/__tests__/postgres/task-lifecycle-e2e.pg.test.ts
  • packages/core/src/__tests__/postgres/workflow-authoritative-reads.pg.test.ts
  • packages/core/src/__tests__/project-identity.test.ts
  • packages/core/src/__tests__/sqlite-validation.test.ts
  • packages/core/src/__tests__/store-phantom-reservation-reconcile.test.ts
  • packages/core/src/agent-prompts.ts
  • packages/core/src/agent-store.ts
  • packages/core/src/async-archive-db.ts
  • packages/core/src/async-central-core.ts
  • packages/core/src/async-central-db.ts
  • packages/core/src/async-knowledge.ts
  • packages/core/src/async-mission-store-queries.ts
  • packages/core/src/async-mission-store.ts
  • packages/core/src/central-core.ts
  • packages/core/src/central-db.ts
  • packages/core/src/chat-store.ts
  • packages/core/src/cli-session-store.ts
  • packages/core/src/fs-watch-poll-controller.ts
  • packages/core/src/index.gate.ts
  • packages/core/src/index.ts
  • packages/core/src/migration.ts
  • packages/core/src/pi-extensions.ts
  • packages/core/src/planner-intervention.ts
  • packages/core/src/plugin-loader.ts
  • packages/core/src/plugin-types.ts
  • packages/core/src/postgres/embedded-lifecycle.ts
  • packages/core/src/postgres/index.ts
  • packages/core/src/postgres/migration-stamping.ts
  • packages/core/src/postgres/migrations/0008_mission_fix_idempotency.sql
  • packages/core/src/postgres/plugin-schema-hook.ts
  • packages/core/src/postgres/schema-applier.ts
  • packages/core/src/postgres/schema/index.ts
  • packages/core/src/postgres/schema/plugin.ts
  • packages/core/src/postgres/schema/project.ts
  • packages/core/src/postgres/sqlite-migrator.ts
  • packages/core/src/postgres/startup-factory.ts
  • packages/core/src/project-identity.ts
  • packages/core/src/project-root-guard.ts
  • packages/core/src/settings-export.ts
  • packages/core/src/sqlite-adapter.ts
  • packages/core/src/sqlite-validation.ts
  • packages/core/src/store.ts
  • packages/core/src/task-store/archive-lifecycle-2.ts
  • packages/core/src/task-store/async-archive-lineage.ts
  • packages/core/src/task-store/async-comments-attachments.ts
  • packages/core/src/task-store/async-lifecycle.ts
  • packages/core/src/task-store/async-maintenance.ts
  • packages/core/src/task-store/async-persistence.ts
  • packages/core/src/task-store/async-phantom-reservations.ts
  • packages/core/src/task-store/async-search.ts
  • packages/core/src/task-store/audit-ops.ts
  • packages/core/src/task-store/branch-group-ops.ts
  • packages/core/src/task-store/comments-ops.ts
  • packages/core/src/task-store/moves.ts
  • packages/core/src/task-store/reads.ts
  • packages/core/src/task-store/remaining-ops-1.ts
  • packages/core/src/task-store/remaining-ops-2.ts
  • packages/core/src/task-store/remaining-ops-3.ts
  • packages/core/src/task-store/remaining-ops-4.ts
  • packages/core/src/task-store/remaining-ops-5.ts
  • packages/core/src/task-store/remaining-ops-6.ts
  • packages/core/src/task-store/remaining-ops-7.ts
  • packages/core/src/task-store/remaining-ops-8.ts
  • packages/core/src/task-store/workflow-ops.ts
  • packages/core/src/types.ts
  • packages/dashboard/app/components/StorageMigrationNoticeBanner.css
  • packages/dashboard/app/components/StorageMigrationNoticeBanner.tsx
  • packages/dashboard/app/components/__tests__/StorageMigrationNoticeBanner.test.tsx
  • packages/dashboard/app/components/dashboard/DashboardBanners.tsx
  • packages/dashboard/src/__tests__/knowledge-index.pg.test.ts
  • packages/dashboard/src/__tests__/project-store-resolver.test.ts
  • packages/dashboard/src/__tests__/require-async-layer.test.ts
  • packages/dashboard/src/__tests__/routes-planning.test.ts
  • packages/dashboard/src/__tests__/routes-project-discovery.test.ts
  • packages/dashboard/src/__tests__/server-postgres-store-construction.test.ts
  • packages/dashboard/src/__tests__/setup-routes.test.ts
  • packages/dashboard/src/ai-session-store.ts
  • packages/dashboard/src/chat-project-services.ts
  • packages/dashboard/src/chat.ts
  • packages/dashboard/src/index.ts
  • packages/dashboard/src/knowledge-index.ts
  • packages/dashboard/src/monitor-trait.ts
  • packages/dashboard/src/otel-exporter.ts
  • packages/dashboard/src/planning.ts
  • packages/dashboard/src/project-store-resolver.ts
  • packages/dashboard/src/require-async-layer.ts
  • packages/dashboard/src/routes.ts
  • packages/dashboard/src/routes/monitor-routes.ts
  • packages/dashboard/src/routes/register-agent-core-routes.ts
  • packages/dashboard/src/routes/register-agent-runtime-routes.ts
  • packages/dashboard/src/routes/register-approval-routes.ts
  • packages/dashboard/src/routes/register-command-center-routes.ts
  • packages/dashboard/src/routes/register-git-github.ts
  • packages/dashboard/src/routes/register-knowledge-routes.ts
  • packages/dashboard/src/routes/register-messaging-scripts.ts
  • packages/dashboard/src/routes/register-project-routes.ts
  • packages/dashboard/src/routes/register-session-diff-routes.ts
  • packages/dashboard/src/routes/register-settings-memory-routes.ts
  • packages/dashboard/src/routes/register-settings-sync-routes.ts
  • packages/dashboard/src/routes/register-signal-routes.ts
  • packages/dashboard/src/routes/register-task-workflow-routes.ts
  • packages/dashboard/src/routes/register-worktrunk-routes.ts
  • packages/dashboard/src/server.ts
  • packages/dashboard/vitest.config.ts
  • packages/desktop/src/__tests__/local-runtime.test.ts
  • packages/desktop/src/__tests__/local-server.test.ts
  • packages/desktop/src/local-runtime.ts
  • packages/desktop/src/local-server.ts
  • packages/desktop/vitest.config.ts
  • packages/engine/src/__tests__/executor-fast-mode-workflows.test.ts
  • packages/engine/src/__tests__/in-process-runtime.pg.test.ts
  • packages/engine/src/__tests__/mission-execution-loop.test.ts
  • packages/engine/src/__tests__/planner-overseer-intervention-wiring.test.ts
  • packages/engine/src/__tests__/plugin-runner.test.ts
  • packages/engine/src/__tests__/project-engine-manager.test.ts
  • packages/engine/src/__tests__/reliability-interactions/engine-stop-aborts-execution.test.ts
  • packages/engine/src/__tests__/self-healing.test.ts
  • packages/engine/src/__tests__/workflow-authoritative-driver-async-selection.test.ts
  • packages/engine/src/__tests__/worktree-db-hydrate.test.ts
  • packages/engine/src/agent-heartbeat.ts
  • packages/engine/src/backlog-pressure-reporter.ts
  • packages/engine/src/cli-agent/__tests__/runtime-postgres.test.ts
  • packages/engine/src/cli-agent/runtime.ts
  • packages/engine/src/cli-agent/session-manager.ts
  • packages/engine/src/cron-runner.ts
  • packages/engine/src/dependency-blocked-todo-reporter.ts
  • packages/engine/src/effective-settings.ts
  • packages/engine/src/evaluator-evidence.ts
  • packages/engine/src/executor.ts
  • packages/engine/src/merger.ts
  • packages/engine/src/mesh-lease-manager.ts
  • packages/engine/src/mission-execution-loop.ts
  • packages/engine/src/plugin-runner.ts
  • packages/engine/src/project-engine-manager.ts
  • packages/engine/src/project-engine.ts
  • packages/engine/src/routine-runner.ts
  • packages/engine/src/runtimes/in-process-runtime.ts
  • packages/engine/src/scheduler.ts
  • packages/engine/src/self-healing.ts
  • packages/engine/src/unlinked-missions-advisory-reporter.ts
  • packages/engine/src/workflow-authoritative-driver.ts
  • packages/engine/src/worktree-acquisition.ts
  • packages/engine/src/worktree-db-hydrate.ts
  • packages/i18n/locales/en/app.json
  • packages/i18n/src/resources.d.ts
  • packages/plugin-sdk/src/index.ts
  • plugins/fusion-plugin-cli-printing-press/src/__tests__/executor-runtime-env.test.ts
  • plugins/fusion-plugin-cli-printing-press/src/__tests__/tools.test.ts
  • plugins/fusion-plugin-cli-printing-press/src/index.ts
  • plugins/fusion-plugin-cli-printing-press/src/routes/wizard-routes.ts
  • plugins/fusion-plugin-cli-printing-press/src/runtime/executor-runtime-env.ts
  • plugins/fusion-plugin-cli-printing-press/src/store/cli-press-store.ts
  • plugins/fusion-plugin-cli-printing-press/src/tools.ts
  • plugins/fusion-plugin-compound-engineering/src/index.ts
  • plugins/fusion-plugin-compound-engineering/src/schema.ts
  • plugins/fusion-plugin-compound-engineering/src/session/session-store.ts
  • plugins/fusion-plugin-compound-engineering/src/sync/pipeline-store.ts
  • plugins/fusion-plugin-even-realities-glasses/package.json
  • plugins/fusion-plugin-even-realities-glasses/src/__tests__/index.test.ts
  • plugins/fusion-plugin-even-realities-glasses/src/__tests__/notification-store.pg.test.ts
  • plugins/fusion-plugin-even-realities-glasses/src/__tests__/notification-store.test.ts
  • plugins/fusion-plugin-even-realities-glasses/src/__tests__/notifier.test.ts
  • plugins/fusion-plugin-even-realities-glasses/src/index.ts
  • plugins/fusion-plugin-even-realities-glasses/src/notifications/store.ts
  • plugins/fusion-plugin-even-realities-glasses/src/notifier.ts
  • plugins/fusion-plugin-even-realities-glasses/tsconfig.json
  • plugins/fusion-plugin-reports/README.md
  • plugins/fusion-plugin-reports/src/__tests__/report-store-provider.test.ts
  • plugins/fusion-plugin-reports/src/__tests__/tools.test.ts
  • plugins/fusion-plugin-reports/src/index.ts
  • plugins/fusion-plugin-reports/src/routes/report-approval-routes.ts
  • plugins/fusion-plugin-reports/src/routes/report-export-routes.ts
  • plugins/fusion-plugin-reports/src/routes/report-list-routes.ts
  • plugins/fusion-plugin-reports/src/store/report-store-provider.ts
  • plugins/fusion-plugin-reports/src/tools.ts
  • plugins/fusion-plugin-roadmap/src/routes/roadmap-routes.ts
  • plugins/fusion-plugin-whatsapp-chat/src/__tests__/auth-state.test.ts
  • plugins/fusion-plugin-whatsapp-chat/src/__tests__/connection.test.ts
  • plugins/fusion-plugin-whatsapp-chat/src/__tests__/index.test.ts
  • plugins/fusion-plugin-whatsapp-chat/src/__tests__/persistence.pg.test.ts
  • plugins/fusion-plugin-whatsapp-chat/src/auth-state.ts
  • plugins/fusion-plugin-whatsapp-chat/src/index.ts
  • plugins/fusion-plugin-whatsapp-chat/src/persistence.ts
  • scripts/__tests__/backfill-fn-4441-transition-evidence.test.mjs
  • scripts/backfill-fn-4441-transition-evidence.mjs
  • scripts/cache-stats.mjs
  • scripts/lib/backend-db.mjs
  • scripts/lib/test-quarantine.json
  • scripts/reconcile-fn-3909-identity.mjs
  • scripts/reconcile-task-state-consistency.mjs
  • scripts/restore-merge-sha-fn-3878.mjs
  • scripts/start-local.mjs

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fn-7952-postgres-runtime-cutover

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Preserve PostgreSQL-only store construction while carrying forward project-store reuse and lock-free multi-tab planning semantics. Serialize planning persistence so asynchronous state writes cannot land out of order.

Fusion-Task-Id: FN-7952
@gsxdsm

gsxdsm commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by the dependency-safe PostgreSQL cutover stack, with every PR below 100 changed files. Merge bottom-up: #2108 (core authority, 99 files) → #2109 (engine/dashboard runtime, 62) → #2110 (CLI/desktop/ops, 54) → #2111 (bundled plugins, 40) → #2112 (docs/release, 22). All replacement PRs are currently mergeable; local typechecks and the 478-test merge gate pass on each implementation layer.

@gsxdsm gsxdsm closed this Jul 15, 2026
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Fusion’s core runtime now treats PostgreSQL as the authoritative
metadata store without leaving current CLI, dashboard, desktop, or
engine composition roots uncompilable between stack layers. This is the
99-file foundation for the larger cutover: subsequent PRs migrate the
remaining consumers, plugins, and operator surfaces.

## Design decisions

- Runtime store construction fails closed when an asynchronous
PostgreSQL layer is unavailable; SQLite remains readable only at
explicit migration and identity-recovery boundaries.
- Project ownership is enforced across active, archived, workflow,
mission, analytics, and plugin-schema data.
- The small set of cross-package files in this layer are
compatibility-critical call sites required for a green intermediate
commit, not the complete consumer migration.
- Schema migration 0008 remains assigned to session-advisor state from
current `main`; mission lineage idempotency advances to 0009 so neither
invariant can be skipped.

## Validation

- All affected package typechecks pass: Core, Engine, Dashboard, CLI,
and Desktop.
- `pnpm test:gate` passes: 478 tests across the engine gate, PostgreSQL
core gate, and CLI workflow shape.
- The PR changes exactly 99 files.

## Stack

This is the base PR. Engine/dashboard, CLI/desktop/ops, plugins, and
docs/release follow as stacked PRs, each below 100 changed files.

Related: #2105


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

## Summary by CodeRabbit

* **New Features**
* PostgreSQL is now the standard runtime backend, with embedded
PostgreSQL enabled by default.
* Added project-scoped storage for tasks, archives, chat sessions,
missions, knowledge pages, and operational data.
* Improved archived-task search, filtering, pagination, and restoration.
* Added safer plugin schema initialization with validation and project
isolation.
* Added PostgreSQL-backed workflow, mission, validator, and dashboard
capabilities.

* **Bug Fixes**
  * Improved startup timeout cancellation and resource cleanup.
* Prevented cross-project data access and phantom reservation cleanup
errors.
* Ensured archived tasks remain read-only and asynchronous writes
complete reliably.
  * Retired SQLite opt-out settings with clear startup errors.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Engine and dashboard traffic now stays on the authoritative PostgreSQL
layer across execution, recovery, project discovery, planning sessions,
analytics, and shutdown. The dashboard no longer presents a migration
notice for a cutover that is already mandatory.

## Design decisions

- Runtime composition requires an async data layer instead of
constructing a hidden SQLite fallback.
- Engine workflow, mission, claim, and self-healing reads await their
PostgreSQL-backed store contracts.
- Project-scoped dashboard stores retain and close their backend owner
exactly once.
- The dashboard test quarantine entry remains paired with its Vitest
exclusion, preserving the repository’s deletion-ratchet policy.

## Validation

- Core, Engine, Dashboard, CLI, and Desktop typechecks pass on the
stacked branch.
- `pnpm test:gate` passes all 478 gate tests.
- This PR changes 62 files.

## Stack

- Depends on #2108.
- CLI/desktop/ops, plugins, and docs/release follow in later PRs.

Related: #2105


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

## Summary by CodeRabbit

* **New Features**
* Project discovery now recognizes projects using the
`.fusion/project.json` marker.
* Knowledge indexing and search are more reliable across project-scoped
storage.
* **Bug Fixes**
* Improved session, audit timeline, approval, monitoring, and analytics
data consistency.
* Prevented stale planning-session updates and project-store shutdown
races.
* Ensured chat usage and CLI session status are saved before continuing.
* **UI Changes**
* Removed the storage migration notice banner now that the PostgreSQL
transition is complete.
* **Reliability**
* Improved shutdown handling, workflow execution, and worktree behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

CLI commands, daemon/dashboard startup, packaged desktop startup, and
live-data maintenance scripts now share the mandatory PostgreSQL
lifecycle. Operators no longer risk a command silently reading or
writing a disconnected SQLite shadow when PostgreSQL setup fails.

## Design decisions

- Every startup owner retains and awaits its PostgreSQL shutdown
callback, including partial-startup failure paths.
- CLI project context and lock-retry flows resolve through asynchronous
project stores.
- Maintenance scripts use the shared backend helper; explicit database
migration/inspection remains the only CLI surface allowed to read legacy
SQLite sources.

## Validation

- CLI and Desktop typechecks pass on the stacked branch.
- `pnpm test:gate` passes all 478 gate tests.
- This PR changes 54 files.

## Stack

- Depends on #2109, which depends on #2108.
- Bundled plugins and docs/release follow in later PRs.

Related: #2105


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

## Summary by CodeRabbit

* **New Features**
* PostgreSQL is now the authoritative store for structured project and
task metadata.
* Projects can be recognized and initialized using
`.fusion/project.json`, without creating a legacy SQLite database.
  * CLI commands now retry transient PostgreSQL contention errors.

* **Bug Fixes**
* Improved cleanup when commands complete, fail, or run in the
background, preventing lingering resources.
  * Improved desktop, server, and session shutdown reliability.

* **Documentation**
* Updated storage and standalone binary guidance to reflect PostgreSQL
and legacy SQLite compatibility.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Operators and contributors now have one current contract for the
completed PostgreSQL cutover: PostgreSQL is mandatory runtime authority,
legacy SQLite files are read-only migration evidence, and rollback is
restore-based rather than a fallback toggle. The major changeset
communicates the same boundary to published CLI users.

## Operational guidance

- Documents the authoritative storage inventory and the five intentional
legacy SQLite readers.
- Defines maintenance-window migration, backup, restore-test, ownership,
and isolation checks.
- Clarifies lifecycle ownership for CLI, desktop, dashboard, engine, and
bundled plugins.
- Supersedes the earlier readiness review without deleting its
historical record.

## Validation

- Changeset format check passes.
- `pnpm test:gate` passes all 478 gate tests on the completed stack.
- Every file from the original oversized PR is represented in the
replacement stack; this PR changes 22 files.

## Stack

- Depends on #2111#2110#2109#2108.
- Merge bottom-up in that order.

Related: #2105
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Operators and contributors now have one current contract for the
completed PostgreSQL cutover: PostgreSQL is mandatory runtime authority,
legacy SQLite files are read-only migration evidence, and rollback is
restore-based rather than a fallback toggle. The major changeset
communicates the same boundary to published CLI users.

## Operational guidance

- Documents the authoritative storage inventory and the five intentional
legacy SQLite readers.
- Defines maintenance-window migration, backup, restore-test, ownership,
and isolation checks.
- Clarifies lifecycle ownership for CLI, desktop, dashboard, engine, and
bundled plugins.
- Supersedes the earlier readiness review without deleting its
historical record.

## Validation

- Changeset format check passes.
- `pnpm test:gate` passes all 478 gate tests on the completed stack.
- Every file from the original oversized PR is represented in the
replacement stack; this PR changes 22 files.

## Stack

- Depends on #2111#2110#2109#2108.
- Merge bottom-up in that order.

Related: #2105
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Operators and contributors now have one current contract for the
completed PostgreSQL cutover: PostgreSQL is mandatory runtime authority,
legacy SQLite files are read-only migration evidence, and rollback is
restore-based rather than a fallback toggle. The major changeset
communicates the same boundary to published CLI users.

## Operational guidance

- Documents the authoritative storage inventory and the five intentional
legacy SQLite readers.
- Defines maintenance-window migration, backup, restore-test, ownership,
and isolation checks.
- Clarifies lifecycle ownership for CLI, desktop, dashboard, engine, and
bundled plugins.
- Supersedes the earlier readiness review without deleting its
historical record.

## Validation

- Changeset format check passes.
- `pnpm test:gate` passes all 478 gate tests on the completed stack.
- Every file from the original oversized PR is represented in the
replacement stack; this PR changes 22 files.

## Stack

- Depends on #2111#2110#2109#2108.
- Merge bottom-up in that order.

Related: #2105
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Bundled plugins now persist shared runtime state in project-scoped
PostgreSQL tables instead of maintaining independent SQLite authority.
Reports, CLI Printing Press, Compound Engineering, Roadmap, Even
Realities, and WhatsApp all follow the same ownership and startup
contract as Fusion core.

## Design decisions

- Plugin schema hooks run through the host’s PostgreSQL owner and
enforce project isolation.
- The SDK exposes the host contract needed by bundled plugins without
importing engine internals.
- Legacy Roadmap ownership fixtures use the supported empty-owner
sentinel, preserving current composite primary/foreign keys while
exercising backfill behavior.
- The lockfile travels with the Even Realities PostgreSQL dependency so
packaged installs remain reproducible.

## Validation

- All six affected plugin builds pass.
- Affected plugin suites pass: 773 tests across Printing Press, Compound
Engineering, Even Realities, Reports, Roadmap, and WhatsApp.
- `pnpm test:gate` passes all 478 gate tests.
- This PR changes 40 files.

## Stack

- Depends on #2110#2109#2108.
- The documentation/release PR completes the stack.

Related: #2105


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

## Summary by CodeRabbit

* **Breaking Changes**
* PostgreSQL is now required for runtime storage; SQLite files are used
only as one-time migration inputs.
  * The legacy `FUSION_NO_EMBEDDED_PG` fallback has been removed.

* **New Features**
* Added project-isolated PostgreSQL storage for plugins, reports, tasks,
notifications, and other plugin data.
  * Added agent tools for reports and CLI service drafts.
  * Added PostgreSQL schema initialization support for plugin authors.

* **Bug Fixes**
  * Improved migration and recovery of legacy plugin state.
* Prevented cross-project data access and strengthened transactional
schema updates.

* **Documentation**
* Updated storage, migration, deployment, plugin authoring, CLI, and
dashboard guidance for PostgreSQL.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Fusion’s core runtime now treats PostgreSQL as the authoritative
metadata store without leaving current CLI, dashboard, desktop, or
engine composition roots uncompilable between stack layers. This is the
99-file foundation for the larger cutover: subsequent PRs migrate the
remaining consumers, plugins, and operator surfaces.

## Design decisions

- Runtime store construction fails closed when an asynchronous
PostgreSQL layer is unavailable; SQLite remains readable only at
explicit migration and identity-recovery boundaries.
- Project ownership is enforced across active, archived, workflow,
mission, analytics, and plugin-schema data.
- The small set of cross-package files in this layer are
compatibility-critical call sites required for a green intermediate
commit, not the complete consumer migration.
- Schema migration 0008 remains assigned to session-advisor state from
current `main`; mission lineage idempotency advances to 0009 so neither
invariant can be skipped.

## Validation

- All affected package typechecks pass: Core, Engine, Dashboard, CLI,
and Desktop.
- `pnpm test:gate` passes: 478 tests across the engine gate, PostgreSQL
core gate, and CLI workflow shape.
- The PR changes exactly 99 files.

## Stack

This is the base PR. Engine/dashboard, CLI/desktop/ops, plugins, and
docs/release follow as stacked PRs, each below 100 changed files.

Related: #2105


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

## Summary by CodeRabbit

* **New Features**
* PostgreSQL is now the standard runtime backend, with embedded
PostgreSQL enabled by default.
* Added project-scoped storage for tasks, archives, chat sessions,
missions, knowledge pages, and operational data.
* Improved archived-task search, filtering, pagination, and restoration.
* Added safer plugin schema initialization with validation and project
isolation.
* Added PostgreSQL-backed workflow, mission, validator, and dashboard
capabilities.

* **Bug Fixes**
  * Improved startup timeout cancellation and resource cleanup.
* Prevented cross-project data access and phantom reservation cleanup
errors.
* Ensured archived tasks remain read-only and asynchronous writes
complete reliably.
  * Retired SQLite opt-out settings with clear startup errors.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Engine and dashboard traffic now stays on the authoritative PostgreSQL
layer across execution, recovery, project discovery, planning sessions,
analytics, and shutdown. The dashboard no longer presents a migration
notice for a cutover that is already mandatory.

## Design decisions

- Runtime composition requires an async data layer instead of
constructing a hidden SQLite fallback.
- Engine workflow, mission, claim, and self-healing reads await their
PostgreSQL-backed store contracts.
- Project-scoped dashboard stores retain and close their backend owner
exactly once.
- The dashboard test quarantine entry remains paired with its Vitest
exclusion, preserving the repository’s deletion-ratchet policy.

## Validation

- Core, Engine, Dashboard, CLI, and Desktop typechecks pass on the
stacked branch.
- `pnpm test:gate` passes all 478 gate tests.
- This PR changes 62 files.

## Stack

- Depends on #2108.
- CLI/desktop/ops, plugins, and docs/release follow in later PRs.

Related: #2105


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

## Summary by CodeRabbit

* **New Features**
* Project discovery now recognizes projects using the
`.fusion/project.json` marker.
* Knowledge indexing and search are more reliable across project-scoped
storage.
* **Bug Fixes**
* Improved session, audit timeline, approval, monitoring, and analytics
data consistency.
* Prevented stale planning-session updates and project-store shutdown
races.
* Ensured chat usage and CLI session status are saved before continuing.
* **UI Changes**
* Removed the storage migration notice banner now that the PostgreSQL
transition is complete.
* **Reliability**
* Improved shutdown handling, workflow execution, and worktree behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

CLI commands, daemon/dashboard startup, packaged desktop startup, and
live-data maintenance scripts now share the mandatory PostgreSQL
lifecycle. Operators no longer risk a command silently reading or
writing a disconnected SQLite shadow when PostgreSQL setup fails.

## Design decisions

- Every startup owner retains and awaits its PostgreSQL shutdown
callback, including partial-startup failure paths.
- CLI project context and lock-retry flows resolve through asynchronous
project stores.
- Maintenance scripts use the shared backend helper; explicit database
migration/inspection remains the only CLI surface allowed to read legacy
SQLite sources.

## Validation

- CLI and Desktop typechecks pass on the stacked branch.
- `pnpm test:gate` passes all 478 gate tests.
- This PR changes 54 files.

## Stack

- Depends on #2109, which depends on #2108.
- Bundled plugins and docs/release follow in later PRs.

Related: #2105


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

## Summary by CodeRabbit

* **New Features**
* PostgreSQL is now the authoritative store for structured project and
task metadata.
* Projects can be recognized and initialized using
`.fusion/project.json`, without creating a legacy SQLite database.
  * CLI commands now retry transient PostgreSQL contention errors.

* **Bug Fixes**
* Improved cleanup when commands complete, fail, or run in the
background, preventing lingering resources.
  * Improved desktop, server, and session shutdown reliability.

* **Documentation**
* Updated storage and standalone binary guidance to reflect PostgreSQL
and legacy SQLite compatibility.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
gsxdsm added a commit that referenced this pull request Jul 15, 2026
## Summary

Bundled plugins now persist shared runtime state in project-scoped
PostgreSQL tables instead of maintaining independent SQLite authority.
Reports, CLI Printing Press, Compound Engineering, Roadmap, Even
Realities, and WhatsApp all follow the same ownership and startup
contract as Fusion core.

## Design decisions

- Plugin schema hooks run through the host’s PostgreSQL owner and
enforce project isolation.
- The SDK exposes the host contract needed by bundled plugins without
importing engine internals.
- Legacy Roadmap ownership fixtures use the supported empty-owner
sentinel, preserving current composite primary/foreign keys while
exercising backfill behavior.
- The lockfile travels with the Even Realities PostgreSQL dependency so
packaged installs remain reproducible.

## Validation

- All six affected plugin builds pass.
- Affected plugin suites pass: 773 tests across Printing Press, Compound
Engineering, Even Realities, Reports, Roadmap, and WhatsApp.
- `pnpm test:gate` passes all 478 gate tests.
- This PR changes 40 files.

## Stack

- Depends on #2110#2109#2108.
- The documentation/release PR completes the stack.

Related: #2105


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

## Summary by CodeRabbit

* **Breaking Changes**
* PostgreSQL is now required for runtime storage; SQLite files are used
only as one-time migration inputs.
  * The legacy `FUSION_NO_EMBEDDED_PG` fallback has been removed.

* **New Features**
* Added project-isolated PostgreSQL storage for plugins, reports, tasks,
notifications, and other plugin data.
  * Added agent tools for reports and CLI service drafts.
  * Added PostgreSQL schema initialization support for plugin authors.

* **Bug Fixes**
  * Improved migration and recovery of legacy plugin state.
* Prevented cross-project data access and strengthened transactional
schema updates.

* **Documentation**
* Updated storage, migration, deployment, plugin authoring, CLI, and
dashboard guidance for PostgreSQL.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant