intuit / intuit/infigraph

Extractor fixes never reach existing indexes — content_hash only covers file bytes

Open
#73 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
88
Forks
16
PR merge metrics
No merged PRs in 30d

Description

`Module.content_hash` is a SHA-256 of the file's bytes and nothing else, and `index()` skips any file whose hash matches the stored one:

```rust
// crates/infigraph-core/src/extract/mod.rs
let content_hash = {
let mut hasher = Sha256::new();
hasher.update(source);
format!("{:x}", hasher.finalize())
};
```

Nothing in that hash says anything about the extractor that parsed the file — no grammar version, no digest of the pack's `.scm` queries.

So when we fix an extractor, existing indexes never pick it up. 3.2.16 shipped `fix(java): capture method_reference (Foo::bar, this::bar) as call edges` and `fix(cpp): scope namespace-block functions to their namespace in symbol IDs`. If you upgrade without editing your source, those files still match their old hash and get skipped — not until the next release, but indefinitely.

Repro:

1. Index a Java project on a version before the `method_reference` fix
2. Upgrade, re-run `infigraph index` — no source edits, so every file is skipped
3. `trace_callers` on a method only ever called via `Foo::bar` still shows no callers, and it still turns up in `detect_dead_code`

`index --full` gives the right answer, which confirms the extractor itself is fine and only the skip decision is wrong.

The bad part is that it's silent — no warning, nothing indicating the index is behind the binary. Easy for someone to report a bug that's already been fixed.

Ideally the stored hash would cover the language pack too (query sources, grammar, plus an extractor version for Rust-side changes), so a Java query fix re-extracts Java files and leaves Python and TypeScript cached. Mixing in a global version would also work but would mean a full reindex on every release.

Same gap applies to the ANTLR grammar plugins — swapping a plugin's `.g4` or its extractor doesn't invalidate anything either.

Contributor guide

Open the contributing guide

Research direction

Start in crates/infigraph-core/src/extract/mod.rs and trace index() alongside the --full path to understand the current skip decision and stored content_hash. Compare how language packs expose their .scm queries and how ANTLR .g4 plugins are identified. Done means extractor or pack changes invalidate only the affected files, while unchanged language indexes remain cached.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.