Skip to content

perf: add incremental invalidation to SymbolTable cache #162

@omsherikar

Description

@omsherikar

Summary

SymbolTableBuilder.build_for_project loads symbols.json and returns it directly when present. There is no invalidation or incremental refresh, so stale symbol data can survive source edits and force full rescans when cache is bypassed.

Why this matters

  • Performance: current behavior is all-or-nothing (full walk with project_root.rglob("*.py")) when cache miss occurs.
  • Correctness risk: stale cache can return outdated symbols.

Suggested direction

  • Store per-file fingerprint metadata (mtime/size or content hash) in cache.
  • Re-analyze only changed/added/deleted files and merge into existing symbol table.
  • Keep a fast path for unchanged repositories.

Acceptance

  • Cache hit with no file changes avoids full project scan.
  • Editing one file only reprocesses that file.
  • Existing symbol-table tests remain green and new tests cover invalidation behavior.

Code

  • refactron/analysis/symbol_table.py

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions