Repository navigation
fix(app): only show distribution labels the data backs - #3230
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 8f177d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Additional context: spans packages but only 49 prod lines — under the 100-line cross-layer bar Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
PR Review
3 finding(s): 🔴 0 critical · 🟠 1 major · 🔵 2 minor 1 posted as inline comment(s) on the changed lines. 2 listed below. Findings outside the changed lines2 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
|
Deep ReviewScope: distribution-label display logic in the search-page filters, plus a ClickHouse numeric/boolean key-mapping fix. Intent: show 🟡 P2 — recommended
🔵 P3 nitpicks (4)
Reviewers (10): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, performance, previous-comments, agent-native, learnings-researcher. Testing gaps:
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 |
E2E Test Results✅ All tests passed • 385 passed • 1 skipped • 1574s
Tests ran across 4 shards in parallel. |
| // Missing from a capped result means it ranks below the 100th value, so | ||
| // under 1%. Missing from an uncapped result means it wasn't seen at all. | ||
| return distributionData.size > DISTRIBUTION_VALUE_LIMIT ? 0 : undefined; |
There was a problem hiding this comment.
Rare values lose their label When a value appears in the facet options but its rare rows are missed by the separate distribution sample, a result with at most 100 entries makes this code show no percentage. That hides the
<1% label for a value that is present: an uncapped sample shows only that the value was not sampled, not that it has no matching rows.
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| if (percentage != null) return percentage; | ||
| // Missing from a capped result means it ranks below the 100th value, so | ||
| // under 1%. Missing from an uncapped result means it wasn't seen at all. | ||
| return distributionData.size > DISTRIBUTION_VALUE_LIMIT ? 0 : undefined; |
There was a problem hiding this comment.
🟠 major — Rare values that really exist lose their "<1%" label on sampled tables
getValuesDistribution (packages/common-utils/src/core/metadata.ts:2362-2377) samples roughly 100k rows once a table is larger than that. So a value missing from a result that wasn't cut off may simply not have been picked by the sample; it doesn't mean the value is absent. The facet options come from getKeyValues over the same filtered chartConfig, so an unselected option in the list does have matching rows. Example: a 10M-row table where a listed status value appears in 0.001% of rows. The sample misses it, and it now shows no label, which looks like 'no rows' even though clicking it returns results. Before this change it showed a correct <1%. Suggested fix: once isExcludedByOwnFilter has ruled out filtered values, fall back to 0 (<1%) for any other missing value. If you want to keep the 'not seen' case, only return undefined when the query wasn't sampled (have getValuesDistribution also return sample_factor, and check it is 1).
Nothing blocks merge automatically, but a maintainer will expect this fixed if it is a real defect in code this PR changes. If it is about surrounding code, reply and say so instead of patching. Do not widen the PR. How to respond
With a field filtered to one value, Show distribution on that same field showed the selected value as
>99%and every other value as<1%. Neither was true: the selected value is exactly 100%, and the other values can't appear under the filter.<1%reads as "rare but present", so it looked like data.Each label now shows only when the data backs it:
100%: the field's filter allows only this value.>99%and~N%: estimated from a sample of about 100k rows.<1%: the value was seen in the sample below 1%, or it's missing from a result that was cut off at 100 values, so it ranks below the 100th.Before:
After:
Also: