-
Notifications
You must be signed in to change notification settings - Fork 51.4k
fix: Show correct date range in insight overview #22251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Show correct date range in insight overview #22251
Conversation
|
E2E Tests: n8n tests passed after 9m 26.6s Run Details
Groups
This message was posted automatically by
currents.dev | Integration Settings
|
BundleMonUnchanged files (2)
No change in files bundle size Groups updated (2)
Final result: ✅ View report in BundleMon website ➡️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 issues found across 5 files
Prompt for AI agents (all 5 issues)
Understand the root cause of the following 5 issues and fix them.
<file name="packages/frontend/editor-ui/src/features/execution/insights/insights.utils.ts">
<violation number="1" location="packages/frontend/editor-ui/src/features/execution/insights/insights.utils.ts:103">
Formatting the selected range by calling `dateformat` on the ISO string causes off‑by‑one‑day displays for users west of UTC. Convert the `DateValue` to a local `Date` (e.g., `start.toDate(getLocalTimeZone())`) before formatting so the displayed day matches the picker.</violation>
<violation number="2" location="packages/frontend/editor-ui/src/features/execution/insights/insights.utils.ts:124">
Rule violated: **Prefer Typeguards over Type casting**
Avoid type assertions for narrowing here. Replace the `as Array<[InsightsDateRange['key'], number]>` cast with a type-safe alternative (e.g., iterate with a type guard over Object.entries or introduce a helper that returns typed key/value tuples) so the preset detection logic doesn’t rely on unsafe casting.</violation>
</file>
<file name="packages/frontend/editor-ui/src/features/execution/insights/insights.utils.test.ts">
<violation number="1" location="packages/frontend/editor-ui/src/features/execution/insights/insights.utils.test.ts:271">
The “custom range” test becomes time-dependent because the dynamic end date occasionally matches a preset range, causing intermittent failures. Use an end date captured in a variable and subtract a non-preset number of days for the start so the assertion stays deterministic.</violation>
</file>
<file name="packages/frontend/editor-ui/src/features/execution/insights/components/InsightsSummary.vue">
<violation number="1" location="packages/frontend/editor-ui/src/features/execution/insights/components/InsightsSummary.vue:21">
Move the newly added `DateValue` import above the constant declarations so that all imports remain at the top of the module; otherwise the file fails linting/compilation because imports must precede other statements.</violation>
<violation number="2" location="packages/frontend/editor-ui/src/features/execution/insights/components/InsightsSummary.vue:55">
Rule violated: **Tests**
The new `displayDateRangeLabel` path was added without any unit/UI test rendering InsightsSummary with custom `startDate`/`endDate`, even though the Community PR Guidelines require UI changes to ship with tests. According to linked Linear issue PAY-4148, the overview cards must display the selected range—please add a regression test that covers a non-preset date range so this bug cannot return.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
packages/frontend/editor-ui/src/features/execution/insights/insights.utils.ts
Outdated
Show resolved
Hide resolved
packages/frontend/editor-ui/src/features/execution/insights/insights.utils.test.ts
Show resolved
Hide resolved
packages/frontend/editor-ui/src/features/execution/insights/components/InsightsSummary.vue
Outdated
Show resolved
Hide resolved
packages/frontend/editor-ui/src/features/execution/insights/components/InsightsSummary.vue
Show resolved
Hide resolved
packages/frontend/editor-ui/src/features/execution/insights/insights.utils.ts
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
guillaumejacquart
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me :)
Summary
Re-use the same display format between the
InsightsDataRangePickerand theInsightsSummarycomponentRelated Linear tickets, Github issues, and Community forum posts
Resolves PAY-4148
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported)