Skip to content

Removed dead code and consolidated duplicated logic across the project - #39

Merged
CodyCBakerPhD merged 12 commits into
mainfrom
claude/code-quality-review-114yuo
Sep 3, 2026
Merged

Removed dead code and consolidated duplicated logic across the project#39
CodyCBakerPhD merged 12 commits into
mainfrom
claude/code-quality-review-114yuo

Conversation

@CodyCBakerPhD

Copy link
Copy Markdown
Member

Behaviour-preserving cleanups from the code review, one commit per approved group so each reads on its own:

  1. Un-exported symbols only used inside their own file
  2. Deleted dead code, stylesheet rules and stray comments
  3. Removed state and interface fields nothing reads
  4. Simplified unreachable branches and redundant expressions
  5. Extracted shared helpers for expressions repeated across src/lib and src/ui
  6. Consolidated repeated UI construction and split up the longest renderers
  7. Merged duplicate stylesheet rules
  8. Shared the fixtures the unit tests were each redeclaring
  9. Tidied the demo generator's repeated fragments

No observable behaviour, public API or configuration changes; tests, lint, types and pre-commit pass after every commit. The demo generator was run before and after with stubbed ffmpeg/ffprobe and writes an identical dataset with identical ffmpeg argv. Groups 10 and 11 of the review and its "needs verification" items are left for later, as asked.

Prompts

Original request:

Role: You are a senior software engineer performing a rigorous, functionality-preserving code review of this entire project. Your goal is to identify concrete opportunities to improve code quality, maintainability, and clarity without changing any observable behavior or public API.

Hard Constraints (do not violate)
Do NOT alter functionality. No behavior changes, no bug "fixes" that change outputs, no feature additions.
Do NOT change public/exported APIs, signatures, or contracts that external callers or other modules rely on.
Do NOT modify configuration, environment behavior, or runtime side effects.
Every proposed change must be behavior-neutral and independently verifiable.
If you're uncertain whether something is truly dead or safe to change, flag it as "needs verification" rather than assuming.
Scope of Analysis
Systematically review the whole project for:

Dead / unreachable code
Unused functions, methods, classes, variables, constants, imports, and files
Unreachable branches, redundant conditionals, code after early returns
Commented-out code blocks that should be removed
Feature-flagged or legacy paths that are provably never executed
Duplication & consolidation
Repeated logic that can be extracted into a shared internal helper
Near-identical functions that can be merged or parameterized
Copy-pasted blocks, redundant utility implementations
Internal function/structure cleanup
Overly long functions that can be decomposed (internally, without changing behavior)
Poor naming that reduces readability
Unnecessary indirection or wrapper functions that add no value
Inconsistent patterns for the same operation across the codebase
Minor safe improvements
Redundant type conversions, unnecessary allocations, obvious no-ops
Simplifiable boolean/conditional expressions
Unused dependencies in the manifest/package files
Method (think step by step)
First, map the project structure and identify entry points, public surface, and module boundaries so you can reason about what is reachable and what is internal.
For each candidate issue, trace usages across the whole codebase to confirm it is genuinely dead / duplicated / internal before proposing a change.
Rank findings by confidence (High/Medium/Low that the change is safe) and impact.
Output Format
Produce a structured report:

Summary: high-level overview of code health and top themes.
Findings table/list, each with:
ID & category (dead code / duplication / consolidation / cleanup)
Location (file + line/function)
Description of the issue
Proposed change (concrete, minimal, behavior-neutral)
Confidence it's safe (High/Medium/Low) + reasoning
Verification step (e.g., which tests cover it, or how to confirm no callers)
"Needs Verification" section: items you suspect but cannot prove safe alone.
Recommended order of changes, grouped so each group can be applied and tested independently.
Do not apply any changes yet — deliver the review first for approval. When changes are approved, apply them in small, independently reviewable, behavior-preserving commits.

Follow-ups, in order (the session was also resumed several times with "Continue from where you left off."):

Try again
I hit my usage limit while you were working, but it has reset now. Please continue from where you left off.
Apply groups 1 through 9, skip 10 and 11 for now

🤖 Generated with Claude Code

https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t


Generated by Claude Code

