Skip to content

fix(extract): refresh JS/TS edges after resolver changes - #5534

Closed
rvitaliy wants to merge 1 commit into
Graphify-Labs:v8from
rvitaliy:fix/extract-refresh-js-resolution
Closed

rvitaliy wants to merge 1 commit into
Graphify-Labs:v8from
rvitaliy:fix/extract-refresh-js-resolution

Conversation

@rvitaliy

Copy link
Copy Markdown
Contributor

What does this PR do?

Apply the resolver-input invalidation used by graphify update to the incremental graphify extract path. An alias can change the target of an import or call even when every importer has identical source bytes.

Treat admitted resolver inputs as incremental inputs and re-extract the live code corpus when one changes. Use fresh JS/TS resolution context for that pass, then merge through the existing graph path. Skipped lockfiles are recorded as resolver inputs outside the graph corpus. Ordinary source edits still use an incremental AST batch.

Verification & Invariants

  • Retargeting, adding, and removing an inherited tsconfig mapping produces the same import and call edges as a clean extraction in both raw and clustered mode.
  • A lockfile-only change triggers a code refresh and subsequent warm extracts settle. An ordinary one-file edit still processes only that file.
  • The resolver refresh reparses Astro frontmatter in both sequential and parallel runs. Fresh results populate the existing Astro cache for ordinary warm runs.
  • An incomplete AST refresh retains the previous resolver stamp so the next run can retry, including after deletion of the last resolution input.
  • With --allow-partial, reverting the config to its previous contents after publishing a partial graph can require --force. The retry uses the retained resolver snapshot.

How was this tested?

uv run --frozen pytest tests/ -q --tb=short -n 6 -m 'not serial'
uv run --frozen pytest tests/ -q --tb=short -m serial
uv run --frozen ruff check .
uv run --frozen pyright --outputjson
uv run --frozen graphify update . --no-cluster

Pyright reports the same 782 diagnostics on the base and on this branch. Related to #5017 and #5022, which cover the same invalidation boundary for graphify update.

Fixes #5533

Re-extract the live code corpus when a resolver input changes and refresh its Astro cache only for resolver refreshes and explicit full scans.

Fixes Graphify-Labs#5533

Co-authored-by: Codex <[email protected]>
@rvitaliy
rvitaliy requested a review from safishamsi as a code owner November 27, 2026 01:10
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @rvitaliy. 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 Nov 27, 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

Nothing blocking · 6 possible issues to check · Merge confidence 5/5

6 possible issues to check · High impact

The extract command now compares resolver-input changes against the manifest and re-extracts the code corpus when those inputs change, while preserving the existing graph’s semantic layer.

6 possible issues we couldn't confirm
  • When JS/TS resolver inputs change, the Terraform path refresh is skipped · graphify/cli.py:5057
  • Ignored lockfiles are no longer tracked as resolution inputs, so edits to them stop triggering a JS/TS refresh · graphify/detect.py:2375
  • Lockfiles still on disk but skipped by the scan can make the JS/TS refresh flag true on every incremental run · graphify/detect.py:3388
  • +3 more in Graphify

They don't change the score.

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.
  • 4 of 4 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 6223 functions depend on this change
  • 3 functions became more coupled. main() (131 callers), detect_incremental() (33 callers), dispatch_command() (8 callers).
  • 643 of 643 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Reviewed 2271397

@safishamsi

Copy link
Copy Markdown
Member

Shipped in v0.9.122 (authorship-preserving cherry-pick) — fixes a real stale-edge silent corruption when a resolver input (e.g. a tsconfig alias) retargets an import. Reconciled one cli.py line with #5528 at merge (saved_graph is not None and not _refresh_js_resolution). One non-blocking follow-up: routing #5531's no-op manifest save through _save_extract_manifest would keep lockfile resolution-inputs tracked across no-ops. Thanks @rvitaliy!

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.

[Bug]: Incremental extract keeps stale TypeScript edges after an alias change

2 participants