Skip to content

refactor(app): split the two largest chart files into directories - #2807

Open
jordan-simonovski wants to merge 9 commits into
mainfrom
jordansimonovski/split-chart-files
Open

jordan-simonovski wants to merge 9 commits into
mainfrom
jordansimonovski/split-chart-files

Conversation

@jordan-simonovski

@jordan-simonovski jordan-simonovski commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Third of the PRs replacing #2536. No feature code — this is reorganisation plus one small bug fix (below), landing ahead of the exemplars overlay so that PR reads as a feature diff rather than a feature plus a 1,500-line move.

before after
HDXMultiSeriesTimeChart.tsx 1,503 720 + 8 files
DBTimeChart.tsx 1,022 469 + 6 files

Each becomes a directory with a barrel, so every import path and every jest.mock('@/...') keeps resolving. Invisible to consumers.

Seams

Cut along what the code already separated, not by length:

  • searchUrl.ts takes buildSearchUrl out of a useCallback as a pure function. That made its branching testable for the first time, and it turned out to be worth testing: a non-attributable aggregation (count, sum) must not produce a value filter, or drill-down returns rows that never contributed to the clicked point. Nine tests cover it — the only new test surface in this PR.
  • useChartScales holds the axis domains and annotation elements. Pure derivation from props: no state, no handlers, no recharts tree.
  • Tooltip, legend, recharts shape shims, layout constants, the cross-chart pin registry and the pure data helpers each move to a file named after what they are.

Why MemoChart is still 720 lines

What remains is one recharts element whose children must stay siblings, plus interaction state that genuinely shares a click-suppression flag with the brush-zoom. Splitting that tree would trade a real risk of silently dropping a render branch for a smaller number. Not worth it.

Changes beyond pure movement

All small, all called out so they are not mistaken for movement:

  • xAxisDomain is typed as the [number, number] tuple it already returned rather than the wider AxisDomain, removing two unsafe type assertions at its consumers.
  • dismissPinned became block-bodied and buildSearchUrl became a thin delegate. Same behaviour.
  • One bug fix: clicking a time chart point with a value of 0 searched every event in the bucket, because the guard tested seriesValue for truthiness. It now checks != null, so 0 gets the same value filter as any other value. Covered in searchUrl.test.ts, with a changeset.

How I verified nothing was lost

Diffed every non-import line of both originals against the new directories. The only lines that do not appear are import fragments that were redistributed, plus the changes above.

make ci-lint, make ci-unit (5,205 tests) and the dashboard E2E suite (81 passed, 0 failed) all pass. E2E is the one that matters here — it is the only check that catches a runtime-only breakage from moving code.

@vercel

vercel Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 22, 2026 10:47pm UTC
hyperdx-storybook Ready Ready Preview Nov 22, 2026 10:47pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: fc3655d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions Bot added the review/tier-4 Critical — deep review + domain expert sign-off label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🔴 Tier 4 — Critical

Touches authentication, tenancy data models, the public API or shipped database config — or substantially changes the query rendering engine, background tasks, the OTel pipeline, image build, or release CI.

Why this tier:

  • Large diff: 6105 production lines changed (threshold: 1000)

Review process: Deep review from a domain expert. Synchronous walkthrough may be required.
SLA: Schedule synchronous review within 2 business days.

Stats
  • Production files changed: 17
  • Production lines changed: 6105 (+ 494 in test files, excluded from tier calculation)
  • Branch: jordansimonovski/split-chart-files
  • Author: jordan-simonovski

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

@greptile-apps

greptile-apps Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Splits a large chart component into smaller modules.

The PR is not ready to merge because the previously reported component-size requirement remains unmet.

Fix All in Claude CodeFindings

  1. P2 Components exceed size limit ▶

Summary

The PR moves the two time-chart implementations into directories with barrel exports, extracts chart helpers and interactions, and adds drill-down and scale tests.

  • The latest changes align two test rerenders with their original provider wrapper and revise the zero-value changeset text.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Callers --> ChartBarrel["DBTimeChart barrel"]
  ChartBarrel --> DBChart["DBTimeChart"]
  DBChart --> SearchURL["searchUrl"]
  DBChart --> Pin["crossChartPin"]
  DBChart --> Toolbar["useChartToolbarItems"]
  DBChart --> MultiBarrel["HDXMultiSeriesTimeChart barrel"]
  MultiBarrel --> MemoChart
  MemoChart --> Scales["useChartScales"]
  MemoChart --> Data["chartData and axisTicks"]
Loading

Reviews (11) · Last reviewed commit: "docs(changeset): describe the zero drill..."

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 476 passed • 1 skipped • 1112s

Status Count
✅ Passed 476
❌ Failed 0
⚠️ Flaky 8
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. This reads as a genuine code-motion refactor: the barrels resolve, the two new __tests__/ locations match packages/app/jest.config.js's testRegex, moduleNameMapper ^@/(.*)$ resolves both directory imports, and the dependency direction between the two new directories is one-way (DBTimeChart/ → HDXMultiSeriesTimeChart/) with no cycle. The narrowed [number, number] x-domain checks out against both of its consumers, and the decision to leave MemoChart.tsx intact holds up — suppressNextClickRef, justZoomedRef, and zoomOrigin are genuinely shared across four recharts handlers.

Two things below are worth acting on before merge; the rest are discretionary.

🟡 P2 -- recommended

  • packages/app/src/HDXMultiSeriesTimeChart/chartData.ts:5 -- A three-line comment describing RESPONSIVE_CONTAINER_DEBOUNCE_MS was cut in half by the move: the head is orphaned here, truncated mid-sentence, in a pure-data module that has no resize observer, while the tail sits at MemoChart.tsx:55 opening with // it the observer fires on every frame and no antecedent for "it".
    • Fix: Delete the orphaned fragment in chartData.ts and restore the missing opening sentence above the constant in MemoChart.tsx.
    • maintainability, orchestrator-verified
  • packages/app/src/components/DBTimeChart/searchUrl.ts:111 -- The guard if (seriesValue && ...) treats a clicked value of exactly 0 the same as no click, so valueRangeFilter is skipped and the drill-down returns every event in the bucket instead of the matching ones; buildActiveClickSeries in this same PR deliberately preserves zero values, so 0 reaches this call site.
    • Fix: Change the guard to seriesValue != null and add a seriesValue: 0 case to __tests__/searchUrl.test.ts.
    • kieran-typescript, testing
  • packages/app/src/HDXMultiSeriesTimeChart/useChartScales.ts:44 -- useChartScales is the other pure seam this refactor created, with comparable branching to the one that did get tests (zero-clamped vs data-following lower bound, selection-scoped min/max, StackedBar half-granularity domain extension), and it has no test at any level below E2E.
    • Fix: Add __tests__/useChartScales.test.ts covering the auto-domain, negative-minimum fit, zero-clamped fit, selection-filtered range, and StackedBar x-domain padding cases.
    • testing, maintainability
