feat(ACI): Make rule stats and group history endpoints backwards compatible#110282
feat(ACI): Make rule stats and group history endpoints backwards compatible#110282
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| group=self.group, | ||
| date_added=before_now(hours=i + 1), | ||
| event_id=f"workflow2_event_{i}", | ||
| ) |
There was a problem hiding this comment.
Test never persists workflow2 records to database
Medium Severity
The workflow2 entries are created using the bare WorkflowFireHistory(...) constructor instead of WorkflowFireHistory.objects.create(...), so they're never persisted to the database. The comment says "make a couple in a different workflow to ensure we're not mixing them up," but since nothing is saved, the subsequent filter(workflow=workflow2) query returns an empty queryset and the update loop is a no-op. This test can't actually catch a query that accidentally includes other workflows' data.


Update the
ProjectRuleStatsIndexEndpointandProjectRuleGroupHistoryIndexEndpointto accept a workflow ID. Thankfully we already had the functions they call updated to use workflows so this wasn't too large of a change.