You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codegraph sync fails with "FOREIGN KEY constraint failed" after d0bb9be5 when a file lazy-loads a workspace package #2565
codegraph sync exits 1 with Failed to sync: FOREIGN KEY constraint failed whenever a changed .tsx file declares a PascalCase value that lazy-loads a workspace package, such as const EdgeFunctions = dynamic(() => import('icons').then((mod) => mod.EdgeFunctions)). A full index of the same project succeeds. Supabase's studio app has this pattern, and every sync after any edit to that app fails there.
Reproduction (a pnpm workspace with one package, one file): pnpm-workspace.yaml with packages/*; root package.json with workspaces: ["packages/*"] and a react dependency; packages/icons/package.json{"name":"icons","main":"./src/icons/index.ts"}; packages/icons/src/icons/index.ts exporting EdgeFunctions; and src/App.tsx:
It reproduces on upstream/main at eec9288a, and passes at 9b237093, the parent of d0bb9be5 (#2420). A git bisect over the 15 commits since 34dd3d2f, using a supabase checkout and a one-line edit to apps/studio/data/projects/clone-mutation.ts, ends at d0bb9be5.
Cause: lazyValueModules (added in #2420) records the module a lazy value loads as a synthesis input. For import('icons') the resolver returns the package directory, packages/icons, which is not an indexed file. The commit step copies the inputs into synthesis_inputs, whose file_path references files(path), so the insert fails and the whole sync rolls back. (Checked by listing the input rows missing from files when the commit fails: the only one is packages/icons.)
Possible fix: keep only paths that are in files when recording synthesis inputs.
Versions: upstream eec9288a and 3f714bcc, Node 24, Linux.
Activity
test(sync): pin the inputs a full index records too, which it left em…
fix(sync): store synthesis inputs under the indexed path, in one place (
fix(sync): re-check synthesis inputs against files inside publish's w…
fix(sync): record only indexed files as synthesis inputs (colbymchenr…
test(sync): pin the inputs a full index records too, which it left em…
fix(sync): store synthesis inputs under the indexed path, in one place (
fix(sync): re-check synthesis inputs against files inside publish's w…
integration: drop colbymchenry#2574 (synthesis inputs) — landed upstr…