aft icon indicating copy to clipboard operation
aft copied to clipboard

Call-graph store from a previous version is unreadable after upgrade and never rebuilt or removed for non-git roots

Open null-axiom opened this issue 1 month ago • 1 comments

AFT: 0.62.0 (upgraded from 0.61.0), OpenCode 2.1.1, macOS. Session root is a plain folder containing several git repos (not itself a repo). views off, no daemon.

What happens

  • BUILD_OUTPUT_VERSION changed from v18-rust-static-value-references (0.61.0) to v19-position-independent-node-identities (0.62.0) in callgraph_store/mod.rs.
  • The existing 864 MB store for that root was built by 0.61.0, so database_ready() returns false and open_readonly returns None.
  • Non-git roots skip the configure-time call-graph build (commands/configure.rs, "on-demand"), so nothing rebuilds it until an aft_callgraph call triggers a full cold build. Nothing removes the stale store either.
  • Meanwhile every engine start logs tier2 dead_code: callgraph store unavailable … reporting callgraph_unavailable and tier-2 runs build_ready … files=0 contributions=0 for its categories (~9 s CPU at start for this root).
  • When a rebuild does happen it writes a second ~0.9 GB generation before the old one is collected.

Expected

After an upgrade that changes the store format, the old store is rebuilt in the background or removed, and aft_inspect says dead-code results are unknown rather than looking clean.

Suggestions

  • On fingerprint mismatch, delete the old store (or schedule a background rebuild for roots that had one).
  • Surface "call graph unavailable / rebuilding" in aft_inspect output for dead code and unused exports.

Small related item

if removed_any {} in callgraph_store/mod.rs is an empty no-op, so the orphaned-temp sweep never logs what it removed.

Related: #746 (rebuild on start), #606 (call graph while building).

null-axiom avatar Oct 22 '26 22:10 null-axiom

Shipped in 0.63.4 (outdated non-Git call-graph caches are rebuilt). Thanks!

null-axiom avatar Nov 07 '26 15:11 null-axiom