Skip to content

docs(agent): single source of truth for data viz colors#2269

Merged
kodiakhq[bot] merged 1 commit into
mainfrom
agent/data-viz-colors-doc
May 13, 2026
Merged

docs(agent): single source of truth for data viz colors#2269
kodiakhq[bot] merged 1 commit into
mainfrom
agent/data-viz-colors-doc

Conversation

@elizabetdev
Copy link
Copy Markdown
Contributor

Summary

  • Adds agent_docs/data_viz_colors.md as a single source of truth for the three independent viz color systems already in the repo (categorical --color-chart-1..10, semantic --color-chart-{success,warning,error} + highlights, and the component-local heatmap darkPalette/lightPalette in DBHeatmapChart.tsx).
  • Wires the new doc into the existing entry points so agents and humans can find it: a Files entry in agent_docs/README.md, and a paragraph at the bottom of the "Semantic design tokens" section in agent_docs/code_style.md (since that's where someone reaching for c="green.5" on a chart lands first).
  • Docs only — no code or runtime changes.

Why

The colors were already in the codebase but spread across four files (packages/app/src/theme/themes/{hyperdx,clickstack}/_tokens.scss, packages/app/src/utils.ts, packages/app/src/components/DBHeatmapChart.tsx) with non-obvious coupling. Specifically:

  • A hex change in one of the SCSS files silently desyncs from the JS fallback CHART_PALETTE / CLICKSTACK_CHART_PALETTE / COLORS in utils.ts (used in SSR and in ChartColors.stories.tsx).
  • The two themes intentionally lead with different primary chart colors (HyperDX = brand green #00c28a, ClickStack = Observable blue #437eef) and that rationale wasn't written down.
  • The Click UI yellow accent is deliberately not in the chart palette (fails contrast on both backgrounds, reads as "warning" as a series color), and that decision wasn't documented either.
  • The heatmap palette is scheme-aware (dark/light) but not brand-aware, which is unintuitive given the rest of the design system.

The doc captures these rules, the "change a hex in all four places" invariant, recipes for the four common consumption patterns (multi-series, status pill, heatmap, pie sort), anti-patterns, and a pre-merge checklist for chart-touching PRs.

Test plan

  • Render the storybook Design Tokens / Chart Colors story and confirm the doc's references (palette ordering, semantic color names, label list) match what's on screen in both themes and both schemes.
  • Spot-check the file/line references in the doc still resolve (hyperdx/_tokens.scss:97-117, clickstack/_tokens.scss:182-201 and :383-402, utils.ts:359/378/398, DBHeatmapChart.tsx:147/156, deltaChartUtils.ts:98, ChartUtils.tsx:444).
  • Markdown renders cleanly on GitHub (tables, embedded code reference snippet).

Made with Cursor

Adds agent_docs/data_viz_colors.md so humans and agents have one place
to look before touching anything that renders a color in a chart,
sparkline, heatmap, legend, or status pill. The colors were already in
the codebase but spread across four files (two _tokens.scss, utils.ts,
DBHeatmapChart.tsx) with non-obvious coupling — a hex change in one
place silently desyncs the others.

What the doc covers:

- The three independent viz color systems and how they're consumed:
  categorical 1-10 via --color-chart-N + getColorProps(),
  semantic success/warning/error + highlights via getChartColor*(),
  heatmap continuous via DBHeatmapChart's component-local
  darkPalette/lightPalette arrays.
- Per-theme rationale: why HyperDX leads with brand green (#00c28a),
  why ClickStack leads with Observable blue (#437eef), and why the
  Click UI yellow accent intentionally stays out of the chart palette.
- The "change a hex in all four places" rule for keeping
  hyperdx/_tokens.scss, clickstack/_tokens.scss, CHART_PALETTE, and
  CLICKSTACK_CHART_PALETTE / COLORS in sync.
- Recipes for multi-series, status pills (var vs function form),
  heatmaps, and pie sorting.
- Anti-patterns (hex strings, raw Mantine palette for status,
  importing private palette objects) and a pre-merge checklist.
- File reference summary table for fast jumps.

Wiring so the doc is discoverable from existing entry points:

- agent_docs/README.md: added data_viz_colors.md to the Files list
  with a one-line trigger.
- agent_docs/code_style.md: added a paragraph at the bottom of the
  existing "Semantic design tokens" section pointing at the new doc,
  since that's where someone reaching for c="green.5" on a chart
  lands first.

Docs only — no code or runtime changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hyperdx-oss Ignored Ignored May 13, 2026 11:30am

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 13, 2026

⚠️ No Changeset found

Latest commit: f3b8f29

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the review/tier-1 Trivial — auto-merge candidate once CI passes label May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🟢 Tier 1 — Trivial

Docs, images, lock files, or a dependency bump. No functional code changes detected.

Why this tier:

  • All files are docs / images / lock files

Review process: Auto-merge once CI passes. No human review required.
SLA: Resolves automatically.

Stats
  • Production files changed: 0
  • Production lines changed: 0
  • Branch: agent/data-viz-colors-doc
  • Author: elizabetdev

To override this classification, remove the review/tier-1 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions
Copy link
Copy Markdown
Contributor

PR Review

Docs-only PR. File/line references and exported-helper names check out. One factual inaccuracy worth fixing before merge — otherwise this is a useful consolidation.

  • ⚠️ Doc claims "only slot 1 differs" between HyperDX and ClickStack palettes, but 5 slots differ → HyperDX is green, blue, orange, red, cyan, pink, purple, lightBlue, brown, gray while ClickStack is blue, orange, red, cyan, green, pink, purple, lightBlue, brown, gray. Green moves from slot 1 to slot 5 (not just slot 1 swapping); blue/orange/red/cyan shift accordingly. Rewrite the "Where the colors live → Categorical series palette" paragraph to reflect that HyperDX inserts brand green at slot 1 and pushes slots 2–5, rather than implying a single-slot swap. (Re-check against hyperdx/_tokens.scss:98-107 and clickstack/_tokens.scss:182-191.)
  • ⚠️ "HyperDX chart vars … lines ~95–117" and "ClickStack … lines ~175–201" → ClickStack chart vars actually start at line 182, not 175 (line 175 is mid-comment). Minor, but since this doc is pitched as the source-of-truth for hex/line locations, tighten the ranges to clickstack/_tokens.scss:182-201 (matches the PR's own test plan).
  • ℹ️ "Reader functions" table lists semanticKeyedColor(key, index) with description "Same, but driven by key" → Worth one extra sentence on when to prefer it over getColorProps, since the doc is explicitly trying to be the place agents land. Not blocking.
  • ℹ️ Anti-patterns block shows import { CHART_PALETTE } from '@/utils' → Verified CHART_PALETTE is module-private (no export), so the anti-pattern is accurate. Good catch to include.

No code or runtime changes, no security/test surface. Fix the slot-difference claim and this is good to merge.

@github-actions
Copy link
Copy Markdown
Contributor

Deep Review

Scope: docs-only — agent_docs/README.md (+1), agent_docs/code_style.md (+2), agent_docs/data_viz_colors.md (+374, new). No executable code touched.

Intent: Create a single source of truth that captures the three already-existing data-viz color systems (categorical, semantic, heatmap) and wire it into the existing agent-doc entry points.

The doc stakes its value on being navigationally correct — its own test plan asks to spot-check that file/line references resolve. I verified every cited path, identifier, hex, and re-export claim against the code at the PR head. The brand/theme rationale, semantic/highlight hexes, palette ordering, --palette-brand-300: #faff69, CHART_PALETTE module-private status, DBHeatmapChart re-export consumed by Search/DBSearchHeatmapChart.tsx, and the storybook export inventory all check out. The findings below are limited to references that did not resolve cleanly.

✅ No critical issues found.

🟡 P2 — recommended

  • agent_docs/data_viz_colors.md:253 — Doc claims "ChartUtils.tsx → buildPieChartData already does this — the comment ... is at line ~444", but no buildPieChartData symbol exists anywhere in the repo; the pie helper containing that exact sort comment at packages/app/src/ChartUtils.tsx:444 is formatResponseForPieChart (defined at ChartUtils.tsx:410), and a second pie helper convertToPieChartConfig lives at :1085. An agent grepping the function name the doc gave will get zero hits in a doc whose stated purpose is to be the canonical navigation reference.
    • Fix: Replace buildPieChartData with formatResponseForPieChart (and update the line pointer to ChartUtils.tsx:410 for the function with :444 for the sort comment).
    • correctness, project-standards
🔵 P3 nitpicks (2)
  • agent_docs/data_viz_colors.md:102 — Doc summarizes getColorFromCSSVariable as reading --color-chart-{index+1}, but the implementation uses --color-chart-${(index % colorArrayLength) + 1} so out-of-range indices wrap rather than producing a missing var; same call-site fallback either way, but the wraparound is the reason the helper is safe to call with index >= 10.
    • Fix: Note the modulo wrap, e.g. "reads --color-chart-{(index % COLORS.length) + 1}".
  • agent_docs/data_viz_colors.md:36 — ClickStack _tokens.scss line range is listed as "~175–201", but the first chart-vars block starts at line 182 (the second block is 383-402); the other ranges in the doc are within ±3 lines, this one is off by ~7 at the start.
    • Fix: Tighten to "~182–201 and ~383–402" so both scheme blocks are pointed at.

Reviewers (4): correctness, testing, maintainability, project-standards.

Testing gaps: none — the PR ships only documentation, and the author's pre-merge checklist (storybook render parity + file/line resolution + GitHub markdown render) is the appropriate verification surface for this change.

@github-actions
Copy link
Copy Markdown
Contributor

E2E Test Results

All tests passed • 174 passed • 3 skipped • 1251s

Status Count
✅ Passed 174
❌ Failed 0
⚠️ Flaky 5
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

@kodiakhq kodiakhq Bot merged commit 389ef07 into main May 13, 2026
20 checks passed
@kodiakhq kodiakhq Bot deleted the agent/data-viz-colors-doc branch May 13, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-1 Trivial — auto-merge candidate once CI passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants