Skip to content

fix(watch): refresh JS/TS imports after resolver input changes - #5022

Closed
azizur100389 wants to merge 1 commit into
Graphify-Labs:v8from
azizur100389:codex/refresh-js-config
Closed

azizur100389 wants to merge 1 commit into
Graphify-Labs:v8from
azizur100389:codex/refresh-js-config

Conversation

@azizur100389

@azizur100389 azizur100389 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5017.

What does this PR do?

The imports_from edge still points to old/target.ts. Adding or deleting the config also leaves the unchanged importer unresolved or attached to the old file.

The manifest-derived update checks ordinary config files and separately detected resolver inputs such as pnpm-lock.yaml. Added, modified, deleted, or excluded resolver inputs select the full rebuild so untouched importers can resolve again. Ordinary source changes still take the incremental path.

Reproduction

  1. Put export function target() {} in both old/target.ts and new/target.ts.
  2. In main.ts, import target from @app/target and call it from an exported function.
  3. Set compilerOptions.baseUrl to . and compilerOptions.paths to {"@app/*":["./old/*"]} in tsconfig.json.
  4. Run graphify update . --no-cluster. Change only the alias to ./new/* and run the same command.

Verification

  • uv sync --all-extras --frozen on Python 3.12.
  • python -m pytest -q --tb=short tests/test_update_js_resolution_inputs.py — 4 passed. The new failure cases reproduce on unchanged v8 at 59b5ab11.
  • python -m ruff check ., python -m pre_commit run --all-files, and all five python -m tools.skillgen checks passed.
  • GitHub CI passed on Python 3.10, 3.12, 3.13 and 3.14 with 9996 tests passed per version, 20 built-in skips and one expected failure. The 20 Bun Pi guard tests and CLI install smoke checks passed.
  • Fresh wheel installation, CLI help, skill install and AST-only graph update passed on Windows. Pyright, Bandit, pip-audit and native Bun results match clean v8.
  • Full Windows Python 3.12 suite: 9827 passed, 29 failed, 159 built-in skips and one expected failure. Clean v8 reproduced 29 failing test IDs. This Windows full run was collected before the lockfile case was added. The final focused Windows run and full Linux matrix include that case. A separate Windows fixture confirmed that a config change combined with deletion of AST and semantic sources refreshes the import and removes both deleted sources.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thanks for the pull request, @azizur100389. 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.10 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 5, 2026
@azizur100389
azizur100389 marked this pull request as ready for review November 5, 2026 11:14

@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 reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 not verified).

Formal verification. PR-changed functions: 0/1 verified (0 proven, 0 may-equivalent, 0 distinguished) · 1 not verified (1 unsupported).

Not verified on this run: \_rebuild\_code (unsupported).


Graphify review — findings

Fixes incremental _rebuild_code so a change to a JS/TS resolution input (tsconfig, workspace layout, lockfile) re-resolves unchanged importers instead of leaving their imports_from edges stale. It feeds resolution_inputs through manifest classification, and when any is modified, deleted or excluded it skips the incremental change set and falls back to a full code-graph rebuild, which means the deleted-row set is no longer handed to the rebuild on that path. Adds tests covering edit, remove and add of a tsconfig path alias, plus a lockfile-only change that re-extracts the importer once and then settles.

Worth a look

  • Resolution-input full rebuild drops explicit deleted rows (shrink guard / stale nodes) — graphify/watch.py:2445 · Escalate · medium
    • NOT verified (no proof, no reproducing execution) — needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 717 functions depend on the 127 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: _rebuild_code() — 255 callers, 74 callees

Verification — 717 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 449 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

37 of 519 test file(s) selected (7%) via static blast radius.

  • tests/test_cache_stale_import_target.py — impact
  • tests/test_code_only_scope_4923.py — impact
  • tests/test_compact_graph_json.py — impact
  • tests/test_csharp_method_owner_labels.py — impact
  • tests/test_elixir_import_resolution.py — impact
  • tests/test_elixir_qualified_calls.py — impact
  • tests/test_elixir_unqualified_call_scope.py — impact
  • tests/test_export_direction.py — impact
  • tests/test_external_stub_endpoints.py — impact
  • tests/test_go_receiver_member_calls.py — impact
  • tests/test_incremental_unscanned_placeholders.py — impact
  • tests/test_java_member_calls.py — impact
  • tests/test_kotlin_grammar.py — impact
  • tests/test_labeling.py — impact
  • tests/test_language_override_lifecycle.py — impact
  • tests/test_linked_worktree_reconcile.py — impact
  • tests/test_lost_saved_semantic_nodes.py — impact
  • tests/test_markdown_code_spans.py — impact
  • tests/test_no_cluster_undeclared_endpoints.py — impact
  • tests/test_pr10_watch_overrides.py — impact
  • tests/test_python_inherited_method_calls.py — impact
  • tests/test_python_injected_factory_calls.py — impact
  • tests/test_python_property_reads.py — impact
  • tests/test_python_pytest_fixture_receivers.py — impact
  • tests/test_rust_use_trees.py — impact
  • tests/test_semantic_origin_stamp.py — impact
  • tests/test_skill_persisted_scan_options.py — impact
  • tests/test_solidity_inherited_calls.py — impact
  • tests/test_terraform_modules.py — impact
  • tests/test_undirected_two_file_import_cycle.py — impact
  • tests/test_update_incremental.py — impact
  • tests/test_update_js_resolution_inputs.py — impact, changed-test
  • tests/test_update_lock_contention.py — impact
  • tests/test_update_no_change_gate.py — impact
  • tests/test_watch.py — impact
  • tests/test_watch_identity_cache.py — impact
  • tests/test_watch_manifest_location.py — impact

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Formal verification

Could not verify: Could not verify \_rebuild\_code.

The verifier did not have enough to check \_rebuild\_code, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: no capturable inputs from the test suite; property tier: nondeterministic output (both versions disagreed with themselves on the witness) — not a behaviour change; a function whose output is not a function of its inputs (random / time / uuid / os.urandom, or state carried across calls) cannot be soundly distinguished by execution, so this tier abstains for the whole function

· 1 more finding(s) on lines outside this diff (see the check run).

@safishamsi

Copy link
Copy Markdown
Member

Landed on v8 and shipped in 0.9.104 (now on PyPI). I cherry-picked your commit with -x so it keeps your authorship. Thanks for refreshing JS/TS imports after a resolver-input change (#5020), @azizur100389.

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 update leaves stale TypeScript imports after an alias-only change

2 participants