Repository navigation
refactor(app): name the duration-heatmap number format - #3182
alex-fedotyev wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
PR Review
1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor 1 posted as inline comment(s) on the changed lines. Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. This is a behavior-preserving extraction: the inline 🔵 P3 nitpicks (2)
Reviewers (7): correctness, testing, maintainability, project-standards, agent-native, kieran-typescript, previous-comments. Testing gaps: No test asserts the 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 |
The significant-fields heatmap built { output: 'duration', factor: 0.001 }
inline. The factor is only correct next to getDurationMsExpression, which
applies the source's durationPrecision and leaves the value in ms, so give
it a name in source.ts and document that pairing.
No behavior change.
90a6fdc to
a690c51
Compare
6bdd45c to
887421b
Compare
| * is milliseconds to seconds. Pair the two; this factor is wrong against a | ||
| * raw duration column. | ||
| */ | ||
| export const DURATION_HEATMAP_NUMBER_FORMAT = { |
There was a problem hiding this comment.
🔵 minor — The dashboard heatmap editor still builds its own copy of the { output: 'duration', factor: 0.001 } literal
In applyHeatmapDefaults (packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx:164), replace the inline { output: 'duration', factor: 0.001 } with DURATION_HEATMAP_NUMBER_FORMAT. That function is the other duration heatmap, and it gets its value from getDurationMsExpression (lines 696 and 735), so after this PR the pairing lives in two places. While there: the Heatmap display-type switch at line 701 also passes fallbackValue, an arbitrary non-ms expression, into applyHeatmapDefaults. That path still gets the 0.001 factor, which the new doc comment says is wrong. Apply the format only when the value came from getDurationMsExpression, as DBSearchHeatmapChart does.
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
There was a problem hiding this comment.
Leaving both here. EditTimeChartForm.tsx is outside this PR's files and routing it through the constant is the kind of extra call site this change should not reach for; the fallbackValue path applying the ms factor to a non-ms expression is a real bug but it predates this PR, which only moves an existing literal. Worth its own change.
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
E2E Test Results✅ All tests passed • 382 passed • 1 skipped • 1103s
Tests ran across 4 shards in parallel. |
Summary
The significant-fields heatmap builds its number format inline as
{ output: 'duration', factor: 0.001 }. That0.001is not arbitrary: it is the milliseconds-to-seconds step the formatter needs, and it is only correct because the value expression came fromgetDurationMsExpression, which applies the source'sdurationPrecisionand normalizes to milliseconds.That pairing is worth naming, so this moves the literal to
DURATION_HEATMAP_NUMBER_FORMATinsource.ts, next to the expression helper it belongs with, and documents the coupling. The next duration heatmap then gets the unit right by importing it instead of copying a bare factor.No behavior change: same object, same value.
Test plan
tsc --noEmitandeslintwith no new warnings.Independent of the rest of this series and targets
maindirectly, so it can land in any order.No UI or layout change. [ui-check: allow]
Notes