🔵 P3 nitpicks (8)
  • packages/app/src/components/DBTimeChart/index.ts:6 -- buildSeriesSearchUrl — the function the new test file actually targets — is absent from the barrel while decodeSeriesGroupFilters is exported, and both the component and the test reach siblings by deep import, so the barrel is advisory rather than an enforced boundary.
    • Fix: Either export buildSeriesSearchUrl from the barrel or add a lint rule restricting cross-directory imports into these subpaths.
    • api-contract, agent-native
  • packages/app/src/components/DBTimeChart/DBTimeChart.tsx:24 -- This file reaches its own siblings via absolute self-referential paths (@/components/DBTimeChart/searchUrl) while the sibling directory created in the same change uses relative paths (./chartData), so a contributor copying an import line between the two adopts the wrong convention.
    • Fix: Switch DBTimeChart.tsx's self-directory imports to relative paths to match the other new directory.
  • packages/app/src/components/DBTimeChart/ChartTooltipOverlay.tsx:105 -- The pinned tooltip hardcodes offset={12} while the hover tooltip reads TOOLTIP_POINT_OFFSET_PX = 12 from the other directory's constants.ts, and the two are tied together only by prose comments.
    • Fix: Import the shared offset constant here instead of the literal 12.
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:721 -- AGENTS.md ("Keep files under 300 lines") and agent_docs/code_style.md ("File Size: Max 300 lines") set an explicit ceiling that MemoChart.tsx (721) and DBTimeChart.tsx (470) still exceed, though both are far closer than before.
    • Fix: Note the remaining gap against the documented limit, or extract the zoom/click handler block into a sibling hook.
    • project-standards
  • packages/app/src/HDXMultiSeriesTimeChart/ChartTooltipContent.tsx:59 -- payloadByKey maps typedPayload inside a useMemo that runs before the if (active && payload && payload.length) guard on line 63, so an undefined payload throws and withErrorBoundary latches the fallback for the rest of that instance's life; this pattern predates the split.
    • Fix: Default to payload ?? [] inside the memo and type the recharts-injected props explicitly instead of & Record<string, any>.
    • kieran-typescript
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:110 -- graphResults is declared any[] on the props while the extracted useChartScales narrows the same value to Record<string, unknown>[], so the hook's new stricter type is never actually checked at the boundary.
    • Fix: Type MemoChart's graphResults prop as Record<string, unknown>[] to match the hook.
    • kieran-typescript
  • packages/app/src/components/DBTimeChart/crossChartPin.ts:8 -- The module-level pinnedTooltipRegistry coordinates "one pinned tooltip across all charts" and survives across renders, unmounts, and Jest files in a worker, but has no test pinning the broadcast-excludes-self or cleanup-on-unmount behavior.
    • Fix: Add a renderHook test mounting two consumers and asserting only the non-broadcasting one's onDismiss fires, plus an unmount-deregisters case.
    • testing, maintainability
  • packages/app/src/components/DBTimeChart/searchUrl.ts:90 -- The null-return guard covers raw SQL and PromQL in one condition, but only the raw-SQL arm is exercised, so a future edit that drops isPromqlChartConfig would ship green.
    • Fix: Add a PromQL-config case to the "returns null" describe block.
    • testing

Reviewers (7): correctness-testing, maintainability, project-standards, agent-native, learnings-researcher, kieran-typescript, api-contract.

Coverage caveats:

  • Bash, Grep, and Glob were non-functional for this run (bwrap sandbox init failure on every invocation), so git diff against the base was unavailable. All findings were derived by reading the PR-head state of the 18 files directly; the claim that the move dropped nothing could not be verified mechanically against the base — the split RESPONSIVE_CONTAINER_DEBOUNCE_MS comment is one confirmed instance where content did not survive intact.
  • Consumers of @/components/DBTimeChart and @/HDXMultiSeriesTimeChart outside the two directories could not be enumerated without search tools, so barrel-completeness findings rest on the modules themselves rather than on verified importers. Whether any external file previously imported a symbol the barrels no longer expose remains unverified.
  • Four dispatched reviewers (correctness, adversarial, performance, frontend-races) had not returned when the report was assembled; the interaction-state and memoization-boundary surfaces of MemoChart.tsx are therefore covered only by the orchestrator's own read.
  • No docs/solutions/ knowledge base exists in this repo, so no prior learnings could be matched against this change.

Testing gaps:

  • useChartScales.ts axis-domain derivation — no coverage below E2E.
  • crossChartPin.ts cross-chart dismiss broadcast — no coverage.
  • useChartToolbarItems.tsx conditional item assembly and ordering — no coverage.
  • ChartLegend.tsx current/previous-period sort order and MAX_LEGEND_ITEMS overflow popover — no coverage.
  • searchUrl.ts — seriesValue: 0, PromQL config, and a series-key prefix absent from valueColumns are all unexercised.

karl-power
karl-power previously approved these changes Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

<!-- deep-review -->

Deep Review

✅ No critical issues found. The split is structurally sound: both barrels resolve, the former monolith paths (packages/app/src/HDXMultiSeriesTimeChart.tsx, packages/app/src/components/DBTimeChart.tsx) are gone so there is no stale-file-shadows-directory resolution hazard, and the narrowed xAxisDomain: [number, number] matches the opts: { domain: [number, number] } signature getAnnotationElements already declared in packages/app/src/components/charts/chartAnnotations.tsx — the removed assertions were genuinely redundant.

