Converted old activity module into function. Cleaned up activity types.#40752
Converted old activity module into function. Cleaned up activity types.#40752
Conversation
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
WalkthroughThe PR completes the activity bounded context migration by removing the legacy Possibly related PRs
🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
server/mdm/android/service/enterprises_test.go (1)
31-32: Optional cleanup: inlinenoopNewActivityat callsites.
newActivity := noopNewActivityis repeated and can be passed directly toNewServiceWithClientfor less test noise.Also applies to: 129-132, 249-250, 269-270, 315-316, 364-365, 405-406, 446-447, 513-514, 543-544
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@server/mdm/android/service/enterprises_test.go` around lines 31 - 32, The test repeats the trivial assignment newActivity := noopNewActivity before calling NewServiceWithClient, creating noise; remove the local newActivity variable and pass noopNewActivity directly as the argument to NewServiceWithClient (e.g., replace newActivity usage with noopNewActivity in each NewServiceWithClient call), and delete the now-unused newActivity declarations so noopNewActivity is inlined at all call sites (references: noopNewActivity, NewServiceWithClient).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@server/service/testing_utils.go`:
- Line 438: TestServerOpts.NewActivity (type NewActivityFunc) was added but
never used when constructing the test service, so setting it has no effect;
update the test service creation to pass TestServerOpts.NewActivity into the
service/activity initialization path — locate where TestServerOpts is consumed
(e.g., in NewTestServer or the test service builder), and if present use the
NewActivityFunc to replace the default activity factory by wiring it into the
code that constructs fleet.NewActivity (or the field NewActivity) so tests that
set TestServerOpts.NewActivity actually get the provided function.
---
Nitpick comments:
In `@server/mdm/android/service/enterprises_test.go`:
- Around line 31-32: The test repeats the trivial assignment newActivity :=
noopNewActivity before calling NewServiceWithClient, creating noise; remove the
local newActivity variable and pass noopNewActivity directly as the argument to
NewServiceWithClient (e.g., replace newActivity usage with noopNewActivity in
each NewServiceWithClient call), and delete the now-unused newActivity
declarations so noopNewActivity is inlined at all call sites (references:
noopNewActivity, NewServiceWithClient).
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (17)
cmd/fleet/serve.goee/server/scim/scim.goee/server/scim/users.goee/server/scim/users_test.goserver/fleet/activities.goserver/mdm/android/arch_test.goserver/mdm/android/service/enterprises_test.goserver/mdm/android/service/pubsub.goserver/mdm/android/service/pubsub_test.goserver/mdm/android/service/service.goserver/mdm/android/tests/testing_utils.goserver/service/activities.goserver/service/integration_mdm_test.goserver/service/integrationtest/android/suite.goserver/service/modules/activities/activities.goserver/service/testing_client.goserver/service/testing_utils.go
💤 Files with no reviewable changes (2)
- server/mdm/android/arch_test.go
- server/service/modules/activities/activities.go
There was a problem hiding this comment.
Pull request overview
This PR continues the activity bounded-context migration by removing the legacy ActivityModule facade and standardizing activity creation around a fleet.NewActivityFunc, while also consolidating activity types by aliasing fleet.Activity/fleet.ActivityDetails to the canonical server/activity/api types.
Changes:
- Remove the
server/service/modules/activitiesmodule and replace usage withfleet.NewActivityFuncinjections. - Alias legacy activity domain types (
fleet.Activity,fleet.ActivityDetails) toserver/activity/apito reduce duplication and clarify ownership. - Update Android MDM and SCIM codepaths/tests to pass and use the new activity creation function.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| server/service/testing_utils.go | Removes ActivityModule wiring from test server options and related setup; adds NewActivity opt (currently unused). |
| server/service/testing_client.go | Restores listActivitiesResponse type in the test client helpers after removal from service code. |
| server/service/modules/activities/activities.go | Deletes the legacy activity module facade. |
| server/service/integrationtest/android/suite.go | Updates Android integration suite to pass fleetSvc.NewActivity directly instead of an activity module. |
| server/service/integration_mdm_test.go | Updates Android service setup in integration tests to use a NewActivity function instead of a module. |
| server/service/activities.go | Switches Service.NewActivity to accept the canonical activity_api.ActivityDetails and removes now-unneeded response type definition. |
| server/mdm/android/tests/testing_utils.go | Replaces test ActivityModule no-op with a noopNewActivity function. |
| server/mdm/android/service/service.go | Updates Android service constructors and internals to store/call fleet.NewActivityFunc instead of ActivityModule. |
| server/mdm/android/service/pubsub_test.go | Updates Android pubsub tests to pass noopNewActivity. |
| server/mdm/android/service/pubsub.go | Replaces activity module calls with the injected newActivity function. |
| server/mdm/android/service/enterprises_test.go | Updates enterprise tests to pass noopNewActivity and removes the module type. |
| server/mdm/android/arch_test.go | Removes now-deleted server/service/modules/activities from allowed dependencies. |
| server/fleet/activities.go | Aliases fleet.Activity and fleet.ActivityDetails to server/activity/api canonical types. |
| ee/server/scim/users_test.go | Updates SCIM handler tests to provide svc.NewActivity function. |
| ee/server/scim/users.go | Updates SCIM user handler to depend on fleet.NewActivityFunc instead of ActivityModule. |
| ee/server/scim/scim.go | Updates SCIM registration to pass svc.NewActivity into the handler. |
| cmd/fleet/serve.go | Removes activity module bootstrap and passes an activity function into Android service initialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #40752 +/- ##
==========================================
- Coverage 66.30% 66.30% -0.01%
==========================================
Files 2470 2469 -1
Lines 197754 197714 -40
Branches 8668 8661 -7
==========================================
- Hits 131125 131090 -35
+ Misses 54766 54760 -6
- Partials 11863 11864 +1
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:
|
…-cleanup2 # Conflicts: # server/mdm/android/service/enterprises_test.go # server/mdm/android/tests/testing_utils.go # server/service/integration_mdm_test.go # server/service/integrationtest/android/suite.go
Related issue: Resolves #38536
Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.Testing
Summary by CodeRabbit