chore(dashboard): remove confirmed dead code in the dashboard core - #6937
Conversation
Removes three symbols (13 lines) from the top-level dashboard modules that no code reaches, confirmed by three independent scanners plus a repo-wide confirmation protocol covering string dispatch, frontend consumers, public surface, and a 30-day recency gate. - get_active_dump_file (crash_dump_store.py): faulthandler is already wired through open_dump_file()'s return value into LoopStallWatchdog, so this accessor was never on that path. The _active_dump_file global it read is kept: it holds the fd alive and tests assert it is published. - DashboardState.mark_notifications_read (state.py): not the only reset path for _unread_count (clear_notifications resets it), and the notification panel clears state via /api/notifications/ack-all, not a server-side unread reset. The badge is derived client-side. - _read_theme_text (theme_validate.py): live theme routes read through the hardened _read_theme_bytes_nolink, which re-checks the symlink. This was an unused plain read_text that skipped that recheck. No behaviour change, no refactor, no reformatting.
Design Review (Fable 5) — ✅ PASSDesign-level review of All three symbols have zero remaining references repo-wide, the Design-Verdict: PASS Three genuinely dead symbols, each deadness claim independently verified against the tree; removing the weaker unhardened theme reader is a strict improvement. [DESIGN-REVIEWED] f6ad484 |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All three deletions verified independently at HEAD: zero remaining references to any deleted symbol anywhere in the repo, First-Principles-Verdict: PASS Three dead symbols deleted, each with a counted zero-consumer proof that holds at HEAD; nothing rides along and nothing weakens a live path. What this change shipsIntent: shrink the dashboard core by deleting three symbols no code reaches — a pure SUBTRACTION (neither fix nor addition).
Watch
[FIRST-PRINCIPLES-REVIEWED] f6ad484 |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsAll three removed symbols have zero references anywhere in the repository. The PR cleanly removes confirmed dead code — no callers can crash, and dead-code cleanup is a deterministically-owned category regardless. No findings. [OPUS-REVIEWED] f6ad484 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
bolichen97
left a comment
There was a problem hiding this comment.
Independently verified every removed symbol (grep across full repo + PR head, string/dynamic/registry lookup checks) has zero remaining references anywhere -- no dangling handler/registry entry (the #6876 defect class). CI all green. Approving.
Removes three symbols (13 lines) from the dashboard core that no code reaches. No behaviour change, no refactor, no reformatting.
Scope: top-level
src/kiro_crew/dashboard/*.pyonly.handlers/,routes/,handlers_instances.pyandhandlers_system.pyare excluded — they are covered separately. Those excluded paths were still scanned as callers, so a symbol consumed by a handler is correctly treated as alive.Deleted
get_active_dump_file()—crash_dump_store.py:697-699Exactly one repo-wide occurrence: its own definition. Searched
*.py *.ts *.tsx *.js *.md *.json *.yml *.yaml *.toml *.sh *.ps1includingtest/,docs/,docs/system-specs/,src/kiro_crew/builtin_skills/,.github/andpyproject.tomlentry points, plus the bare-string form and everygetattr/globals()/importlib/ dispatch-table /unittest.mock.patch-target path. Not in any__all__. Last touched 44 days ago.Its docstring ("for passing to faulthandler") invites the reading that this is a half-wired link, so that was checked specifically: faulthandler is already wired through
open_dump_file()'s return value —server.py:3525_dump_file = await asyncio.to_thread(open_dump_file)→server.py:3538LoopStallWatchdog(dump_file=_dump_file, …). The accessor was never on that path.The
_active_dump_filemodule global atcrash_dump_store.py:60is deliberately kept, even though it now has no production reader.open_dump_filepublishes it at:518to hold theDumpFile— and therefore faulthandler's fd — alive, andtest/test_crash_dump_store.pyreads and restores it directly (:59,:72,:603,:617,:620,:624,:644) including an assertion thatopen_dump_filemust publish it. Removing it would reintroduce an fd-lifetime bug.DashboardState.mark_notifications_read()—state.py:6626-6628Exactly one repo-wide occurrence: its own definition.
Its docstring says "called when client opens notification panel" and nothing calls it, so the lifecycle pair was traced end to end before deleting.
_unread_countis incremented atstate.py:6591and reset atstate.py:6739by the liveclear_notifications(), so this was not the only reset path. The actual read flow is per-noteacked—ack_notification,POST /api/notifications/ack-all(handlers/messaging.py:883),unack— and the frontend's "mark all as read" dispatchesackAllNotifications()→/api/notifications/ack-all, which flipsacked; it never asks for a server-side unread reset. The badge is derived client-side (website/src/App.tsx:733,NotificationFeed.tsx:217). The server-sideunreadfield (handlers/messaging.py:814) is consumed only by test mocks._read_theme_text()—theme_validate.py:1605-1606Exactly one repo-wide occurrence: its own definition. No string or
getattrdispatch; theme validation does not build a by-name reader table. Not in__all__,docs/,docs/system-specs/, or the theme-pack-authoring skill. Last touched 37 days ago.Because
theme_validate.pyis a security surface (path traversal, symlink refusal, CSS denylist), this was checked as a possibly-bypassed validation step rather than assumed dead. It is not one: every live asset / overlay / topbar route reads through the hardened_read_theme_bytes_nolink, which re-checks the symlink (TOCTOU-safe) and then decodes witherrors="replace"— consistently, everywhere._read_theme_textwas a plainread_textthat skipped the symlink recheck. Nothing routes through it and nothing should, so this removes an unused weaker reader.Reported, not deleted
_REASONING_EFFORT_VALUES(chat_persistence.py:154) — dead, but withheld because the fix spans two scopes. It has zero references of any kind (no import, no dotted access, nopatchtarget string) and is a duplicate binding of the sameEFFORT_VALUESobject already bound live nine lines above as_REASONING_EFFORT_FALLBACK(:145); the "back-compat caller" its comment invokes does not exist anywhere in the repo. Butsrc/kiro_crew/effort.py:42describesEFFORT_VALUESas the "Single source for_REASONING_EFFORT_VALUES", so deleting the alias alone would leave that comment naming a symbol that no longer exists.effort.pyis outside this PR's file scope, so the alias and that one-line comment fix should land together in a follow-up rather than be split.PIN_SCOPES(tailnet.py:845) — not dead code, a drift hazard. It has zero references, but the validator it should back exists as an inline duplicate literal("node", "login")atconfig/loader.py:3036. Two independent definitions of the allowed pin-scope set on a security path is the finding; the fix is to point the validator atPIN_SCOPES, not to delete it.Deferred
_mutate_tags_locked(chat_tags.py:73)broadcast_browser_event(state.py:9268)browser_eventappears nowhere inwebsite/src. Withheld only because unmerged branchrefactor/dashboard-state-boundariesrelocated this exact method intowebsocket_hub.pyon 2026-08-29; deleting it here would collide._PROJECT_LOCAL_SEGMENTS(terminal_commands.py:365)_is_project_localat:367, so no security coupling is lost. But last touched 3 d ago by an in-flight security fix._bump_revocation_gen(token_auth.py:94)bump_revocation_genis fully live on the logout path. Last touched 20 d ago — gate clears 2026-09-08.save_folders,save_tag_boards,ws_client_count,enable_yolo,check_token_ip,reset_cache,extract_claims_from_token,build_transfer_bundle, and 9 more). Deleting them means rewriting fixtures that reach unrelated suites — refactor, not deletion.How the candidates were found
Three independent scanners, then a confirmation protocol on the intersection:
--min-confidence 60Name(Load)/Attribute/ import target across all repo.pyfilesNAMEtokens repo-wide with docstrings/comments/strings excluded; absent from every file but its ownThe three-way intersection was 9 symbols; the protocol (repo-wide multi-filetype search, string-dispatch sweep, frontend-consumer check, public-surface check, 30-day gate, test-only rule, half-wired-lifecycle rule, security-surface rule) reduced that to the 3 deleted here.
A fourth pass split all 238 vulture func/method/class findings by production-vs-test references: 24 had zero production references outside their own file, of which 17 were test-only and 2 were module dunders (
__getattr__/__dir__, called by the import protocol).Vulture over-reports roughly 25x on this surface because nearly every
api_*symbol it flags is an aiohttp route handler referenced fromhandlers/orroutes/, and the constants it flags are imported byhandlers/*. Four of its 90%-confidence "unused import" findings are also false —NudgeLoop,LLMEvent,CronJobandtypingare each used inside a quoted annotation it cannot see (chat_handlers.py:3338,chat_utils.py:363,cron_inject.py:70,loop_watchdog.py:72).Verification
flake8,isort --check-onlyandmypyclean on all touched files.black --checkflags two reformats (crash_dump_store.py~119,theme_validate.py~291) that reproduce identically on the unmodified tree — local version drift, pre-existing, untouched._REASONING_EFFORT_VALUEScoupling, which is why that symbol was withheld from this PR.