Skip to content

[Bug]: Warm incremental extract reads and decodes graph.json three times #5527

Done

Description

@rvitaliy

What happened?

An unchanged incremental graphify extract --code-only --no-cluster reads and parses the same graphify-out/graph.json three times. The stale-source check reads it first, the missing-node recovery check reads it again, and resolver setup reads it a third time even when there are no AST inputs.

On a warm graph from our TypeScript monorepo, this means decoding a 65 MiB JSON file three times during a run that finds no source changes. In one instrumented run, those reads and parses took about 0.8 seconds in total, before accounting for resolver setup.

Steps to reproduce

# From a Graphify source checkout after uv sync --all-extras.
scratch=$(mktemp -d)
printf 'def example():\n    return 1\n' > "$scratch/example.py"
uv run --frozen graphify extract "$scratch" --code-only --no-cluster --out "$scratch"

PYTHONHASHSEED=0 uv run --frozen python - "$scratch" <<'PY'
import runpy
import sys
from pathlib import Path

target = Path(sys.argv[1]).resolve()
saved = target / "graphify-out" / "graph.json"
original = Path.open

def trace(path, mode="r", *args, **kwargs):
    if path == saved and "r" in mode:
        print("reading graph.json", flush=True)
    return original(path, mode, *args, **kwargs)

Path.open = trace
sys.argv = ["graphify", "extract", str(target), "--code-only",
            "--no-cluster", "--out", str(target)]
runpy.run_module("graphify", run_name="__main__")
PY

Actual output

The second run prints reading graph.json three times and reports AST extraction on 0 code files before the no-change exit.

Expected behavior

Read the saved graph once for the incremental source checks and skip resolver setup when there are no code changes or sources to reconcile. Keep the saved output intact for the unchanged run.

Environment

Reproduced from a clean checkout of v8 at 0f22ae762e3e3d0b689fc7ad2b8192740628413b (Graphify 0.9.121), macOS arm64, Python 3.14.6, installed from source with uv. The reproduction uses local AST extraction.

Activity

  1. github-actions commented on Nov 26, 2026

    @github-actions

    Thanks for opening this issue, @rvitaliy. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. added a commit that references this issue on Nov 28, 2026
    63ace5d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions