Skip to content

chore(dashboard): wave 1 of code-health audit fixes#102

Merged
pratyush618 merged 13 commits intomasterfrom
chore/dashboard-health-fixes
May 1, 2026
Merged

chore(dashboard): wave 1 of code-health audit fixes#102
pratyush618 merged 13 commits intomasterfrom
chore/dashboard-health-fixes

Conversation

@pratyush618
Copy link
Copy Markdown
Collaborator

@pratyush618 pratyush618 commented May 1, 2026

Refactors / dedup

  • Hoist LEVEL_STYLE/LEVEL_TONE into lib/status.ts as logLevelClass() (was duplicated verbatim in job-logs-tab.tsx and log-stream.tsx).
  • Hoist formatAxisTime into features/metrics/utils.ts (was duplicated in throughput-chart.tsx and latency-chart.tsx).
  • Extract the DAG BFS layout from job-dag-tab.tsx into a pure dag-layout.ts module so it can be unit-tested without a DOM.

Bugs uncovered while testing

  • DAG layer assignment looped forever on cycles. The original BFS lacked a depth bound; cycles in the inputs would push layers up indefinitely. Cap layer depth at nodes.length - 1 and add a regression test.
  • Three timestamp call sites multiplied milliseconds by 1000. Backend (now_millis() + the Python timeseries aggregator) emits ms; job-table.tsx, job-replay-tab.tsx, and throughput-chart.tsx were rendering jobs as "in 53,000 years". Other call sites already used the values directly, which is why the bug was inconsistent. Annotate every timestamp field in api-types.ts with /** Unix milliseconds */ so future readers don't re-introduce the same mistake.

Lint hygiene

  • Replace the silent eslint-disable-next-line in job-filters.tsx (Biome ignores the comment style) with a proper ref-based debounce that doesn't need a suppression at all.
  • Promote correctness/useExhaustiveDependencies from warn to error in biome.json — warns-only rules slip past CI.

URL state

  • /dead-letters: page and view are now TanStack Router search params, so deep-linking and back/forward work the same way they do on /jobs.

Test coverage

  • lib/api-client.tsbuildUrl (param escaping, null/undefined/"" omission), parse (JSON vs text content-type, ApiError paths), and the public api.{get,post,put,delete} surface.
  • lib/errors.tsisNetworkError against Chrome/Firefox/Safari fetch-failure messages, isServerUnavailable for 502/503/504, and isBackendUnreachable.
  • features/settings/derived.tsparseExternalLinks (parse-guard, type filter, extra-field stripping) and applyJobContext (template substitution, URL-encoding, multi-occurrence).
  • features/jobs/components/dag-layout.ts — empty graph, linear chain, fan-out, multi-path depth, cycles, isolated nodes, field preservation.

Cleanup

  • Drop unused shortName/docsUrl/repoUrl from lib/site.ts.

Test plan

  • pnpm run ci (biome ci + typecheck + 81 vitest tests + vite build) passes locally.
  • /dead-letters?page=2&view=flat deep-links straight to that page and view, and back/forward in the browser keeps state.
  • Job-table "Created" column and replay-history timestamps render today's dates instead of year-55000 nonsense.
  • Throughput chart x-axis matches latency chart x-axis (both in ms now).

@pratyush618 pratyush618 merged commit f54900d into master May 1, 2026
14 checks passed
@pratyush618 pratyush618 deleted the chore/dashboard-health-fixes branch May 2, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant