Skip to content

chore(status): remove dead analytics code (tabConfig, KNOWN_METRICS, colorAllocators, fixtures)#1473

Open
kylebernhardy wants to merge 2 commits into
stagefrom
kyle/status-dead-code
Open

chore(status): remove dead analytics code (tabConfig, KNOWN_METRICS, colorAllocators, fixtures)#1473
kylebernhardy wants to merge 2 commits into
stagefrom
kyle/status-dead-code

Conversation

@kylebernhardy

Copy link
Copy Markdown
Member

Implements #1446 — Remove dead code in status analytics (tabConfig, KNOWN_METRICS, colorAllocators, stale fixtures). Net −2,564 lines, all dead code verified by grep + tsc -b + the full vitest suite.

Deleted

  • analytics/tabs/tabConfig.ts — zero imports anywhere; had diverged from the live TAB_DEFS in StatusTabs.tsx (stale two-sources-of-truth).
  • pipeline/index.ts KNOWN_METRICS + KnownMetric — imported nowhere; its "source of truth for the backend allowlist generator" comment was false (no such generator reads it), and the list was already stale.
  • types/analytics.ts KnownMetricName, MetricName, ChartPanelConfig, PresetOptionKnownMetricName was a second stale metric list; its only consumer was MetricName, whose only consumer was ChartPanelConfig, which nothing imports — the whole chain was dead. PresetOption was only consumed by the dead TIME_PRESETS in lib/time.ts (below). Note: TabId and the tab: spec fields are intentionally untouched (separate issue).
  • lib/colorAllocators/tableColors.ts + lib/colorAllocators/index.ts — nothing imports either; the only colorAllocators consumer is TrafficByTypeRenderer.tsx, which imports typeColors.ts directly (kept).
  • analytics/__fixtures__/replication-latency/ — byte-identical duplicate of __tests__/fixtures/replication-latency/ (verified with diff -r) and unreferenced; only the __tests__ copy is read by replication-pipeline.test.ts.
  • lib/time.ts TIME_PRESETS / getTimeRangeFromPreset / formatBytesPerMin — the first two were used only by their own test (production uses the same-named but different exports in context/timePresets.ts); formatBytesPerMin had zero callers. Their orphaned test cases in __tests__/time.test.ts are removed; the live exports (formatAxisTick, formatTooltipTime, formatTimeRange, getTimezoneAbbr, formatBytes) and their tests are kept.

Added

  • __tests__/paletteDisjointness.test.ts — both deleted colorAllocators files and the surviving typeColors.ts claimed a palette-disjointness invariant "enforced in test/colorAllocators/disjoint.test.ts", a test that never existed. This adds it: NODE_PALETTE, TABLE_PALETTE, and TYPE_PALETTE are pairwise disjoint. The typeColors.ts comment now points at the real test.

Fixed comments

  • pipeline/index.ts header and types/analytics.ts Transform doc referenced src/lib/metricSpecs/, which doesn't exist — now point at the real analytics/pipeline/ locations. Also fixed the same stale path in FallbackRenderer.tsx's two dev-only hint strings (same staleness class, found while grepping for metricSpecs).

Verification

  • tsc -b clean
  • Full vitest suite: 198 files / 1307 passed, 11 skipped
  • dprint fmt + oxlint clean
  • Cross-model review: Codex ("no actionable bugs; removed exports and files have no remaining in-repo references") and Gemini ("everything deleted was truly dead code; no issues found") both came back clean — no open concerns.

Generated by kAIle (Claude Fable 5).

…colorAllocators, fixtures)

Deletes code under src/features/instance/status/analytics/ that had zero
in-repo references, verified by grep, tsc -b, and the full vitest suite:

- tabs/tabConfig.ts (diverged from the live TAB_DEFS in StatusTabs.tsx)
- pipeline/index.ts KNOWN_METRICS/KnownMetric (stale list; the "backend
  allowlist generator" its comment cited does not exist)
- types/analytics.ts KnownMetricName -> MetricName -> ChartPanelConfig
  (dead chain) and PresetOption (only consumer was the dead TIME_PRESETS)
- lib/colorAllocators/{tableColors,index}.ts (only colorAllocators consumer
  is TrafficByTypeRenderer, which imports typeColors.ts directly — kept)
- analytics/__fixtures__/replication-latency/ (byte-identical duplicate of
  __tests__/fixtures/replication-latency/; only the __tests__ copy is read)
- lib/time.ts TIME_PRESETS/getTimeRangeFromPreset (used only by their own
  test; production uses context/timePresets.ts) and formatBytesPerMin
  (zero callers), plus their orphaned test cases

Adds __tests__/paletteDisjointness.test.ts pinning the palette-disjointness
invariant the deleted files claimed was "enforced in
test/colorAllocators/disjoint.test.ts" (a test that never existed), and
fixes stale src/lib/metricSpecs/ path comments in pipeline/index.ts,
types/analytics.ts, and FallbackRenderer.tsx to point at pipeline/.

Verified: tsc -b clean; vitest 198 files / 1307 passed, 11 skipped;
dprint + oxlint clean; Codex and Gemini cross-review found no issues.

Fixes #1446

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

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 47.46% 4476 / 9431
🔵 Statements 47.8% 4773 / 9984
🔵 Functions 39.42% 1066 / 2704
🔵 Branches 39.63% 2893 / 7299
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/features/instance/status/analytics/lib/time.ts 80% 50% 83.33% 83.33% 35-37, 47
src/features/instance/status/analytics/lib/colorAllocators/typeColors.ts 100% 50% 100% 100%
src/features/instance/status/analytics/pipeline/index.ts 100% 100% 100% 100%
src/features/instance/status/analytics/primitives/FallbackRenderer.tsx 12% 5% 0% 12.5% 39-123
Generated in workflow #1442 for commit 0698c9b by the Vitest Coverage Report Action

gemini-code-assist[bot]

This comment was marked as resolved.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kylebernhardy kylebernhardy marked this pull request as ready for review July 11, 2026 18:23
@kylebernhardy kylebernhardy requested a review from a team as a code owner July 11, 2026 18:23
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.

1 participant