Skip to content

feat: show registered anomalies as dashed segments on download charts#1744

Merged
graphieros merged 3 commits intonpmx-dev:mainfrom
graphieros:main
Feb 28, 2026
Merged

feat: show registered anomalies as dashed segments on download charts#1744
graphieros merged 3 commits intonpmx-dev:mainfrom
graphieros:main

Conversation

@graphieros
Copy link
Contributor

Follow up to #1636

  • When a package has registered anomalies (e.j. vite), and when the data correction is applied, shows corrections as dashed segments on the trends charts
Without correction With correction
image image
  • This is also applied on the chart of the compare page
  • The estimation legend item is also displayed in this case

@vercel
Copy link

vercel bot commented Feb 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 28, 2026 2:34pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 28, 2026 2:34pm
npmx-lunaria Ignored Ignored Feb 28, 2026 2:34pm

Request Review

@codecov
Copy link

codecov bot commented Feb 28, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/components/Package/TrendsChart.vue 0.00% 5 Missing and 4 partials ⚠️
app/utils/download-anomalies.ts 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

📝 Walkthrough

Walkthrough

This PR threads anomaly metadata through the charting stack. It adds optional hasAnomaly to point types (Daily/Weekly) and introduces exported MonthlyDataPoint and YearlyDataPoint with hasAnomaly. download-anomalies.ts marks interpolated points with hasAnomaly. TrendsChart.vue now extracts per-point hasAnomaly, computes dashIndices per dataset item, preserves dashIndices in normalisedDataset, and adds a hasDownloadAnomalies computed used by legend and overlay rendering. Several function signatures and dataset item shapes were extended accordingly.

Possibly related PRs

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly relates to the changeset, describing the implementation of anomaly visualization as dashed segments on trends charts, with supporting before/after screenshots.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/components/Package/TrendsChart.vue (1)

394-396: Return a strict boolean from hasDownloadAnomalies.

This computed can currently resolve to undefined; coercing to false avoids tri-state behaviour in conditions.

Proposed tweak
-const hasDownloadAnomalies = computed(() =>
-  normalisedDataset.value?.some(datapoint => !!datapoint.dashIndices.length),
-)
+const hasDownloadAnomalies = computed(
+  () => !!normalisedDataset.value?.some(datapoint => datapoint.dashIndices.length > 0),
+)
As per coding guidelines "Ensure you write strictly type-safe code, for example by ensuring you always check when accessing an array value by index".

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 433494c and 5d13e29.

📒 Files selected for processing (3)
  • app/components/Package/TrendsChart.vue
  • app/types/chart.ts
  • app/utils/download-anomalies.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/components/Package/TrendsChart.vue (1)

393-396: Consider using a more explicit length check.

The current !!datapoint.dashIndices.length works, but .length > 0 is more explicit and reads more naturally.

♻️ Optional: More explicit check
 const hasDownloadAnomalies = computed(() =>
-  normalisedDataset.value?.some(datapoint => !!datapoint.dashIndices.length),
+  normalisedDataset.value?.some(datapoint => datapoint.dashIndices.length > 0),
 )

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d13e29 and c21fd8b.

📒 Files selected for processing (1)
  • app/components/Package/TrendsChart.vue

@graphieros graphieros added this pull request to the merge queue Feb 28, 2026
@alexdln
Copy link
Member

alexdln commented Feb 28, 2026

I really love this change 🔥

Merged via the queue into npmx-dev:main with commit e5ccbff Feb 28, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants