Activity bounded context: /api/latest/fleet/activities (2 of 2) - #38478
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #38478 +/- ##
==========================================
- Coverage 66.08% 66.05% -0.03%
==========================================
Files 2413 2409 -4
Lines 192673 192475 -198
Branches 8526 8459 -67
==========================================
- Hits 127329 127143 -186
+ Misses 53779 53770 -9
+ Partials 11565 11562 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…actor activity streaming to use ListActivities service with system-based authorization. Improve test coverage for cron activities.
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
WalkthroughReplaces legacy datastore activity listing with the new activity bounded-context service across server and cron code, adds a system-level context for cron automation, removes legacy ListActivities API/types, and updates tests and test helpers to use the activity_api ListActivities service and types. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@server/service/integration_core_test.go`:
- Around line 3313-3318: The test relies on s.listActivities() returning a
complete, deterministically ordered set but that helper may be paginated or
unordered; update the test or the helper so the count-based assertions are
stable: either (a) modify listActivities() to explicitly fetch all activities
(no pagination) and return them sorted by timestamp/ID (e.g., newest-first) so
len(s.listActivities()) is deterministic, or (b) change the test to query the
datastore directly for the total activity count or to call the datastore method
used by NewActivity (e.g., s.ds.ListActivities or similar) with explicit
per_page and sort parameters to ensure the newly created activity is included;
reference s.listActivities, s.ds.NewActivity and any
ListActivities/ListActivitiesOptions functions to locate where to add explicit
pagination/sorting or to change the test to a direct datastore query.
♻️ Duplicate comments (2)
server/service/integration_core_test.go (2)
8031-8053: SamelistActivities()pagination/ordering sensitivity as above.
8184-8212: SamelistActivities()pagination/ordering sensitivity as above.
iansltx
left a comment
There was a problem hiding this comment.
Seems like there's still a fair amount of activities tendrils in the main modules here, particularly for testing, but this is at least a step in a decoupled direction. Feedback here is minor.
JordanMontgomery
left a comment
There was a problem hiding this comment.
PR Looks good to me. The only questions I had were around the activities cron which seemingly makes use of the new service + old DS methods but it looks like the work to finish that is captured in your tickets so I am not concerned
Yes, moving the cron is the next story: #38534 |
|
@lucasmrod does not have time to review this right now due to critical speccing work, but he agreed to review this when he has time. He's OK merging this now, so as not to block follow-up work. |
Related issue: Resolves #37806
Removed
ds.ListActivitiesfrom the legacy datastore and updated code/tests to use the new activity bounded context instead.The changes to
cron.goand most changes tomysql/activities_test.gowill eventually be migrated to the activity bounded context. The current changes are an intermediate step.The issues tracked by #38234 will be addressed in additional/parallel PRs shortly.
Checklist for submitter
changes/,orbit/changes/oree/fleetd-chrome/changes.Testing
Summary by CodeRabbit
Refactor
Tests
✏️ Tip: You can customize this high-level summary in your review settings.