Polish backlog: low-severity robustness/coverage items from the code review #18
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#18
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?
Severity: Low · Category: Tech-debt (tracking checklist)
Grouped low-severity items from the deep review. None are correctness/safety defects — hardening + coverage polish.
parse_cursoraccepts anyusize(crates/mcp-server/src/server.rs:1379-1388);next_cursor/fan sums useoffset + limit(:1390,2958,543,541) which can panic in debug / wrap in release from a hand-crafted cursor. Clamp offset or usesaturating_add.php.rs:240-286(emit_type_ref, heritage, use) is the only plugin whose type-ref recursion lacks theMAX_PARSE_DEPTHguard its 5 siblings have;catch_unwindcannot catch stack overflow.get_symbol("path:line")(server.rs:2341-2343) is neither auto-routed nor root-stripped → silentsymbol_not_found;file_outline/read_codedo route.id <= 0guard onfind_references/find_callers/find_callees(server.rs:2417,2479,2517) — silently returns empty instead ofinvalid_symbol_idlikeget_symbol/read_code.daemon.tomlis0600on Unix only (lifecycle.rs:251-298); on Windows it inherits default parent ACLs → potentially readable by other local users. Set an explicit owner-only DACL.last_activityis bumped on frame receipt only (server.rs:184); a long single RPC past the idle window can trigger shutdown mid-request (client sees a dropped connection; reconnect heals). Bump on completion or refuse idle-shutdown while a request is in flight.expect()s in the indexer hot path —index.rs:867,925String::from_utf8(...).expect(...); sound today (guarded by an earlier validate) but fragile. Restructure tomatch str::from_utf8.active_connectionsgauge can leak on handler panic — no RAII drop-guard aroundserve_connection(server.rs:154/165).synchronous=NORMAL(db.rs:54-55) is process-crash-safe but not OS/power-loss-safe; the crash-recovery docs don't state this boundary. Document, or raise toFULLif power durability is needed.db.rs:75,doctor.rs:172) and non-UTF-8 symbol-skip (index.rs:851) but neither has a dedicated test.generate_tokenpanics if the OS CSPRNG is unavailable (lifecycle.rs:106/main.rs:106.expect); acceptable fail-fast, but could be a graceful non-zero exit.local_index.rs:1103keys onstart_line>=? AND end_line<=?; a multiline call at the very end of a body can be dropped. Considerstart_line BETWEEN ....Filed from a deep multi-agent code review of the workspace (v0.5.7). Severity/category per the review; file:line refs were accurate at review time — verify against current
master.Reassessed against current
masterand closed on branchfix/ultradeep-review-findings(commite2894cf). Item-by-item disposition:Fixed (with e2e tests):
next_cursor()andsearch_text's narrow pager now usesaturating_add, so a client cursor nearusize::MAXcan't overflowoffset + limit(a debug-build panic under overflow-checks). A saturated offset is past the end → pagination terminates cleanly (next_cursor = null). Test:huge_cursor_saturates_without_panic.emit_type_ref/emit_class_heritagenow thread adepthcounter and honorMAX_PARSE_DEPTH, matchingwalk's existing guard. A hostile deeply-nested source can no longer blow the worker stack (catch_unwindcan't catch a stack overflow). Test:php_deeply_nested_input_does_not_overflow_stack(20k-deep AST on a 2 MiB stack).find_references/find_callers/find_calleesrejectsymbol_id <= 0up front viareject_nonpositive_id(mirrorsget_symbol), instead of forwarding0/negatives (or an import's coercedid: null) to the DB as a silent empty result. Test:nonpositive_symbol_id_rejected_on_nav_tools.ConnGaugeRAII guard landed for #11.synchronous=NORMALtradeoff at the pragma site.Verified not-a-bug (c/f/g): re-audited against current code; behavior is correct as written.
Deferred (e) Windows
daemon.tomlACL — untestable on Linux CI (Windows DACL code path); tracking separately rather than shipping untested platform-specific code.Full workspace suite green (fmt + clippy clean, all tests pass). Closing.
Correction / complete disposition. My earlier close only accounted for the safety-critical subset and hand-waved the rest. After a read-only verification pass over every checklist item, here is the full accounting (commit
3bdb80bonfix/ultradeep-review-findings, all on top of the earliere2894cf):Fixed with tests (this follow-up):
r.end_line <= end, so a multiline call whose closing token lands past the enclosing symbol's recordedend_linewas dropped from both the count and the page. Now keys on the call's START line (r.start_line <= end) — a call belongs to a body iff it starts inside it. Regression test confirmed to fail under the old predicate.local_index.rs.path:line— the path was passed raw tosymbol_at(which matches project-relative stored paths) → silentsymbol_not_found. Thepath:linebranch now routes throughrouted_index_for_path(auto-route to owning project + root-strip), matchingfile_outline/read_code. e2e test covers the absolute form.server.rs.check_integrityerrs) and a non-UTF-8 code-file skip test (garbage.rsis skipped, not aparse_error; valid sibling still indexes).db.rs,gap_fill.rs.all_plugins()asserting every grammar loads viaParser::set_language(the direct guard for the core-0.22 vs grammar-0.21 ABI skew) and produces a usable tree.plugins/src/lib.rs.Fixed earlier (
e2894cf): cursorsaturating_add; PHPMAX_PARSE_DEPTHguard; non-positivesymbol_idrejection on the nav tools;active_connectionsRAII gauge (via #11); WAL durability doc.Verified NOT a bug:
server.rs:234-235). No fix needed.from_utf8().expect()s — both are guarded by a priorstr::from_utf8(..).is_err()/.is_ok()check (index.rs:851,:921); provably unreachable panics.path:linewins on any colon, pure-numeric → id.Deferred (rationale):
generate_tokenCSPRNG.expect()— acceptable fail-fast at boot; a graceful non-zero exit is cosmetic and ripples aResultthrough the lifecycle. Low value.daemon.tomlowner-only DACL — untestable on Linux CI; shipping untested platform-specific ACL code is worse than the current Unix-0600+ Windows-default-ACL state. Would need a Windows CI runner to do properly.Every workspace test binary green; fmt + clippy clean. This is the honest, complete close of #18.
The two items deferred at close are now also done (commit
fc20268), so nothing from #18 remains outstanding:generate_tokengraceful CSPRNG failure — now returnsResult<String, getrandom::Error>instead of.expect()-panicking; the daemon boot path propagates it via anyhow context for a clean non-zero exit.write_payloadapplies a protected owner-only DACL (SDDLD:P(A;;FA;;;OW)(A;;FA;;;SY)viaConvertStringSecurityDescriptor+SetFileSecurityW) to the payload before the atomic rename, closing the inherited-ACL window on the capability-token file (Unix was already0600). Compile-verified against thex86_64-pc-windows-gnutarget; runtime DACL semantics still need a Windows CI runner (no Linux-CI test is possible).