Repository navigation
fix(sync): record only indexed files as synthesis inputs - #2688
Merged
Merged
Conversation
A sync whose code lazy-loads a workspace package failed with "FOREIGN KEY
constraint failed" and rolled back, and every later sync did the same
(issue 2565). lazyValueModules names the module a lazy value loads as a
synthesis input, and for `import('icons')` or `import('@vben/layouts')`
the resolver gives the package directory, which is not an indexed file.
synthesis_inputs.file_path references files(path), so the stage's publish
step failed. A file that leaves the index while the passes run broke it
the same way.
Both places that write synthesis_inputs now keep only paths the files
table holds: replaceSynthesisInputs on the index, and SynthesisStage's
publish, inside its write transaction. The directory never matched a
changed file anyway, so nothing is lost.
A/B on main 3308cff: fresh indexes of vben, excalidraw and zod are
byte-identical; vben's sync after editing its five layouts/index.ts files
exits 1 on main and 0 here, and the synced graph equals a fresh index of
the edited tree.
Reported by @bompus; @inth3shadows found the same cause.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
danusha2345
pushed a commit
to danusha2345/codegraph
that referenced
this pull request
Oct 20, 2026
…eam as colbymchenry#2688 Reverts the four colbymchenry#2574 commits (98be01f, 9769065, 2bc5180, d194b4c); the maintainer's own fix for colbymchenry#2565 comes in with the next merge of main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
danusha2345
pushed a commit
to danusha2345/codegraph
that referenced
this pull request
Oct 20, 2026
…Rust Self:: and std impls, colbymchenry#2688 synthesis inputs, first foreign merges) Conflicts: name-matcher takes main's `isGoOutsideImport` family in place of colbymchenry#1954's `isGoExternalImport`; keeps colbymchenry#1942's Java same-language preference and colbymchenry#1947's `cls` beside main's `withinCppTranslationUnit`; colbymchenry#1949's Java static field block and main's Rust `Self::` block both stay; colbymchenry#1935's `findOwnMethod` gets main's Go standard-method-name condition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
inth3shadows
added a commit
to inth3shadows/codegraph
that referenced
this pull request
Oct 21, 2026
Upstream merged 17 of the fork's carried PRs on 2026-10-20 (several squashed, some with maintainer edits; colbymchenry#1704's content landed inside colbymchenry#1926). Every conflict was our pre-merge copy of one of them, so the upstream side was taken throughout. After the merge the tree differs from upstream only by colbymchenry#1842, its test-flag fix, .gitignore, the untracked .pyc and the README banner. Dropped __tests__/sync-synthesis-input-package.test.ts: colbymchenry#2574 was superseded by upstream colbymchenry#2688, which does not normalize spellings like `@/widgets/Chart/`. That gap is colbymchenry#2577; it is carried separately via colbymchenry#2610.
inth3shadows
added a commit
to inth3shadows/codegraph
that referenced
this pull request
Oct 21, 2026
…fixes colbymchenry#2577) Carries upstream PR colbymchenry#2610 by @JiaMingWang-CN. Restores the fork's end-to-end test from colbymchenry#2574 (sync-synthesis-input-package), which upstream's colbymchenry#2688 alone fails on the `@/widgets/Chart/` and `src/widgets/./Chart` spellings and which passes with colbymchenry#2610.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2565.
What was wrong
codegraph syncexits 1 withFailed to sync: FOREIGN KEY constraint failedin a project whose code lazy-loads a workspace package, and every later sync fails the same way. A full index of the same tree succeeds. @bompus's report bisects it to #2420 and pins the cause:lazyValueModulesnames the module a lazy value loads as a synthesis input, so a sync that changes the module redraws the JSX that names the value.dynamic(() => import('icons').then((mod) => mod.EdgeFunctions))(Supabase Studio), the resolver hands back the package directory,packages/icons. vben's() => import('@vben/layouts').then((m) => m.IFrameView)does the same in five apps.synthesis_inputs.file_pathreferencesfiles(path). The stage's publish step therefore fails on the directory, and the whole sync rolls back.What changed
Both places that write
synthesis_inputsnow keep only paths thefilestable holds:QueryBuilder.replaceSynthesisInputs, which writes to the index directly;SynthesisStage.publish, inside itsBEGIN IMMEDIATEwrite transaction. That also covers a file leaving the index while the passes run.A directory never matched a changed file, so dropping it loses nothing.
Not in scope: resolving a workspace package's lazy import to its entry file. With that, the value would reach
EdgeFunctions, and an edit to the entry would redraw it. Today the lookup reads the directory and finds nothing, before and after this change.Tests (
__tests__/sync-synthesis-inputs.test.ts)src/App.tsxlazy-loadingicons, two syncs after edits, then the graph compared with a fresh index of the final tree.replaceSynthesisInputskeeps only indexed files (packages/iconsand a deleted path dropped).SynthesisStage.publishkeeps only indexed files, whatever reached the stage's own list.A/B: main 3308cff vs this branch, native kernel built from the same source
scripts/dump-graph.mjs).apps/*/src/layouts/index.tsfiles, thencodegraph sync.FOREIGN KEY constraint failed.Credit
Reported and diagnosed by @bompus. @inth3shadows found the same cause and opened #2574 for it; this is our own implementation, and the CHANGELOG thanks both.
🤖 Generated with Claude Code