Drops the export keyword from 40 types, interfaces, constants and
functions that no other module, test or story imports (knip and a
repo-wide reference trace agree). Each symbol stays in use in its own
file, so nothing becomes unused. SaveTarget also loses its never-read
handle field.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
Removes two ffmpeg wrapper functions with no caller, a ContainerInfo
re-export nobody imports, ambient declarations TypeScript 5.9 already
ships (FileSystemFileHandle, FileSystemWritableFileStream), an
audioTracks member and a fourcc fallback mp4box never populates, the
never-applied wide grid-item option and its rule, the details.teach-more
rules, two var(--mono) references with no definition, the unemitted
.savings-sub rule, two orphaned JSDoc blocks, a JSDoc attached to the
wrong function, a fake-indexeddb import overwritten in every test, and a
no-op statement in the pool test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
Drops ten fields that were populated on every load and never read:
AppState.timescale, AppState.audioTrack (with MediabunnyMetadata's copy),
AppState.presentationOrder (kept as a local for the keyframe list),
EncodeTestState.zoom, SampleInfo.offset/dtsSec/duration,
BoxNode.hdrSize, TrackInfo.packetCount and
SizeEstimate.encodedSegmentBytes, plus the mp4box ambient members that
only fed them. Test and story fixtures lose the same stale keys.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
Local rewrites with identical results for every input: guards that an
invariant one line earlier already guarantees, values computed twice,
fallbacks that cannot fire, a select built and wired even when it is
never shown, listeners that re-found by id the elements the same
function had just built, a helper that dispatched on which caller
invoked it, a window-shadowing local, a generated AV1 level table, and
type spellings that already had a name (VideoInfo, MatrixQuality,
CanvasSink, Placement, ZoomStep).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
…src/ui

One home each for: HTML escaping (analysisDoc reuses dom's escapeHtml),
slugify (inspectToc reuses analysisDoc's), the VP9 chroma table, the
effective CRF, scale-as-percent labels, the current URL query and
history commit, the archive assets URL, the busy/calm stretch sentence,
the ffmpeg crash-recovery wrapper and read-back copy, the 64-bit FNV
fallback hash, summing a run's stretches, error-to-message, the signed
size-change percentage, the file base name, the video and audio track
lookups, the initial app and encode-test state (resetState now reuses
the same factories), the size estimate for a set of windows, the A/B
quality and resolution descriptions, the overview title and overall
bitrate, the track fact formatters, the seeking-test headers, rows and
summary (new lib/seekReport.ts), a held-bytes helper, the container table
derived from one record list, and evictStore hoisted to module scope.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
dom.ts gains button(), section(), dataTable() and svgText(), replacing 26
button-plus-type pairs, 11 card openers, two hand-built tables and six
hand-built SVG labels. formControls gains progressBar(),
resetProgressFill() and finishFill() for the eight places that built,
reset or finished a bar by hand. encodeTab's three checkbox fields share
one builder; abPanel gets iconButton, a scrubSeconds closure and
drawFrame at module scope; compareTab gets tickedCombos, repaintMatrix
(renderMatrixSection no longer takes the section it always received
from ui), markMeasured, sweepNote and axisCountLabel, and builds the run
controls before the axis fold so onAxisChange no longer forward-references
ui; zoomPan shares dragTo/beginDrag between mouse and touch; seekTab
passes its progress fill instead of re-querying it; fileLoading's
loadSource takes a typed request instead of a kind plus untyped payload.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
Folds six sets of byte-identical declarations into selector lists at
positions that keep the cascade intact: the split .grid .item block, the
reel labels that copied the sample picker's tick labels, the bitrate
chart's axis rules that copied the seek scatter's, the sweep summary's
typography that copied the savings strip's, the three disclosure bars'
caret rules, and .tab-action.on beside .tab.on.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
Moved the video track, the command builder's defaults, the sample-table
builders, the size-estimate input and the BEP047 demo path into
tests/fixtures, and pointed the tests that carried their own copies at
them. Folded the repeated per-test reset and load sequences into helpers
in the files that used them. No test's inputs or assertions changed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
Spelled the BEP047 session path once, used the X264 fragment in the six
calls that wrote it out in full, gave the reference's audio flags a
fragment of their own, dropped the hand-kept session counter in favour
of the entry list's length, and made the always-present description part
of every index entry. The dataset it writes and the ffmpeg arguments it
runs are unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://brain-bbqs.github.io/encoding-helper/pr-preview/pr-39/

Built to branch gh-pages at 2026-09-03 05:24 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG5Tqc6NC6f9PCzXm7qS6t
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.54357% with 195 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ui/abPanel.ts 37.50% 22 Missing and 3 partials ⚠️
src/ui/compareTab.ts 60.00% 21 Missing and 3 partials ⚠️
src/ui/analysisTab.ts 0.00% 19 Missing ⚠️
src/ui/fileLoading.ts 0.00% 17 Missing ⚠️
src/ui/encodeTab.ts 72.54% 14 Missing ⚠️
src/ui/seekTab.ts 25.00% 12 Missing ⚠️
src/ui/formControls.ts 50.00% 9 Missing and 1 partial ⚠️
src/ui/zoomPan.ts 25.00% 9 Missing ⚠️
src/lib/seekReport.ts 38.46% 8 Missing ⚠️
src/ui/demosPage.ts 45.45% 6 Missing ⚠️
... and 18 more
Files with missing lines Coverage Δ
src/lib/analysisDoc.ts 96.36% <100.00%> (-0.78%) ⬇️
src/lib/appUrl.ts 90.24% <100.00%> (ø)
src/lib/atomLayout.ts 96.29% <100.00%> (+1.05%) ⬆️
src/lib/bitrateTimeline.ts 96.29% <100.00%> (ø)
src/lib/chunkedSource.ts 61.53% <ø> (ø)
src/lib/cliCommand.ts 96.00% <100.00%> (+2.12%) ⬆️
src/lib/containerKb.ts 100.00% <ø> (ø)
src/lib/demoArchive.ts 92.30% <100.00%> (+1.68%) ⬆️
src/lib/dom.ts 80.15% <100.00%> (+5.37%) ⬆️
src/lib/mediabunny.ts 33.33% <ø> (ø)
... and 33 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CodyCBakerPhD CodyCBakerPhD self-assigned this Sep 2, 2026
Comment thread CHANGELOG.md Outdated
Signed-off-by: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com>
@CodyCBakerPhD
CodyCBakerPhD marked this pull request as ready for review September 3, 2026 05:24
@CodyCBakerPhD
CodyCBakerPhD merged commit 913aa8f into main Sep 3, 2026
16 checks passed
@CodyCBakerPhD
CodyCBakerPhD deleted the claude/code-quality-review-114yuo branch September 3, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants