feat: add actor interface#4255
Conversation
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Pull request overview
Adds an “actor” interface to stewardship activity logging so each activity row can persist a snapshot of the acting user’s profile (username/displayName/avatarUrl) and activity read endpoints can return a nested actor object rather than only actorUserId.
Changes:
- Database migration adds
actor_username,actor_display_name,actor_avatar_urltostewardship_activity. - Data-access-layer updates stewardship write paths to persist actor snapshot fields and updates activity read paths to return a nested
actorobject. - Public API write handlers now require
actorin the request body and validateactor.userIdagainst the authenticated user id; some handlers/feeds now include the nestedactorin responses.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| services/libs/data-access-layer/src/osspckgs/stewardships.ts | Persists actor snapshot fields on activity inserts; maps activity reads to nested actor; adjusts my-packages translation behavior. |
| services/libs/data-access-layer/src/osspckgs/api.ts | Adds buildHealthBandCondition helper and reuses it from stewardship queries. |
| backend/src/osspckgs/migrations/V1781700000__stewardship-activity-actor-display.sql | Adds nullable actor snapshot columns to stewardship_activity. |
| backend/src/api/public/v1/stewardships/updateStatus.ts | Requires actor input, validates against JWT actor id, forwards snapshot fields to DAL. |
| backend/src/api/public/v1/stewardships/openStewardship.ts | Requires actor input, validates against JWT actor id, forwards snapshot fields to DAL. |
| backend/src/api/public/v1/stewardships/openapi.yaml | Introduces ActorInput/ActivityActor schemas and updates action request bodies (but currently has contract mismatches noted in comments). |
| backend/src/api/public/v1/stewardships/getMyPackages.ts | Uses DAL-provided lastActivityDescription (removes double-translation). |
| backend/src/api/public/v1/stewardships/getMyActivity.ts | Adds actor to response items. |
| backend/src/api/public/v1/stewardships/escalate.ts | Requires actor input, validates against JWT actor id, forwards snapshot fields to DAL. |
| backend/src/api/public/v1/stewardships/assignSteward.ts | Requires actor input, validates against JWT actor id, forwards snapshot fields to DAL. |
| backend/src/api/public/v1/stewardships/actorSchema.ts | Extracts shared actorInputSchema for request validation. |
| backend/src/api/public/v1/ossprey/activityFeed.ts | Returns nested actor in activity feed response items. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 938ad46. Configure here.

Summary
Stores a snapshot of the acting user's profile on every stewardship activity log entry. Every write action now accepts an actor object in the request body; the server validates it, persists username, display_name, and avatar_url alongside the existing actor_user_id, and returns a nested actor object on all activity fetch endpoints.
Changes
Type of change
Note
Medium Risk
Breaking request/response shapes and documented route/method changes for stewardship clients; core auth still comes from the JWT while new profile fields are client-supplied snapshots on the activity log.
Overview
Stewardship activity responses no longer expose flat
actorUserId(and the placeholderactorName); they return a nestedactorobject (userId,username,displayName,avatarUrl) built from new snapshot columns onstewardship_activity.Write APIs now require an
actorobject in the JSON body (sharedactorInputSchema: optional username, display name, avatar URL). Handlers still record the authenticated user viareq.actor.idasactor_user_idand pass the optional display fields into the DAL. Assign steward reshapes the body: steward fields move understeward, withactorseparate. OpenAPI documentsActivityActor/ActorInput, updates server base paths to include/akrites, and adjusts routes/methods (e.g. open →POST /stewardships/open, assign →POST …/assign, status →PATCH …/status).The DAL migration adds nullable
actor_username,actor_display_name, andactor_avatar_url; all stewardship mutations that insert activity rows persist them. My packages exposeslastActivityDescriptionfrom the DAL (singletranslateActivityContentpass) instead of translating again in the handler.Small refactor:
buildHealthBandConditioncentralizes health-band SQL used bylistMyPackages.Reviewed by Cursor Bugbot for commit 938ad46. Bugbot is set up for automated code reviews on this repo. Configure here.