feat: refactor preflight — safe_delete + check_rename #25
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
h-dv/code-index#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Rank 4 of the 2026-07-20 index-data brainstorm (
_prdoc/records/brainstorm-2026-07-20-index-data-catalog.md).What: two checked-transaction tools for the riskiest agent edits.
safe_delete(symbol): typed refs + name fallbacks + trigram-FTS pass for string-embedded references + newly-orphaned-callee cascade preview.check_rename(old, new): collision and ambiguity-injection detection before compile time — critical for the 4 dynamic languages with no compiler backstop.Why — the killer case:
roles_is_zero(daemon local_index.rs) has ref_count=0 and zero edges — every ref-based detector calls it dead — but FTS finds it inside#[serde(skip_serializing_if = "roles_is_zero")]; deleting it compiles and silently breaks serialization. Rename side:newhas 18 same-name symbols,parse11 — collision injection is a real hazard. Validated:try_resolve→resolveclean (0 collisions, 3-ref edit manifest);Writer::upsert_fileverdict "safe, doc update at writer.rs:3" (exactly what v0.5.19 did manually).Cost: small — 3-4 indexed queries per call (refs by target, refs by name, files_fts MATCH, symbol_edges CTE); no new data.
Shipped in v0.6.0 (I030 Track B) as
safe_delete+check_rename. Evidence tools with stable severity-ordered reason codes and a contractual never-say-"safe": resolved refs with prod/test split, string evidence via trigram-FTS candidates word-boundary-verified against stored content (the defining-file serde case surfaces — unit-tested on theroles_is_zeroshape), dark-channel disclosure for sub-3-char names, newly-orphaned callees, scoped collisions (PHP case-insensitive), ambiguity-injection counts, full edit manifests, every cap honest. Bench: delete-prep = 1 call / 1.2KB surfacing 6 refs + 8 string files on this repo.