Summary
When DeleteFileData(fileId) (DbWriter.cs:280-287) removes a file's symbols and references, any symbol_references rows in other files that referenced the now-deleted symbols are left in place. These dangling references continue to surface in callers / callees / impact results as "call to symbol that no longer exists", until a full re-index re-derives them. The user-visible effect is that a callees query against caller-in-file-A returns rows whose target symbol's definition returns nothing — phantom edges.
Where
src/CodeIndex/Database/DbWriter.cs:280-287 (DeleteFileData scope)
Suggested approach
(1) After deleting the file's own symbols rows, run a follow-up DELETE FROM symbol_references WHERE target_symbol_id IN (<deleted_ids>) to remove edges pointing at the now-gone symbols. (2) Or, model the deletion as a soft-delete (symbols.deleted_at) so cross-file references remain but readers can join with a WHERE deleted_at IS NULL filter and surface stale edges explicitly. (3) Pick option (1) by default since it matches the "fresh re-index" mental model; document the trade-off if (2) is preferred. (4) Add a regression test: index file A (caller), file B (definition); delete file B; assert callees on A's caller does not return the deleted target. (5) Cross-link with #1518 (orphans) and #1728 (prune).
Summary
When
DeleteFileData(fileId)(DbWriter.cs:280-287) removes a file's symbols and references, anysymbol_referencesrows in other files that referenced the now-deleted symbols are left in place. These dangling references continue to surface incallers/callees/impactresults as "call to symbol that no longer exists", until a full re-index re-derives them. The user-visible effect is that acalleesquery against caller-in-file-A returns rows whose target symbol'sdefinitionreturns nothing — phantom edges.Where
src/CodeIndex/Database/DbWriter.cs:280-287(DeleteFileDatascope)Suggested approach
(1) After deleting the file's own
symbolsrows, run a follow-upDELETE FROM symbol_references WHERE target_symbol_id IN (<deleted_ids>)to remove edges pointing at the now-gone symbols. (2) Or, model the deletion as a soft-delete (symbols.deleted_at) so cross-file references remain but readers can join with aWHERE deleted_at IS NULLfilter and surface stale edges explicitly. (3) Pick option (1) by default since it matches the "fresh re-index" mental model; document the trade-off if (2) is preferred. (4) Add a regression test: index file A (caller), file B (definition); delete file B; assertcalleeson A's caller does not return the deleted target. (5) Cross-link with #1518 (orphans) and #1728 (prune).