feat(profile-distribution): paired histogram cells for inline profile (DRC-3390 PR 3)#1391
Closed
danyelf wants to merge 1 commit into
Closed
Conversation
… (DRC-3390 PR 3) PR 3 of the paired-histograms GA productionization. Adds the frontend cells, hook, schema-row integration, and unsupported-adapter banner that consume the per-column payloads PR 2 will produce. Stacks on PR 1 (#1389) which already shipped RunType.PROFILE_DISTRIBUTION + the discriminated-union plumbing. Includes: - PairedHistogramContinuous — quantile-bin, constant-area paired bar chart. Heights = density, widths = bin span, so bar area reads as the proportion of rows in that bin. Replaces the prototype's uniform-bin renderer (closed PR #1380). - PairedHistogramDiscrete — top-K paired chart with gap-on-absent semantics. When a value is missing on one side, that bar isn't drawn, leaving a visible empty half-slot that reads as 'absent here'. - useInlineProfileDistribution — TanStack-Query-backed hook that fires a single PROFILE_DISTRIBUTION run per model, parses the discriminated- union payload, and returns {distributions, loading, error, isUnsupported}. Emits Amplitude analytics events at request and result (PostHog wiring noted in DRC-3390 but the codebase uses Amplitude — same trail). - InlineProfileDistributionCell — Compact-mode wrapper that picks between loading / error / empty (per-column failure) / continuous / discrete renders in a fixed-size slot, so adjacent rows don't reflow. Grid mode is intentionally absent at GA (per DRC-3390 lock). - ProfileDistributionUnsupportedBanner — once-per-task MUI Alert for the {status: 'unsupported', reason} envelope (Postgres / MySQL / SQLite / SQL Server pre-2022). Payload contract (frozen — PR 2 produces exactly this): - Continuous: {kind:'histogram', bin_edges:[12], base_density:[11], current_density:[11], base_total, current_total} - Categorical: {kind:'topk', values, base_counts, current_counts, base_total, current_total, trimmed} - Per-column failure: {kind:null} - Unsupported envelope: {status:'unsupported', reason:...} Refines the ProfileDistributionResult type in api/types/run.ts from the PR 1 stub (Record<string, unknown>) to the full discriminated union — PR 1 left this as a placeholder for PR 2/3. Tests + storybook: - 57 unit tests across 5 files covering both cells, the integration wrapper, the banner, and the hook (mocked at the submit boundary so PR 2 doesn't need to be merged). - 20 storybook stories covering both cells (cell + card density, light + dark, gap-on-absent, trimmed, empty payload, degenerate range) and all four integration-cell states; verified visually on port 6011. - pnpm type:check clean; remaining errors are pre-existing baseline (CSS module declarations, lineage hooks) and unrelated to this PR. Stacks on #1389. Mocks PR 2's payload in tests; rebase onto main once PR 2 lands. PR 4 (lineage pre-warm + GA flip) consumes the same hook + cacheKeys.profileDistribution(model) cache key. Refs DRC-3390. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Danyel Fisher <danyel@gmail.com>
d91cc06 to
0925fd6
Compare
Contributor
Author
|
Closing as part of restructure (Ultraplan-approved). New 4-stage vertical-slice plan replaces the original 4-PR breakdown. This PR's content splits across:
Branch |
6 tasks
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.
Summary
PR 3 of the DRC-3390 paired-histograms GA productionization (4-PR stack). Adds the frontend cells, hook, schema-row integration, and unsupported-adapter banner that consume the per-column payloads PR 2 produces.
Stacks on #1389. Mocks PR 2 payload until #1389 merges. Rebase onto main after PR 2 merges.
Adds
PairedHistogramContinuous— quantile-bin, constant-area paired bar chart. Heights = density, widths = bin span, so bar area reads as the proportion of rows in that bin. Replaces the prototype's uniform-bin renderer (closed PR feat(schema): bubble-up paired histograms + inline profile in schema view #1380).PairedHistogramDiscrete— top-K paired chart with gap-on-absent semantics. When a value is missing on one side, that bar isn't drawn, leaving a visible empty half-slot that reads as "absent here."useInlineProfileDistribution— TanStack-Query-backed hook that fires a singlePROFILE_DISTRIBUTIONrun per model, parses the discriminated-union payload, and returns{distributions, loading, error, isUnsupported}. Emits Amplitude analytics events at request and result (DRC-3390 says PostHog, codebase uses Amplitude — same trail).InlineProfileDistributionCell— Compact-mode wrapper that picks between loading / error / empty (per-column failure) / continuous / discrete renders in a fixed-size slot so adjacent rows don't reflow. Grid mode is intentionally absent at GA.ProfileDistributionUnsupportedBanner— once-per-task MUI Alert for the{status: 'unsupported', reason}envelope (Postgres / MySQL / SQLite / SQL Server pre-2022).Payload contract (frozen — PR 2 produces exactly this)
{kind:'histogram', bin_edges:[12], base_density:[11], current_density:[11], base_total, current_total}{kind:'topk', values, base_counts, current_counts, base_total, current_total, trimmed}{kind:null}{status:'unsupported', reason:...}Refines
ProfileDistributionResultinapi/types/run.tsfrom PR 1's stubRecord<string, unknown>to the full discriminated union.Out of scope (per DRC-3390 locked decisions)
Also fixes baseline regressions PR 1 introduced
chore(run-registry): PR 1 narrowedfindByRunTypetoRegisteredRunTypebut leftjs/src/components/run/__tests__/registry.test.tsarrays typed asRunType[]— tsc flagged 3 sites. Re-typed toRegisteredRunType[].test(action-adapter): PR 1 added anisRegisteredRunTypeguard insideRecceActionAdapterbut the test mock didn't stub it, breaking 9 tests with timeout failures. Added the guard to the mock.Both committed separately so they can be reviewed (or cherry-picked back to PR 1) in isolation.
Test plan
pnpm run --filter @datarecce/ui type:checkclean (remaining errors are pre-existing CSS-module + lineage-hooks baseline noted in the project memory).pnpm run --filter @datarecce/storybook buildsucceeds.PairedHistogramContinuous,PairedHistogramDiscrete,InlineProfileDistributionCell,ProfileDistributionUnsupportedBanner,useInlineProfileDistribution).http://localhost:6011; screenshots verified for the mixed-state Compact view, gap-on-absent, trimmed marker, loading spinner, error chrome, unsupported banner (light + dark).useInlineProfileDistributioninto the actualSchemaViewCompact row and confirm cells render against a realPROFILE_DISTRIBUTIONrun result.🤖 Generated with Claude Code