Skip to content

fix(incremental): pass bare file labels to resolver context - #5678

Open
Max17190 wants to merge 1 commit into
Graphify-Labs:v8from
Max17190:fix/incremental-context-file-labels
Open

Max17190 wants to merge 1 commit into
Graphify-Labs:v8from
Max17190:fix/incremental-context-file-labels

Conversation

@Max17190

@Max17190 Max17190 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Why

Incremental updates build resolver context from graph.json, which stores colliding file labels as directory suffixes such as lib/index.ts (#2032). The JS/TS barrel and Markdown citation resolvers find a file node by its bare basename. So editing an importer of such a barrel, or a doc that links such a file, dropped those edges until a full rebuild. Fixes #5675.

Summary

resolver_file_labels runs the build's relabel selection again over the persisted nodes and returns the basename for exactly the nodes a build qualified. The context builders for update, watch and graphify extract use it. Ids and persisted labels do not change, and an external @scope/package node keeps its label.

On tauri, after appending a comment to packages/api/src/tray.ts and a line to packages/api-e2e/README.md, the incremental graph on v8 was missing 8 edges and had 2 extra compared with a cold build of the edited tree. With this change it matches the cold build, and so do all node labels. Cold builds do not run this code.

Limitations: for a shared __init__.py, this restores Markdown citations, but the import and call edges also need the fix for #5676.

Test plan

python -m pytest tests -q -n 4 --dist loadfile   # 12640 passed
python -m pytest tests/test_incremental_qualified_file_labels.py -q   # 3 passed; all 3 fail on v8
uv run ruff check .                              # passes
uv run pyright --pythonpath .venv/bin/python     # same diagnostics as v8
uv run python -m tools.skillgen --check          # 134 artifacts match
graphify update .   # tauri, incremental after two edits, compared with a cold build of the edited tree
  • Read CONTRIBUTING.md
  • AI help disclosed in the commit trailer

graph.json stores colliding file labels as directory suffixes such as
lib/index.ts (Graphify-Labs#2032). The incremental resolver context for update,
watch and extract copied that label, but the JS/TS barrel and Markdown
citation resolvers find a file node by its bare basename. Editing an
importer of such a barrel, or a doc that links such a file, dropped
those edges and created a phantom import target until a full rebuild.

Run the relabel selection again over the persisted nodes and give the
resolvers the basename for exactly the nodes a build qualified. Other
labels that contain a slash, such as an external @scope/package module,
are left alone. Ids and persisted labels do not change.

Fixes Graphify-Labs#5675

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Max17190
Max17190 requested a review from safishamsi as a code owner December 1, 2026 06:55
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Thanks for the pull request, @Max17190. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic.

@github-actions github-actions Bot added the contributor Pull request from a returning community contributor label Dec 1, 2026

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify review View in Graphify

Looks safe to merge · Merge confidence 5/5

No issues reported · High impact

Incremental rebuilds now translate qualified persisted file labels back to basenames when assembling resolver context.

Code graph · 2750 functions depend on this change
  • 1 function became more coupled. dispatch_command() (8 callers).
  • 253 of 666 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Reviewed d7f414d

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor Pull request from a returning community contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incremental update drops JS/TS barrel imports and Markdown file citations when two files share a basename

1 participant