🟡 P2 -- recommended

  • packages/app/src/HDXMultiSeriesTimeChart/useChartScales.ts:85 -- With fitYAxisToData on and a flat series, minValue === maxValue makes padding zero, so the function returns a zero-height domain such as [50, 50] and the axis has no range to draw against.
    • Fix: Widen the domain by a minimum absolute epsilon (or fall back to [0, 'auto']) when maxValue - minValue is zero, and add a useChartScales case for a single flat series with fitYAxisToData: true.

🔵 P3 nitpicks (8)

🔵 P3 nitpicks (8)
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:87 -- MemoChart.tsx is ~723 lines and packages/app/src/components/DBTimeChart/DBTimeChart.tsx is ~470, both above the 300-line ceiling in root AGENTS.md Key Principles feat: add docker prod build stages and publish prod builds #4.

    • Fix: Either extract the brush-zoom interaction state and its three refs into a useBrushZoom hook, or record an explicit exemption for these two files so the convention is not silently eroded.
  • packages/app/src/components/DBTimeChart/useChartToolbarItems.tsx:13 -- useMVOptimizationExplanation is imported as a value binding but used only inside ReturnType<typeof useMVOptimizationExplanation>, while every sibling import in the same file uses the type modifier.

    • Fix: Change it to import type { useMVOptimizationExplanation } from '@/hooks/useMVOptimizationExplanation';.
  • packages/app/src/components/DBTimeChart/ChartTooltipOverlay.tsx:70 -- The comment points a reader at HDXMultiSeriesTimeChart handleClick, but no handleClick identifier exists — the stopPropagation call now lives in an inline onClick prop in MemoChart.tsx.

    • Fix: Retarget the reference to MemoChart.tsx's onClick handler.
  • packages/app/src/components/DBTimeChart/ChartTooltipOverlay.tsx:141 -- payload.activePayload! re-asserts what the isOpen computation already proved, so the compiler is doing no work for this field.

    • Fix: Replace the isOpen boolean with an early return that narrows payload.activePayload directly, then drop the assertion.
  • packages/app/src/HDXMultiSeriesTimeChart/index.ts:14 -- The public/internal line is uneven: constants.ts exports seven constants and the barrel forwards one, chartData.ts exports six symbols and the barrel forwards five, with no stated rule for which side a symbol lands on.

    • Fix: Add a one-line comment in each barrel stating the inclusion rule, or forward every symbol an out-of-directory consumer could need.
  • packages/app/src/components/DBTimeChart/__tests__/searchUrl.test.ts:7 -- The test reaches a pure function through the barrel, which transitively loads DBTimeChart.tsx, @/api, recharts and Mantine, so an unrelated import change in the component can break a test that exercises none of it — and the sibling __tests__/crossChartPin.test.tsx:3 deep-imports instead, so the two disagree.

    • Fix: Import buildSeriesSearchUrl from ../searchUrl and align both test files on the same import style.
  • packages/app/src/components/DBTimeChart/searchUrl.ts:136 -- The multi-value branch uses an index found in valueColumns to subscript config.select, an alignment invariant that was implicit inside the component but is now part of a public signature taking the two as independent parameters.

    • Fix: Document the ordering requirement on the parameter, or resolve the select item by matching on its valueExpression rather than by positional index.
  • packages/app/src/HDXMultiSeriesTimeChart/ChartTooltipContent.tsx:129 -- The sort operates on the raw any-typed payload rather than the typedPayload computed at line 62 for exactly this purpose, so b.value - a.value is unchecked and yields an unstable order if a value is non-numeric.

    • Fix: Sort typedPayload instead of payload.

Reviewers (0 returned): correctness, adversarial, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, api-contract, performance, agent-native were all dispatched but none returned before output was required; every finding above comes from direct file-by-file reading of the changed surface by the orchestrator.

