chore(status): remove dead analytics code (tabConfig, KNOWN_METRICS, colorAllocators, fixtures)#1473
Open
kylebernhardy wants to merge 2 commits into
Open
chore(status): remove dead analytics code (tabConfig, KNOWN_METRICS, colorAllocators, fixtures)#1473kylebernhardy wants to merge 2 commits into
kylebernhardy wants to merge 2 commits into
Conversation
…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
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 liveTAB_DEFSinStatusTabs.tsx(stale two-sources-of-truth).pipeline/index.tsKNOWN_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.tsKnownMetricName,MetricName,ChartPanelConfig,PresetOption—KnownMetricNamewas a second stale metric list; its only consumer wasMetricName, whose only consumer wasChartPanelConfig, which nothing imports — the whole chain was dead.PresetOptionwas only consumed by the deadTIME_PRESETSinlib/time.ts(below). Note:TabIdand thetab:spec fields are intentionally untouched (separate issue).lib/colorAllocators/tableColors.ts+lib/colorAllocators/index.ts— nothing imports either; the only colorAllocators consumer isTrafficByTypeRenderer.tsx, which importstypeColors.tsdirectly (kept).analytics/__fixtures__/replication-latency/— byte-identical duplicate of__tests__/fixtures/replication-latency/(verified withdiff -r) and unreferenced; only the__tests__copy is read byreplication-pipeline.test.ts.lib/time.tsTIME_PRESETS/getTimeRangeFromPreset/formatBytesPerMin— the first two were used only by their own test (production uses the same-named but different exports incontext/timePresets.ts);formatBytesPerMinhad zero callers. Their orphaned test cases in__tests__/time.test.tsare 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 survivingtypeColors.tsclaimed a palette-disjointness invariant "enforced in test/colorAllocators/disjoint.test.ts", a test that never existed. This adds it:NODE_PALETTE,TABLE_PALETTE, andTYPE_PALETTEare pairwise disjoint. ThetypeColors.tscomment now points at the real test.Fixed comments
pipeline/index.tsheader andtypes/analytics.tsTransformdoc referencedsrc/lib/metricSpecs/, which doesn't exist — now point at the realanalytics/pipeline/locations. Also fixed the same stale path inFallbackRenderer.tsx's two dev-only hint strings (same staleness class, found while grepping formetricSpecs).Verification
tsc -bcleandprint fmt+oxlintcleanGenerated by kAIle (Claude Fable 5).