fix: bind fallback CentralCore to the async layer so projectId-only boots resolve projects on PostgreSQL
getOrCreateForProjectImpl constructed its fallback CentralCore without the caller's AsyncDataLayer. Post-cutover a layer-less CentralCore has no database at all (the SQLite CentralDatabase path is deleted and init() degrades to a no-op), so project lookups returned empty and every projectId-only boot through the startup factory (engine InProcessRuntime, dashboard project-store-resolver) failed with 'Project "<id>" not found' even though central.projects had the row — dashboard UI came up but the engine never connected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
7
.changeset/pg-central-core-layer-bound-project-lookup.md
Normal file
7
.changeset/pg-central-core-layer-bound-project-lookup.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@runfusion/fusion": patch
|
||||
---
|
||||
|
||||
summary: Fix engine failing to connect after the PostgreSQL migration with "Project not found".
|
||||
category: fix
|
||||
dev: getOrCreateForProjectImpl built its fallback CentralCore without the AsyncDataLayer; post-cutover a layer-less CentralCore has no database (legacy SQLite CentralDatabase is deleted), so projectId-only boots (engine InProcessRuntime, dashboard project-store-resolver) threw ProjectRequiredError despite the row existing in central.projects. The fallback is now bound to the caller's layer.
|
||||
@@ -43,7 +43,19 @@ import {listGoalCitations as listGoalCitationsAsync} from "../task-store/async-e
|
||||
import type {GoalCitationRow, RunAuditEventRow} from "../task-store/row-types.js";
|
||||
|
||||
export async function getOrCreateForProjectImpl(store: typeof TaskStore, projectId?: string, centralCore?: CentralCore, globalSettingsDir?: string, asyncLayer?: AsyncDataLayer,): Promise<TaskStore> {
|
||||
const central = centralCore ?? new CentralCore();
|
||||
/*
|
||||
FNXC:PostgresCutover 2026-07-13-20:05:
|
||||
The fallback CentralCore must be bound to the caller's AsyncDataLayer.
|
||||
Post-cutover, a layer-less CentralCore has no database at all (legacy
|
||||
SQLite CentralDatabase is deleted; init() is a graceful no-op with
|
||||
db=null), so project lookups return empty and resolveProjectContext
|
||||
throws ProjectRequiredError — surfaced as `Project "<id>" not found`
|
||||
even though central.projects in PostgreSQL has the row. This broke every
|
||||
projectId-only boot through the startup factory (engine InProcessRuntime,
|
||||
dashboard project-store-resolver): dashboard UI came up but the engine
|
||||
never connected.
|
||||
*/
|
||||
const central = centralCore ?? new CentralCore(undefined, asyncLayer ? { asyncLayer } : {});
|
||||
let initializedHere = false;
|
||||
|
||||
if (!centralCore) {
|
||||
|
||||
Reference in New Issue
Block a user