Coverage limitations — read these before trusting the absence of findings:

  • Bash fails on every invocation in this environment (bwrap: Can't create file at /home/.mcp.json: Permission denied), and Grep/Glob are not available. No git diff was possible, so before/after comparison could not be performed and the PR's claim that nothing was lost in the move is unverified by this review.
  • The changed-file inventory was reconstructed by probing absolute paths with Read, so a changed file outside the two chart directories would have been missed.
  • Consumers could not be searched. Whether any out-of-directory importer needed a symbol the barrels no longer forward (collectMemoChartGradientHexes, LegendRenderer, HDXLineChartTooltip, TooltipItem, useChartScales, MAX_LEGEND_ITEMS, useChartToolbarItems, useCrossChartPinDismiss) is unresolved — TypeScript compilation would catch it, so treat a green make ci-lint as the real gate here.
  • ce-learnings-researcher was not dispatched: it requires repo-wide search over docs/solutions/.
  • .changeset/ could not be listed, so changeset presence is inconclusive. Note that searchUrl.ts:114 carries a != null guard whose own comment describes a drill-down widening to every event in the bucket — if that guard is a behavior change rather than a faithful move, it is user-visible and warrants a changeset.

Testing gaps:

  • No test accompanies buildActiveClickSeries or getVisibleLineData in packages/app/src/HDXMultiSeriesTimeChart/__tests__/, despite both docblocks stating they are exported for unit testing (tests elsewhere in the package could not be ruled out).
  • collectMemoChartGradientHexes in MemoChart.tsx:74 documents a unit test pinning its dedup-and-union behavior; no such test was found in the new directory.
  • useChartScales.test.ts covers six y-domain branches but not the degenerate minValue === maxValue case described above.
  • searchUrl.test.ts pins the multi-value-column path only for valueColumns aligned with config.select; the misaligned case is untested.

wrn14897
wrn14897 previously approved these changes Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

<!-- deep-review -->

Deep Review

✅ No critical issues found. This is a genuine reorganisation — both barrels use explicit named re-exports (no export *), no import cycle exists between the two directories, and every consumer I could read resolves cleanly. The findings below are pre-existing logic that the split relocated and newly exposed to test, plus gaps in the new test surface.

🟡 P2 — recommended

  • packages/app/src/components/DBTimeChart/searchUrl.ts:138 — The multi-value branch resolves a select item by treating the index into valueColumns as an index into config.select, but valueColumns is built by inferValueColumns(meta, new Set(hiddenSeries)) while config.select is unfiltered, so any hidden series shifts the mapping onto a different column.
    • Fix: Carry the originating select index or valueExpression on the series payload through ActiveClickSeries instead of re-deriving it by name lookup plus positional index.
    • adversarial
  • packages/app/src/components/DBTimeChart/searchUrl.ts:29 — decodeSeriesGroupFilters reverse-engineers structured filters by splitting the display key on ChartKeyJoiner (' · '), so a group value containing that separator zips onto the wrong columns and a JSON-stringified Map/Array group value is emitted as a literal that can never match a row.
    • Fix: Attach the structured raw group values to each LineData where the key is built, and read those instead of splitting the display string.
    • adversarial, correctness
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:547 — suppressNextClickRef is set unconditionally on a completed brush-zoom but is only ever cleared inside onClick, so any drag whose trailing click is never dispatched leaves the flag set and silently swallows the user's next real click.
    • Fix: Make suppression self-expiring via a timestamp compared in onClick, and clear the flag at the top of onMouseDown so each new interaction starts unsuppressed.
    • adversarial, julik-frontend-races
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:465 — onMouseLeave clears highlightStart/mouseDownPosRef without setting the suppression flag, so a drag that exits the chart bounds and is released after re-entry falls through to onClick and pins a tooltip the user never asked for.
    • Fix: Set suppressNextClickRef.current = true in onMouseLeave whenever highlightStart is non-null.
    • julik-frontend-races
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:157 — activePointYByKeyRef is only ever written via set and never pruned, so after a legend isolation the stale keys still satisfy the size > 1 gate and can win the nearest-line comparison, leaving nearestSeriesKey pointing at a series that is no longer drawn.
    • Fix: Clear the map when the drawn series set changes, and restrict the candidate list to visibleLineData keys rather than all map keys.
    • adversarial
  • packages/app/src/HDXMultiSeriesTimeChart/useChartScales.ts:105 — The [number, number] tuple declares a finite, ordered domain that the implementation does not guarantee: a dateRange collapsing into one granularity bucket with boundary alignment and non-inclusive end yields [t, t - g], and the annotation clamp then collapses every marker onto a single wrong position.
    • Fix: Return [Math.min(a, b), Math.max(a, b)] and fall back to the raw range in seconds when either bound is non-finite, so the declared tuple invariant actually holds.
    • adversarial
  • packages/app/src/components/DBTimeChart/ChartTooltipOverlay.tsx:50 — The pinned tooltip is anchored to viewportX/viewportY captured once at click time, and the only dismissal triggers are window scroll and outside-mousedown, so resizing a dashboard tile or the browser leaves the tooltip floating away from its data point.
    • Fix: Observe the chart container with a ResizeObserver and call onDismiss on geometry change, mirroring the existing scroll effect.
    • julik-frontend-races
  • packages/app/src/components/DBTimeChart/__tests__/searchUrl.test.ts:183 — The attributability rule is duplicated across the single-value and multi-value branches, but the multi-value case is only exercised with an attributable p95, so dropping or inverting the guard in the multi-value branch would pass the whole suite.
    • Fix: Add a multi-value case selecting the count column and assert valueRangeFilter is undefined.
    • testing
  • packages/app/src/components/DBTimeChart/crossChartPin.ts:6 — The module-level pinnedTooltipRegistry coordinates dismissal across every chart on a page and has no test at all, including no reset between cases, so a leaked entry from one test can affect another.
    • Fix: Add a renderHook test mounting two subscribers that asserts cross-instance dismissal fires on the other chart but not the pinning one, plus unmount removing the entry.
    • testing, correctness, julik-frontend-races
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:352 — At 724 and 471 lines, MemoChart.tsx and DBTimeChart.tsx both exceed the 300-line cap stated in agent_docs/code_style.md:17, and the drag/zoom/click state machine that keeps them large is the one seam with no unit coverage.
    • Fix: Extract zoomOrigin, justZoomedRef, suppressNextClickRef, highlightStart/highlightEnd and their four handlers into a hook that returns the handlers plus a shouldSuppressClick(), following the useChartScales precedent.
    • project-standards, maintainability, testing
🔵 P3 nitpicks (10)
  • packages/app/src/HDXMultiSeriesTimeChart/index.ts:15 — collectMemoChartGradientHexes, buildActiveClickSeries, and getVisibleLineData are on the curated public barrel although their own docblocks say they exist for unit testing.
    • Fix: Import them in tests via a relative path from their defining module, or expose them under a separate testing entry point.
  • packages/app/src/HDXMultiSeriesTimeChart/ChartLegend.tsx:19 — entry is typed any, so entry.color, entry.value, and entry.payload?.strokeDasharray are unchecked.
    • Fix: Declare a LegendEntry type with those fields and use it for the prop.
  • packages/app/src/HDXMultiSeriesTimeChart/ChartTooltipContent.tsx:30 — & Record<string, any> makes every recharts-injected prop any, and the as TooltipPayload[] cast then asserts a shape nothing validates.
    • Fix: Use recharts' TooltipProps or a narrow hand-written type and replace the cast with a guard.
  • packages/app/src/components/DBTimeChart/ChartTooltipOverlay.tsx:141 — The payload.activePayload! assertion relies on narrowing through the intermediate isOpen boolean, which TypeScript does not propagate.
    • Fix: Narrow payload.activePayload directly in the early-return guard and bind it to a local.
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:386 — justZoomedRef is consumed only inside the [dateRange] effect, so a zoom that produces no new range reference leaves it set and the next external range change preserves a stale zoomOrigin behind the reset button.
    • Fix: Record the requested range and treat the change as internal only when the incoming range matches it.
  • packages/app/src/components/DBTimeChart/searchUrl.ts:163 — A negative clicked value produces value * (1 - t) above value * (1 + t), yielding an inverted BETWEEN that matches nothing for avg/min/max series that legitimately go negative.
    • Fix: Order the bounds with Math.min/Math.max, or compute them as value ± Math.abs(value) * threshold.
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:354 — A touch drag cancelled by the OS fires no mouseup or mouseleave, leaving the highlight ReferenceArea drawn until the next mousedown.
    • Fix: Clear the highlight state on pointercancel/touchcancel on the container.
  • packages/app/src/HDXMultiSeriesTimeChart/index.ts:1 — This directory sits at src/ while its counterpart DBTimeChart/ sits at src/components/, and growing it to nine files plus __tests__/ raises the cost of correcting that later.
    • Fix: Move the directory under src/components/ now while both consumers already go through the barrel, or record the decision to leave it.
  • packages/app/src/HDXMultiSeriesTimeChart/index.ts:2 — Both barrel docblocks cite the pre-split files' exact line counts, a point-in-time fact that will silently go stale.
    • Fix: Keep the durable rationale about consumers importing from the barrel and drop the specific figures.
  • packages/app/src/components/DBTimeChart/DBTimeChart.tsx:373 — The { dataKey?: string; name: string } focus-series shape is written independently in handleFocusSeries and in ChartTooltipOverlay's onFocusSeries prop.
    • Fix: Export one named type and use it on both sides of the boundary.

Reviewers (8): correctness, adversarial, testing, maintainability, kieran-typescript, julik-frontend-races, api-contract, project-standards.

Testing gaps:

  • MemoChart's drag/zoom/click state machine has no unit test; the drag→click and zoom→external-range-change orderings are unexercised.
  • searchUrl.test.ts mocks buildEventsSearchUrl, so no test in this diff observes an emitted URL — escaping and semantics of group and value filters are invisible to the suite by construction.
  • decodeSeriesGroupFilters is only exercised with a single plain ASCII group value; no case for a separator collision, a JSON-stringified Map value, or an empty string.
  • useChartScales.test.ts exists and covers the fit-to-data, selection, and bar-padding branches, but omits the degenerate corners: equal-valued data, a same-bucket date range, and an unparseable granularity.
  • ChartTooltipOverlay's scroll and outside-click contains() guards, whose whole purpose is to avoid self-dismissal, have no test.

Coverage note: Bash, Grep, and Glob were unavailable for this run, so consumer discovery was done by reading candidate files individually. Barrel completeness is verified for every consumer found — including components/charts/ChartSeriesTooltip.tsx, which imports ActiveClickSeries — but is not proven exhaustively; a repo-wide grep for both import specifiers and for jest.mock call sites is worth running before merge.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

<!-- deep-review -->

Deep Review

✅ No critical issues found. Every concrete failure mode the reviewers traced resolves to pre-existing logic that this diff relocates rather than writes, so nothing graded above P2. The findings below are worth addressing but none block the merge.

🟡 P2 — recommended

  • packages/app/src/components/DBTimeChart/searchUrl.ts:138 — The multi-value branch maps the clicked series to config.select by its position in valueColumns, but valueColumns is filtered by hidden series while config.select is not, so the drill-down filter can be built from a different select item's valueExpression and search for rows that never contributed to the clicked point.
    • Fix: Resolve the select item by matching the value column's name against each select item's alias or valueExpression, and omit valueRangeFilter when no unambiguous match exists.
    • correctness, adversarial
  • packages/app/src/HDXMultiSeriesTimeChart/useChartScales.ts:80 — When every visible sample is equal, padding evaluates to 0 and the y-domain collapses to [v, v], which is reachable by isolating a flat gauge or an always-zero error counter from the legend.
    • Fix: Fall back to a non-zero span when maxValue === minValue, for example Math.max(Math.abs(maxValue) * 0.05, 1).
    • adversarial, testing
  • packages/app/src/HDXMultiSeriesTimeChart/useChartScales.ts:55 — A legend selection sets hasSelection, which skips the [0, 'auto'] early return, so a StackedBar chart with fitYAxisToData off receives a non-zero lower bound and a selected series with negative values is clamped to 0 and clipped out of the plot.
    • Fix: Return a zero lower bound whenever displayType is StackedBar, and retain minValue - padding when the data minimum is negative.
    • adversarial
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:510 — The drag branch fires on any pointer move while highlightStart is set and there is no window-level mouseup or blur fallback, so losing the mouseup without the cursor leaving the chart leaves the selection box following the bare cursor and clears the pinned tooltip on every subsequent move.
    • Fix: Bail out of the drag branch when no mouse button is held, and clear highlightStart, highlightEnd, and mouseDownPosRef from a window-level pointerup/blur listener registered for the duration of the drag.
    • julik-frontend-races
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:360 — zoomOrigin and the reset control are MemoChart-local, but DBTimeChart swaps MemoChart out for the empty-state div when the narrowed range returns no rows, so brushing into a sparse gap unmounts the only affordance that could restore the previous range.
    • Fix: Lift zoomOrigin and the reset control into DBTimeChart, or render the empty state inside the chart container so MemoChart stays mounted.
    • adversarial
  • packages/app/src/components/DBTimeChart/searchUrl.ts:142 — Two branches of the value-column resolution are unexercised by the new suite: a series-key prefix absent from valueColumns so findIndex returns -1, and a bare-string select item where aggFn is undefined and the attributability check falls through to its permissive default.
    • Fix: Add a case with a non-matching prefix asserting no value filter is produced, and a case with a string select item asserting the expression resolves to the string itself.
    • testing, correctness
  • packages/app/src/components/DBTimeChart/__tests__/searchUrl.test.ts:122 — No success-path case asserts what buildSeriesSearchUrl itself returns; every non-null case only inspects the delegate's recorded arguments, so deleting the return keyword at the delegation site would leave the whole suite green.
    • Fix: Capture the return value in at least one success case and assert it equals the mocked URL.
    • testing
  • packages/app/src/HDXMultiSeriesTimeChart/__tests__/useChartScales.test.ts:119 — The only exclusive-end case uses a range end already aligned to the granularity boundary, so the endTimeIsBoundaryAligned guard is never observed suppressing the bucket subtraction.
    • Fix: Add a case with an off-boundary exclusive end and assert the resulting domain matches the inclusive result.
    • testing
  • packages/app/src/components/DBTimeChart/__tests__/searchUrl.test.ts:7 — This pure-function unit test imports through the directory barrel, which evaluates the chart component and its recharts, Mantine, and next/link dependency graph with none of it mocked, so an unrelated module-level change anywhere in that tree fails a test about URL branching.
    • Fix: Import buildSeriesSearchUrl from ./searchUrl so the test loads only the module under test.
    • maintainability, api-contract, testing, adversarial
🔵 P3 nitpicks (11)
  • packages/app/src/components/DBTimeChart/searchUrl.ts:164 — A negative clicked value is passed through as a bare number, and the consumer expands it as value * (1 ± threshold), producing an inverted and therefore unsatisfiable BETWEEN band.
    • Fix: Pass an explicit ordered [low, high] pair, or order the bounds with Math.min/Math.max before emitting the clause.
  • packages/app/src/HDXMultiSeriesTimeChart/useChartScales.ts:44 — yAxisDomain remains the wide AxisDomain while xAxisDomain was narrowed, even though it returns only three concrete shapes.
    • Fix: Narrow yAxisDomain to [number, 'auto'] | ['auto', 'auto'] | [number, number].
  • packages/app/src/components/DBTimeChart/searchUrl.ts:128 — The AGG_FNS.find(...)?.isAttributable !== false check now appears twice in this file and treats any aggregation missing from the array as attributable.
    • Fix: Extract a single isAttributableAggFn(aggFn) helper backed by a total record so a new aggregation must be classified to compile.
  • packages/app/src/components/DBTimeChart/searchUrl.ts:38 — isSingleValueColumn is typed optional and defaulted with ?? true in two separate functions, though no caller omits it.
    • Fix: Make the parameter a required boolean on both functions and drop both fallbacks.
  • packages/app/src/components/DBTimeChart/__tests__/searchUrl.test.ts:12 — The mock's argument type is hand-copied rather than derived, and configWith plus the TSource fixture use unchecked casts, so a real signature change would not fail this file.
    • Fix: Derive the type via Parameters<typeof buildEventsSearchUrl>[0] and add satisfies clauses to the fixtures.
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:723 — At 723 lines this file, and DBTimeChart.tsx at 470, both exceed the 300-line ceiling documented in AGENTS.md and agent_docs/code_style.md.
    • Fix: Extract the drag-to-zoom handlers and the gradient <defs> block into their own modules, or record an explicit exemption for these two files.
  • packages/app/src/HDXMultiSeriesTimeChart/ChartTooltipContent.tsx:30 — The props type is intersected with Record<string, any> and the payload is then force-cast, so every prop read here is unchecked.
    • Fix: Type the props against recharts' TooltipProps<number, string> and replace the cast with a guard.
  • packages/app/src/HDXMultiSeriesTimeChart/ChartLegend.tsx:19 — ExpandableLegendItem takes entry: any, so entry.value and entry.payload?.strokeDasharray are unchecked reads.
    • Fix: Declare the union of the two shapes the caller actually constructs.
  • packages/app/src/components/DBTimeChart/DBTimeChart.tsx:156 — placeholderData: (prev: any) => prev discards the query's placeholder typing, and the pattern repeats for the previous-period query.
    • Fix: Drop the annotation and let the options type infer prev.
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:375 — justZoomedRef is a single boolean correlating a zoom with "the next dateRange change", so an interleaved external range update consumes the flag and the real zoom is then misread as external.
    • Fix: Stash the requested range or a token and compare it in the effect instead of relying on ordering.
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:500 — activePointYByKeyRef is only ever written to, so keys for series that are no longer drawn stay in the map and can win the nearest-series comparison, dropping line emphasis.
    • Fix: Pass the visible dataKey list as the candidate set, or clear the ref when the visible series change.

Reviewers (10): correctness, adversarial, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, api-contract, performance, agent-native.

Coverage limit: Bash, Grep, Glob, and WebFetch were all unavailable in this environment, so no reviewer could compute a base-vs-head diff, run the suite, or search the tree. Findings were derived from the head state of the 19 files by direct read only; the claim that the split preserves every prior export and import path could not be verified against the base commit, and the learnings-researcher pass was skipped for lack of search tooling. The pre_existing attributions above reflect reviewer judgment about relocated logic, not a confirmed diff.

Testing gaps:

  • MemoChart's drag-to-zoom and click-suppression handshake has no unit or integration test; it is covered only by the E2E suite.
  • No test mounts two charts to confirm that pinning one dismisses the other through the cross-chart registry.
  • useChartScales is never re-rendered with changed props, so its three useMemo dependency arrays are unverified.
  • No barrel test pins the re-export list, so an accidentally dropped export surfaces only as a type error in whichever consumer needs it.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. This holds up as a genuine code-motion refactor. The buildSeriesSearchUrl body is byte-for-byte equivalent to the original inline useCallback, both barrels re-export every symbol external consumers actually import (verified against all @/components/DBTimeChart and @/HDXMultiSeriesTimeChart importers), and the one behavioral change — the drill-down guard seriesValue && → seriesValue != null — is correct end-to-end: buildActiveClickSeries already filters non-finite values so only an exact 0 is newly admitted, and buildEventsSearchUrl produces a BETWEEN 0 AND 0 filter for it. The xAxisDomain narrowing to [number, number] matches what the memo already returned. Several nits from earlier review rounds (orphaned RESPONSIVE_CONTAINER_DEBOUNCE_MS comment, flat-series zero-height y-domain, StackedBar negative clamp, hardcoded tooltip offset={12}, the nested duplicate test path) are already resolved in the current head.

🟡 P2 -- recommended

  • packages/app/src/components/DBTimeChart/__tests__/searchUrl.test.ts:200 -- Every non-null success case asserts only the delegate's recorded arguments, never the value buildSeriesSearchUrl returns, so deleting the return at the delegation site would leave the suite green even though the returned URL is the whole point of the extraction.
    • Fix: Assert the returned string equals the mocked delegate URL in at least one success case.
    • testing, previous-comments

Pre-existing (not introduced by this diff; file as follow-up, severity unchanged):

  • packages/app/src/components/DBTimeChart/searchUrl.ts:206 -- The multi-value branch indexes expandedConfig.select by the clicked series's position in valueColumns, but valueColumns is filtered by hidden series while config.select is not, so a hidden value-column series on a multi-value no-group chart shifts the mapping onto a different select item's valueExpression; the new operandsHidden guard only covers the metric-formula operand case. This logic moved verbatim from the monolith and is bounds-guarded, but is now a newly-exposed, untested public path.
    • Fix: Resolve the select item by matching the value-column name against each select item's alias/valueExpression and omit valueRangeFilter when no unambiguous match exists.
    • previous-comments, correctness, kieran-typescript
🔵 P3 nitpicks (6)
  • packages/app/src/components/DBTimeChart/searchUrl.ts:175 -- The operandsHidden guard, the findIndex === -1 (non-matching series-key prefix) path, and the bare-string select-item path are all uncovered by searchUrl.test.ts, so removing any of them would go undetected.
    • Fix: Add a hidden-operand formula case asserting no valueRangeFilter, a non-matching-prefix case asserting no filter, and a string select-item case asserting the expression resolves to the string itself.
  • packages/app/src/components/DBTimeChart/useChartToolbarItems.tsx:19 -- useMVOptimizationExplanation is imported as a value binding but used only inside ReturnType<typeof useMVOptimizationExplanation>, dragging the hook's runtime graph into a presentational module while sibling imports use the type modifier.
    • Fix: Change it to import type { useMVOptimizationExplanation } from '@/hooks/useMVOptimizationExplanation';.
    • kieran-typescript, previous-comments
  • packages/app/src/components/DBTimeChart/ChartTooltipOverlay.tsx:87 -- A comment points at HDXMultiSeriesTimeChart handleClick, an identifier that no longer exists; the stopPropagation call now lives in an inline onClick prop in MemoChart.tsx.
    • Fix: Retarget the comment to MemoChart.tsx's onClick handler.
  • packages/app/src/HDXMultiSeriesTimeChart/index.ts:7 -- The barrel omits three types the monolith exported (NiceYAxisTicks, ExpandableYAxisTicks, YAxisBounds); no external consumer imports them today, so nothing breaks, but the public surface is narrower than before.
    • Fix: Re-export the three type symbols for parity, or leave them out deliberately with a note.
  • packages/app/src/HDXMultiSeriesTimeChart/MemoChart.tsx:1 -- MemoChart.tsx (984 lines) and components/DBTimeChart/DBTimeChart.tsx (702 lines) remain above the 300-line ceiling in AGENTS.md Key Principles feat: add docker prod build stages and publish prod builds #4 after the split.
    • Fix: Extract the brush-zoom interaction state/refs into a useBrushZoom hook, or record an explicit exemption so the convention is not silently eroded.
    • project-standards, previous-comments
  • packages/app/src/HDXMultiSeriesTimeChart/useChartScales.ts:57 -- The extracted scanYAxisValueRange/scanStackedYAxisValueRange/computeYAxisBounds keep graphResults: any[] while the hook's own argument is Record<string, unknown>[]; the extraction was the moment to tighten the public signature (access is already typeof value === 'number'-guarded).
    • Fix: Type the parameter as Record<string, unknown>[].

Reviewers (6): correctness, testing, project-standards, api-contract, kieran-typescript, previous-comments.

Testing gaps:

  • No success-path test asserts buildSeriesSearchUrl's return value; the end-to-end BETWEEN 0 AND 0 SQL for a clicked zero is also unasserted (coverage stops at valueRangeFilter.value === 0).
  • The hidden-value-column positional-shift scenario in searchUrl.ts has no unit test, so the partially-addressed mapping edge is unguarded.
  • Barrel re-export resolution for external consumers and jest.mock('@/...') paths relies on the TS compiler/full jest run; the PR's passing E2E and ci-unit cover this at runtime.
  • The adversarial, maintainability, and frontend-races reviewers were dispatched but did not return before synthesis; the correctness reviewer's byte-for-byte equivalence check and three prior deep-review passes independently corroborate the clean verdict, and the brush-zoom interaction state they would examine is relocated verbatim.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

typeof firstSelect === 'string' ? undefined : firstSelect.aggFn;
// Only add value range filter if the aggregation is attributable
const isAttributable =
AGG_FNS.find(fn => fn.value === aggFn)?.isAttributable !== false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — New helper module restates the agg-attributability check that already exists in ChartUtils

AGG_FNS.find(fn => fn.value === aggFn)?.isAttributable !== false appears twice here (lines 155 and 179) and a third time in packages/app/src/ChartUtils.tsx:1395, inside buildTableRowSearchUrl — the table-click sibling of this function, which also decodes group filters, resolves a value expression, builds a valueRangeFilter and delegates to buildEventsSearchUrl. The REQUIRED DRY rule bites at the moment a new helper module is created. Note the sibling already guards with rowValue != null (ChartUtils.tsx:1414) — exactly the guard this PR had to fix on the chart path; a shared helper would have carried it. Export an isAttributableAggFn(aggFn) from ChartUtils.tsx and call it from all three sites.

// there throws inside the render, which withErrorBoundary latches for the
// rest of this instance's life — the chart never recovers. A shared constant
// rather than `?? []` so the memo's dependency stays referentially stable.
const typedPayload = (payload ?? EMPTY_PAYLOAD) as TooltipPayload[];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — Two further deviations from "pure movement" beyond the two the PR enumerates

The PR states there are exactly two changes beyond movement and that every non-import line was diffed. Two more slipped through: payload ?? EMPTY_PAYLOAD here (the original was payload as TooltipPayload[], which would throw in the payloadByKey memo before the active && payload guard and permanently latch withErrorBoundary's fallback), and graphResults: any[] → Record<string, unknown>[] at HDXMultiSeriesTimeChart/MemoChart.tsx:129. The EMPTY_PAYLOAD guard is a real behaviour change: either recharts can hand this content an undefined payload, in which case it fixes a user-visible "An error occurred while rendering the tooltip" latch and wants a changeset plus a test rendering with payload={undefined}, or it cannot, in which case the branch is unreachable and should be dropped. Either way, list it alongside the other two so a reader trusting the "no feature code" framing doesn't skip it.

expect(dateRange[1].getTime() - clicked.getTime()).toBe(60_000);
});

describe('value-range filter', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — The subtlest branch in the newly-testable function is the one left untested

Extracting buildSeriesSearchUrl was justified by making its branching testable, and the nine cases cover attributability, zero, and the multi-value prefix — but not operandsHidden (searchUrl.ts:132-135), which suppresses the value filter for a builder config with formulas and showOperandSeries === false because value columns no longer map positionally onto select. Deleting that guard keeps the suite green while misattributing a formula value to an operand's expression. Add a case with a non-empty formulas and showOperandSeries: false asserting valueRangeFilter is undefined.

*/
export { DBTimeChart } from './DBTimeChart';
export {
buildSeriesSearchUrl,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — buildSeriesSearchUrl added to the documented public surface only so a test can reach it

Nothing outside components/DBTimeChart/ imports it (DBTimeChart.tsx:36 is the only production caller), and the barrel's own docblock calls itself the public surface that exists so the internal layout stays free to change. crossChartPin.test.tsx:3 shows the intended pattern in this same PR — it deep-imports @/components/DBTimeChart/crossChartPin and the hook stays internal. Have searchUrl.test.ts import '@/components/DBTimeChart/searchUrl' and drop buildSeriesSearchUrl from index.ts; that also stops a pure-function test from pulling in the whole DBTimeChart component graph (@/api, @/source, @/hooks/useChartConfig, Mantine) at module load.

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 P0/P1 in code this PR adds or changes: fix before asking for review.
  • 🟡 P2 in code this PR changes: your call. Fix if small, otherwise reply.
  • 🔵 P3 is collapsed at the bottom: nobody needs to act on it before merge.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    priority. Reply with one sentence; if it is P0, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

3 finding(s): 🔴 0 P0/P1 · 🟡 0 P2 · 🔵 3 P3

No inline comments. 3 P3 folded at the bottom.

🔵 3 P3 — no action needed before merge
  • 🔵 P3 packages/app/src/components/DBTimeChart/searchUrl.ts:196 — The attributable-aggregation check is now copied three times → The check AGG_FNS.find(fn => fn.value === aggFn)?.isAttributable !== false plus the string-or-object valueExpression pick appears twice in this function (lines 194-205 and 217-229) and a third time in buildTableRowSearchUrl (packages/app/src/ChartUtils.tsx:1539-1548). Now that this logic lives in a pure module, move it into one helper in ChartUtils, e.g. getAttributableValueExpression(selectItem): string | undefined, and call it from all three places so they can't drift apart.
  • 🔵 P3 packages/app/src/components/DBTimeChart/__tests__/searchUrl.test.ts:185 — New tests skip the multi-value attributable check and the hidden-operands guard → The only multi-value test clicks an attributable p95 column. If the isAttributable check in the else if arm (searchUrl.ts:218-228) were deleted, clicking the count series would add a value filter and every test would still pass. The operandsHidden early-out (searchUrl.ts:175-178) has no test either. Add a case with seriesKey: 'count' on the same config that expects valueRangeFilter to be undefined, and a formulas config with showOperandSeries: false that also expects no filter.
  • 🔵 P3 packages/app/src/components/DBTimeChart/__tests__/searchUrl.test.ts:61 — configWith and args use as casts even though fromPartial is already imported here → The repo convention says to avoid as casts, and this file already builds rawSqlConfig and promqlConfig with fromPartial<ChartConfigWithDateRange>. Build configWith the same way, and type args with a named type (or satisfies) in place of the inline as Date | undefined / as string[] | undefined casts.

Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides.

…t-chart-files

# Conflicts:
#	packages/app/src/HDXMultiSeriesTimeChart.tsx
});
});

