Repository navigation
fix(views): chart gradient ids survive any caller text; dashboard tables read cleanly - #2333
Conversation
…e metric picker read cleanly A raw route like `GET (unmatched)` as a sparkline id crashed the canvas painter (`Invalid Canvas paint: url(#spark-endpoint-GET (unmatched))`). Every chart definition now builds gradient ids through a branded `gradientId` helper that keeps ids to [A-Za-z0-9_-] and hashes anything it had to rewrite. Dashboard tables format unitless numbers (no float noise, large values grouped) and the metric picker shows `name (type)` instead of the `name::type` key.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 7 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This comment has been minimized.
This comment has been minimized.
🍁 Maple PR previewNote Preview resources were removed when the preview label came off. Final commit |
This comment has been minimized.
This comment has been minimized.
|
Preview deploy was refused by the preview cap (9 open PRs labelled, all parallel audit sessions plus #2326), not by this change. I removed |
…x/charts-kit-correctness # Conflicts: # apps/web/src/page/kit/query-builder/metrics-body.ts
Maple review🟢 Confidence 10/10 · safe to merge. Contained view-layer change: every gradient and its fill come from one builder, and the new formats are pinned by rendered-scene and string tests. Routes every chart gradient id through a branded sanitizer, so a span name like
Before merge
Findings🔵 Note · F1 · Numeric items inside a list cell still print raw float noisecorrectness ·
🤖 Prompt to fix this finding with an AI agent
|
|
Merged with 1 step from "Before merge" still open. If it is done, tick it on the review comment; if not, now is the time.
|
Fixes the charts-kit findings from the usage audit (2026-10-07 to 11-07), each re-checked against
origin/mainfirst.What changed
1. Sparkline crash (prod).
TypeError: Invalid Canvas paint: url(#spark-endpoint-GET (unmatched)), 2 hits in 14 days, last at 2026-11-05 06:42Z, and the only canvas paint error in prod. The chart library's canvas painter matches gradients with/^url\(#([^)]+)\)$/, so an id with)falls through to CSS colour parsing and throws. Its SVG renderer also strips non-[A-Za-z0-9_-]characters, so ids likea.banda bcould collide.GradientId(packages/views/src/charts/definitions/gradient-id.ts). The ids are[A-Za-z0-9_-]only, and anything that had to be rewritten gets a hash suffix so distinct inputs stay distinct.verticalGradientrequires aGradientId, so a raw caller string is now a type error.2. Dashboard table cells showed raw numbers (
0.30000000000000004,1234567.891). Unitless numeric cells now trim float noise and group values of 10,000 and up. Strings stay exactly as they came: ids, UInt64 counts and versions like3.10all arrive as strings.3. Metric picker showed
name::type. Dropped from this PR: #2336 onmainfixed the same bug its own way (the input shows the metric name, with the type beside it), so the merge keeps main's version.Not fixed here
packages/query-engine/src/query-set/series-merge.ts:190deliberately zero-fills every series in every bucket, for every aggregation. For counts that's correct; for avg, percentiles and gauges it invents zeros. The fix is an aggregation-aware fill in the query engine. Proposed as a follow-up.web-data/alerts/form-utils.tsthreshold conversion). That's the alerts session's (S4) area, so it's left for them.Verification
gradient-id.test.ts: builds real sparkline scenes for worst-case ids (endpoint-GET (unmatched),GET /users/{id}, unicode, NBSP,a bvsa_b), renders the SVG, and checks everyurl(#…)resolves to a defined gradient and parses with the canvas regex. Mutation check: with the helper returning raw ids, the prod case fails.tiles.test.ts(formatCell).oxlint -c .oxlintrc.effect.jsonclean on changed files,packages/viewschart tests and the touched web tests pass./lab/service-apigains a prod-shapedGET (unmatched)endpoint. Before the fix the dev server logs the exact prod error and the row draws no sparkline; after, it draws.formatCellfindings (version strings, grouping) are fixed.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.