Skip to content

fix(index): re-extract unchanged files after an extractor change (stale edges and symbols after an upgrade) #803

Closed

Description

@ajianaz

What

cora index skips a file when its stored fingerprint, mtime:size, matches. The fingerprint does not say which version of the extractors produced the symbols and edges, so after an upgrade that improves an extractor (Ruby nesting in #801, function references and serde attributes in #802) the index keeps the old, poorer result for every file that did not change, until the user happens to run cora index --rebuild. Measured: with the new extractor in place, cora dead-code on this repository reported the same 43 symbols before and after, because the unchanged files were not re-extracted.

Fix: put an extractor version into the fingerprint (v{EXTRACTOR_VERSION}:{mtime}:{size}), bumped whenever an extractor changes what it records. The first cora index after such an upgrade re-extracts every file once; later runs skip unchanged files as before.

Why

Without it, extractor fixes reach only the files a user edits next, so results differ between two machines with the same cora version, and callers, impact and dead-code quietly stay wrong on old indexes.

Testing

  • A test first, red before: an index whose stored fingerprints are in the old mtime:size form is fully re-extracted on the next run, and a second run then skips every file.
  • The stored fingerprint of a fresh index carries the extractor version.
  • cargo test --features tree-sitter, cargo fmt --all -- --check and clippy with -D warnings stay green.

Activity

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