it('resolves the value column by series-key prefix on a multi-value chart', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — The attributability check on the multi-value branch is never tested

The only multi-value test clicks p95, which is attributable. You could delete the isAttributable check in the else if branch (searchUrl.ts:299-308) and every test would still pass. Add a case with seriesKey: 'count', valueColumns: ['count','p95'] and a count select item that expects valueRangeFilter to be undefined. That non-attributable case is the regression the PR description says these tests exist to catch.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

]),
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Components exceed size limit

The repository requires component files to stay under 300 lines and large components to be split up. This extraction leaves MemoChart.tsx at 883 lines and components/DBTimeChart/DBTimeChart.tsx at 613 lines, so the repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

…t-chart-files

# Conflicts:
#	packages/app/src/HDXMultiSeriesTimeChart.tsx
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 108 in total (1.13%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

});
});

it('resolves the value column by series-key prefix on a multi-value chart', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — Two branches in the new searchUrl tests are never exercised: the multi-value non-attributable case and operandsHidden

Add two cases: (1) seriesKey: 'count' with valueColumns: ['count','p95'] should give no valueRangeFilter; (2) a builder config with formulas and showOperandSeries: false should give no valueRangeFilter. Right now you could delete the isAttributable check in the multi-value branch, or the whole operandsHidden guard, and every test would still pass. Those are the rules this test file says it pins.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

// Determine which value column to filter on
let valueExpression: string | undefined;

if ((isSingleValueColumn ?? true) && expandedConfig.select.length === 1) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — The 'is this agg attributable, and what is its value expression' logic now has three copies

Pull out one helper, e.g. getAttributableValueExpression(selectItem): string | undefined. It would replace both inline blocks here (lines 150-162 and 174-186) and the identical block in buildTableRowSearchUrl (packages/app/src/ChartUtils.tsx:1475-1485). This file is new and is where that rule is documented, so it is a good place for the single copy.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@@ -0,0 +1,889 @@
import {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — New files still break the 300-line file-size rule: MemoChart.tsx is 889 lines and DBTimeChart.tsx is 617

The 'Max 300 lines' rule in Code Organization applies to files this PR creates. The description says 720 and 469 lines, but the actual new files are 889 and 617. Either split further (for example, move the click/brush interaction handlers in MemoChart and the series-selection/load-all state in DBTimeChart into hooks) or record the exception and the real line counts in the description.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@jordan-simonovski
jordan-simonovski requested a review from a team as a code owner November 3, 2026 13:17
});
});

it('resolves the value column by series-key prefix on a multi-value chart', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — The formula/hidden-operand skip in buildSeriesSearchUrl has no test

The operandsHidden guard stops a formula value from being attributed to an operand's expression, but none of the new tests sets formulas with showOperandSeries: false. Deleting that guard would leave the suite green. Add a test where a formula config with hidden operands and a non-null seriesValue passes valueRangeFilter: undefined to buildEventsSearchUrl.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

…t-chart-files

# Conflicts:
#	packages/app/src/HDXMultiSeriesTimeChart.tsx
#	packages/app/src/components/DBTimeChart/DBTimeChart.tsx

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — fc3655da Deployed Nov 22, 2026 by vercel[bot]
Preview – hyperdx-storybook — fc3655da Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-4 Critical — deep review + domain expert sign-off

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants