fix(automations): treat projectId-only requests as project-scoped
Dashboard's Automations page calls GET /api/automations?projectId=X without &scope=project. The previous resolveAutomationStore() defaulted scope=undefined to the global store, hiding project-local automations from the UI list. Fix: prefer project store when projectId is present, fall through to global only when scope=global is explicit. Surfaced while wiring the sase changelog auto-publisher — the automation record existed in the project DB but the UI showed 'No automations yet'.
This commit is contained in:
@@ -222,7 +222,7 @@ export function createApiRoutesContext(store: TaskStore, options?: ServerOptions
|
||||
const projectId = getProjectIdFromRequest(req);
|
||||
const engineManager = options?.engineManager;
|
||||
|
||||
if (scope === "global" || scope === undefined) {
|
||||
if (scope === "global") {
|
||||
const defaultStore = options?.automationStore;
|
||||
if (!defaultStore) {
|
||||
throw new ApiError(503, "Automation store not available");
|
||||
@@ -230,6 +230,9 @@ export function createApiRoutesContext(store: TaskStore, options?: ServerOptions
|
||||
return defaultStore;
|
||||
}
|
||||
|
||||
// scope === "project" OR (scope undefined && projectId present)
|
||||
// Dashboard sends `?projectId=X` without `&scope=project`; treat that as
|
||||
// project-scoped to surface per-project automations in the UI list view.
|
||||
if (projectId && engineManager) {
|
||||
const engine = engineManager.getEngine(projectId);
|
||||
if (engine) {
|
||||
|
||||
Reference in New Issue
Block a user