Skip to content

chore(ACI): Add back subscription processor crash rate detector test coverage - #105205

Merged
ceorourke merged 2 commits into
masterfrom
ceorourke/cra-test-subscription-processor
Jan 6, 2026
Merged

ceorourke merged 2 commits into
masterfrom
ceorourke/cra-test-subscription-processor

Conversation

@ceorourke

Copy link
Copy Markdown
Contributor

Companion PR to #105113 that adds back the crash rate alert tests and updates them with ACI models. I removed a couple that have to do with resolve thresholds higher than 1 since we don't actually let users set those, but everything else remains.


# update the detector to be dynamic
detector = self.crash_rate_detector
detector.update(config={"detection_type": "dynamic", "comparison_delta": None})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Config dict replaced instead of merged

The call detector.update(config={"detection_type": "dynamic", "comparison_delta": None}) replaces the entire config dict rather than merging into it. This differs from the pattern used elsewhere in this file at lines 125 and 136, which correctly use detector.config.update({...}) to preserve existing config values. Since update() sets attributes directly via setattr, any other config values set during detector creation will be lost.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that's fine

@codecov

codecov Bot commented Dec 18, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #105205   +/-   ##
========================================
  Coverage   80.56%    80.57%           
========================================
  Files        9443      9443           
  Lines      404671    404705   +34     
  Branches    25723     25723           
========================================
+ Hits       326013    326079   +66     
+ Misses      78226     78194   -32     
  Partials      432       432           

ceorourke added a commit that referenced this pull request Dec 19, 2025
}

mock_seer_request.return_value = HTTPResponse(orjson.dumps(seer_return_value), status=200)
update_value = (1 - 0 / 100) + 0.05

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Dynamic detector test uses invalid crash rate values

The dynamic detector test uses (1 - 0 / 100) instead of (1 - self.critical_threshold / 100) or (1 - self.warning_threshold / 100) like the equivalent non-dynamic test. This produces values of 1.05 and 0.95, representing impossible crash rates (105% and 95%). The test passes only because Seer's response is mocked, but the test data doesn't represent valid crash rate scenarios. This appears to be a copy-paste error where placeholder 0 values weren't replaced with the threshold properties.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems valid, up to you if you want to change it

@mifu67
mifu67 self-requested a review January 5, 2026 22:34
}

mock_seer_request.return_value = HTTPResponse(orjson.dumps(seer_return_value), status=200)
update_value = (1 - 0 / 100) + 0.05

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems valid, up to you if you want to change it

"anomaly_type": AnomalyType.HIGH_CONFIDENCE.value,
},
"timestamp": 1,
"value": 10,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should value here correspond to update_value for test clarity?

@ceorourke
ceorourke force-pushed the ceorourke/cra-test-subscription-processor branch from 866a1d4 to 981e92a Compare January 6, 2026 18:08
@ceorourke
ceorourke merged commit 0faccde into master Jan 6, 2026
62 checks passed
@ceorourke
ceorourke deleted the ceorourke/cra-test-subscription-processor branch January 6, 2026 18:45
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 22, 2026

This branch was successfully deployed

1 active deployment
Preview — 981e92a1 Deployed Jan 6, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants