Skip to content

Conversation

@pulpdrew
Copy link
Contributor

@pulpdrew pulpdrew commented Nov 7, 2025

This PR extracts a couple of functions out of the excessively long processAlert function, to improve readability.

This is also intended to simplify HDX-2568, which will be able to re-use some of these functions.

@changeset-bot
Copy link

changeset-bot bot commented Nov 7, 2025

⚠️ No Changeset found

Latest commit: 369d031

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Nov 7, 2025

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

Project Deployment Preview Comments Updated (UTC)
hyperdx-v2-oss-app Ready Ready Preview Comment Nov 10, 2025 3:41pm

@claude
Copy link

claude bot commented Nov 7, 2025

Code Review

Overall: Clean refactoring, no critical issues found

This PR successfully extracts helper functions from the overly long processAlert function, improving readability and maintainability. The refactoring follows good practices and maintains the original logic.

Minor observations (non-blocking):

  • Type narrowing inconsistency: Line 380 passes !!hasGroupBy to shouldSkipAlertCheck, but the function parameter is typed as boolean and hasGroupBy is already boolean (line 377). Consider passing hasGroupBy directly for consistency.

  • parseAlertData parseInt behavior: Line 356 uses parseInt(v) which can silently fail or produce NaN for invalid numeric strings. Consider parseInt(v, 10) for explicit base-10 parsing or Number(v) with validation.

  • Missing alertId in error log: Line 507 logs "Failed to get response metadata" but could benefit from including checksData or meta in the log context for debugging (similar to line 335).

These are minor quality improvements and don't block the merge. The refactoring achieves its goal of improving code organization.

Status: ✅ Approved for merge

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

E2E Test Results

All tests passed • 38 passed • 3 skipped • 323s

Status Count
✅ Passed 38
❌ Failed 0
⚠️ Flaky 1
⏭️ Skipped 3

View full report →

@pulpdrew pulpdrew requested a review from wrn14897 November 7, 2025 19:43
group: string;
startTime?: Date;
}) => {
logger.info(
Copy link
Member

Choose a reason for hiding this comment

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

nice!

Copy link
Member

@wrn14897 wrn14897 left a comment

Choose a reason for hiding this comment

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

lgtm

@kodiakhq kodiakhq bot merged commit b33db76 into main Nov 10, 2025
9 checks passed
@kodiakhq kodiakhq bot deleted the drew/refactor-process-alerts branch November 10, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants