Skip to content

Perf: index AST file labels during mention deduplication - #5673

Open
sdivyanshu90 wants to merge 1 commit into
Graphify-Labs:v8from
sdivyanshu90:perf/index-file-mention-dedup
Open

sdivyanshu90 wants to merge 1 commit into
Graphify-Labs:v8from
sdivyanshu90:perf/index-file-mention-dedup

Conversation

@sdivyanshu90

Copy link
Copy Markdown
Contributor

Fixes #5671

Summary

  • Index AST file nodes by basename and directory-qualified suffix before resolving semantic file mentions.
  • Use the same label lookup in saved-graph shrink accounting and index same-source candidates separately.
  • Keep ambiguous file labels and mentions with independent semantic evidence intact.

Validation

  • The lookup-count regression fails on upstream and passes with this change.
  • python -m pytest -q tests/test_file_mention_index.py tests/test_build*.py tests/test_shrink_guard*.py → 201 passed.
  • ruff check . → passed.
  • In a local synthetic run with 8,000 AST file nodes and 8,000 semantic mentions, build time dropped from 31.5 s to 1.5 s. Both runs shared the machine with ongoing test suites.
  • python -m pyright --outputjson → same diagnostics as clean upstream (1,258 errors and 241 warnings in this environment).
  • python -m graphify update . → completed.
  • python -m pytest tests -q → 12,592 passed, 147 skipped, 2 xfailed, and 17 failures. The same 17 tests fail on clean upstream in this environment.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Thanks for the pull request, @sdivyanshu90. 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 contributor Pull request from a returning community contributor needs:title PR title should follow the conventional-commit format labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Thanks @sdivyanshu90! One small thing: our changelog and release notes are built from PR titles, so we use the conventional-commits format, for example:

fix(python): resolve a bare stdlib import correctly

Prefixes we use: feat, fix, docs, chore, refactor, test, perf, build, ci. Editing the PR title clears this automatically. This is just a nudge and does not block review.

@sdivyanshu90

Copy link
Copy Markdown
Contributor Author

@safishamsi Could you please review this PR?

@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

What this review covered
  • We didn't review 1 file that isn't source code, such as docs, config, images, or generated or third-party code.
  • 2 of 2 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 2375 functions depend on this change
  • 2 functions became more coupled. build_from_json() (355 callers), _lost_saved_semantic_nodes() (25 callers).
  • 666 of 666 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Reviewed bfa5001

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 needs:title PR title should follow the conventional-commit format

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graph assembly scans every AST file for every semantic file mention

1 participant