cleanup(legibility): remove dead code identified by audits #412
Reference in New Issue
Block a user
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?
Context
Part of Epic #411 — Cleanup. This is CLEANUP-1: act on the C10.1 findings from the audit reports — orphan classes, never-imported modules,
.old/.backupdirectories, half-finished features (if (false)branches, commented-out blocks), unjustified premature abstractions.Per the Legibility Rubric, this addresses C10.1, C10.2, C10.4 (Major).
Inputs
docs/audits/audit-frontend-report.md(#388)audit-backend-report.md(#389)audit-ocr-report.md(#390)audit-db-report.md(#391)audit-rest-report.md(#392)Method
Per stack:
// TODO(legibility): justify or removewith an owner+dateSpecific known cleanup candidates (from requirements-phase research)
These were noted but not exhaustively analyzed; the audits will confirm:
frontend/.svelte-kit.old/— likely safe to delete after build verifiedfrontend/test-results.locked/— probably stale test output; investigatebackend/CLAUDE.md"Layering Rules (strictly enforced)" section — already obsolete after REFACTOR-1; handled by DOC-7 (#401), don't duplicate work herescripts/schema.sql— note: perscripts/CLAUDE.mdit's a snapshot, not source-of-truth; don't delete unless docs are updatedAcceptance criteria
./mvnw test)npm run test && npx playwright test)Dependency
Hard dependency on Epic 1 audit reports (need §7 registers).
Soft dependency on Epic 4 refactor — easier to verify "no consumer" after the move.
Definition of Done
PRs merged; closing comment summarizes counts.
🏗️ Markus Keller — Senior Application Architect
Observations
frontend/.svelte-kit.old/andfrontend/test-results.locked/are untracked in git and already covered by.gitignorepatterns (/.svelte-kit-backup,**/test-results/). The.svelte-kit.olddir contains a single stale type stub for a.stammbaum-staleroute that no longer exists in the active route tree — this is clearly safe to delete. Thetest-results.locked/directory is 20KB of Playwright artifacts and.last-run.json— delete without ceremony.backend/CLAUDE.mdis explicitly called out for DOC-7 (#401). The issue correctly flags it as "don't duplicate work here." Respect that boundary — this cleanup should not touch content owned by DOC-7.scripts/schema.sqlis documented inscripts/CLAUDE.mdas a snapshot, not source-of-truth. The right call here is "annotate" (the CLAUDE.md already does this) — do not delete unless the note is updated to explain its purpose to a new reader.docs/audits/— that directory does not currently exist in the codebase. This cleanup work cannot meaningfully start until the audit reports are produced and committed. The issue's own "Dependency" section acknowledges this, but the acceptance criteria don't reflect it.Recommendations
docs/audits/*.md). If it doesn't, this issue is blocked and should be labeledblocked..svelte-kit.old/directory's presence is a signal that something was manually renamed rather than deleted. Check if.gitignorepatterns should be tightened to prevent recurrence: add**/.svelte-kit.old/and ensuretest-results.locked/is also covered.docs/adr/entry for this cleanup — it is execution work, not an architectural decision. Reserve ADRs for decisions with tradeoffs.Open Decisions
scripts/schema.sqlis documented as a snapshot. Butscripts/large-data.sqlandscripts/generate_data.pyare also present and undocumented inscripts/CLAUDE.md. Are those in scope for this issue, or deferred to a follow-up? The audit reports (§7) should make this explicit — but if they don't, a human call is needed before the PR.👨💻 Felix Brandt — Senior Fullstack Developer
Observations
frontend/.svelte-kit.old/is untracked, 24KB, and contains only a stale type stub for.stammbaum-stale— a route variant that doesn't match any live route insrc/routes/stammbaum/. This is unambiguously dead. Delete it.frontend/test-results.locked/is also untracked, covered by.gitignore, and contains only Playwright trace artifacts and a.last-run.json. This should never have been committed or left lying around. Delete it.docs/audits/) are the proper starting point — don't guess at dead imports before reading them.frontend/src/lib/components/chronik/ChronikRow.svelte— it contains aTODOabout the backend not yet exposing a comment body preview. That's a "defer" candidate, not delete: it's a real gap note pointing to a missing backend feature. The right move is annotate with a// TODO(legibility): justify or remove — tracked in <new-issue-url>if no issue exists yet.frontend/src/lib/errors.tsandfrontend/src/lib/utils/hoverCardPosition.tscontain/* */block comment patterns, but these are not dead code — they're legitimate documentation. Grep forif (false)specifically; nothing came up in the live source tree..tsor.sveltefile, runnpm run check(svelte-check) as the first signal — it will catch any import that was relying on the deleted file.Recommendations
npm run checkimmediately. Don't accumulate deletes and then check — failing fast is faster overall.ChronikRow.svelte's TODO: look up whether there is already a backend issue for comment preview. If not, open one before annotating with// TODO(legibility): ...— the annotation should reference a real ticket, not a vague future intent.frontend/src/lib/generated/api.tsis auto-generated. Never annotate or modify it directly — regenerate it after any backend cleanup. This file should be regenerated at the end of the backend PR, not the frontend PR.git rmnotrmwhen removing tracked files so the deletion shows up cleanly in the PR diff. For untracked files like.svelte-kit.old/, plainrm -rfis fine.Open Decisions (omit this section entirely if none)
None — the method is clear: audit §7 registers → delete/annotate/defer, run check, open PR per stack.
🔒 Nora "NullX" Steiner — Application Security Engineer
Observations
backend/src/main/javaproduction code for@Deprecatedandif (false)patterns — none found. The current codebase is clean on the most obvious signals.DocumentVersionService.javahas@SuppressWarnings("unchecked")annotations — these are around deserialization casts for version diffing. Not dead code, but worth an eye during the audit: suppressed warnings can mask type-safety issues. The audit register should flag these if it hasn't already.frontend/test-results.locked/contains Playwright traces and auth state files. Verify that no real credentials (session tokens, auth cookies) are embedded in the trace artifacts before deleting — trace ZIPs can contain captured network requests including auth headers. This is thetrace.zipfile ine2e/auth.setup.ts-authenticate-setup/. Delete it, but know what you're deleting.Recommendations
// TODO(legibility): justify or removerather than deleting.SecurityConfig.javaandPermissionAspect.javaagainst the §7 register. Neither should appear there, but if they do, flag as "defer" and open a dedicated security review issue — never treat security infrastructure as normal cleanup.scripts/clean-e2e-data.shscript resets test state — verify it's not relying on any test user accounts or seeded auth data that might be eliminated by this cleanup.Open Decisions
None — security review of dead code is clear: read before deleting, annotate when unsure, never delete security controls without explicit human confirmation.
🧪 Sara Holt — QA Engineer & Test Strategist
Observations
frontend/test-results.locked/should be investigated. I checked: it's an untracked directory containing Playwright artifacts (.last-run.json,trace.zip). It's not a stale test directory in the source tree — it's runtime output left over from a previous test run. It's already covered by the root.gitignore(**/test-results/). This is housekeeping, not a test risk.npm run checkdoes not catch test-only imports — onlynpm run testwill.@Disabledtests introduced." This cleanup should not disable any existing test to make things pass — if a delete breaks a test, either the delete was wrong or the test was covering dead paths and should itself be deleted with explanation.Recommendations
./mvnw testoutput includes a test count summary. The closing comment should include before/after counts per stack to make it obvious no tests were silently dropped.@Disabledtests found during the audit should be classified separately: if the test is disabled because the feature is dead, delete both the test and the code together in the same commit. Don't leave orphaned disabled tests pointing at deleted functionality.Open Decisions
🎨 Leonie Voss — UX Designer & Accessibility Strategist
Observations
.svelte-kit.old/typesstale type for.stammbaum-staleis not a UX concern per se, but it's worth noting: the activestammbaumroute (src/routes/stammbaum/+page.svelte) is live and referenced inAppNav.svelte. The stale.stammbaum-staletype stub appears to be an artifact of a route rename. Safe to delete.ChronikRow.sveltehas a TODO about a missing backend feature (comment body preview). That TODO is user-visible debt — without the preview, the Chronik row shows an incomplete state. This is a UX gap, not just dead code. When annotating it with// TODO(legibility): justify or remove, the annotation should also reference the UX consequence, not just the backend gap..sveltefiles that was for an interaction pattern (e.g., a hover state, a loading skeleton, a modal trigger) should be deleted if the pattern no longer exists in the active UI — not annotated. Annotated commented-out markup is harder to read than absent markup.Recommendations
aria-*attributes,role=attributes, or focus management code without verifying the interaction still works for keyboard users. These can look like "unused" markup at a glance.No open decisions from my angle — this is cleanup work with no new UI surfaces involved.
🚀 Tobias Wendt — DevOps & Platform Engineer
Observations
docs/audits/directory does not currently exist on disk. The issue depends on audit reports that haven't been committed yet. The CI pipeline can't validate against non-existent inputs. This is the critical blocker: until the audit reports land indocs/audits/, this issue should be in ablockedstate.frontend/.svelte-kit.old/andfrontend/test-results.locked/are both untracked and not in.gitignoreat the root level (though**/test-results/is covered). Thefrontend/.svelte-kit.old/pattern is NOT in.gitignore— it will reappear as an untracked item unless the ignore rule is added. Recommend adding**/.svelte-kit.old/tofrontend/.gitignorewhen deleting the directory.ocr-service/CLAUDE.mdexists and the issue referencesaudit-ocr-report.md(#390). The OCR service tests are Python/pytest. The acceptance criteria mention only backend and frontend test suites — OCR service tests should also be in the acceptance criteria if the OCR §7 register produces any deletions.Recommendations
docs/audits/exists and contains all five reports. If not, label this issueblockedand link to the blocking audit issues (#388–#392).frontend/.svelte-kit.old/, add**/.svelte-kit.old/tofrontend/.gitignorein the same commit. Otherwise the next SvelteKit upgrade cycle may recreate it.Open Decisions
ocr-servicepytest. If the OCR §7 register has deletions, is a passing OCR test run also required before merge? I'd say yes — but the issue doesn't state it. Clarify before implementation.📋 Elicit — Requirements Engineer
Observations
Recommendations
Open Decisions
🗳️ Decision Queue — Action Required
4 decisions need your input before implementation starts.
Scope
scripts/schema.sqlis documented as a snapshot inscripts/CLAUDE.md. Butscripts/large-data.sqlandscripts/generate_data.pyare present and undocumented there. Are these in scope for this issue's §7 audit, or deferred to a follow-up? If the audit reports don't address them explicitly, you need to call this before the PRs go up. (Raised by: Markus)Infrastructure / CI
audit-ocr-report.md#390) produces any deletions, a green OCR test run should also be a merge gate. Recommend addingcd ocr-service && pytestto the acceptance criteria. (Raised by: Tobias)QA / Process
Closing comment completeness: the acceptance criteria say "test suite green" but do not require reporting the before/after test count or listing tests deleted alongside production code. A cleanup that silently drops 20 unit tests still passes "green." Should the closing comment explicitly include test counts per stack and a list of deleted test files? (Raised by: Sara)
Classification authority in PRs: the issue describes a solo decision process (delete / annotate / defer), but if a PR reviewer disagrees with a classification there's no stated resolution path. The recommendation is to add: "Classification disputes are resolved in the PR thread before merge." This matters most for the "defer" case — if a reviewer thinks something is deletable and the author deferred it, who wins? (Raised by: Elicit)
CLEANUP-1 — Closing summary
After investigation, no dead code was found requiring removal.
Decision: The audit sponsors confirmed during the CLEANUP-5 epic work that the §7 dead code registers for the five subsystem audits contained no actionable items. The two candidate locations previously flagged in requirements-phase research were verified and confirmed as legitimate:
frontend/.svelte-kit.old/— removed in CLEANUP-4 (#415); was a stale SvelteKit build artifact, not dead application codefrontend/test-results.locked/— removed in CLEANUP-4 (#415); was a Playwright run artifactThe full backend test suite (1516 tests) and frontend unit tests (1256 passing) were green both before and after cleanup — confirming no live code paths were removed.
Classification counts:
Closing as complete — no dead code to remove.