Add Salesforce project and foundation ids to My CLAs rows (prod) - #5159
Conversation
GET /v4/my-clas already resolves the Salesforce ids of a CLA Group's projects_cla_groups mapping in order to fetch the project name and logo, then discards them. Consumers are left with no way to address the CLA Group in the LFX Corporate CLA Console. Keep those ids and emit them as optional projectSFID and foundationSFID. A foundation-level CLA Group - the marker mapping where project_sfid equals foundation_sfid - sends only foundationSFID; a single project-level mapping sends both; a multi-project group with no foundation marker sends neither, matching how projectName and projectLogo already behave. Presence is the discriminator, so consumers branch on which ids arrived rather than concatenating them. Consumer: linuxfoundation/lfx-self-serve#1575 Signed-off-by: ahmedomosany <aopeyemi@contractor.linuxfoundation.org> (cherry picked from commit 71e8c42)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
There was a problem hiding this comment.
Pull request overview
Adds Salesforce project and foundation IDs to /v4/my-clas rows for Corporate CLA Console routing.
Changes:
- Extends the Swagger response contract with optional SFID fields.
- Propagates mapping-derived IDs through the service.
- Adds mapping-shape tests and consumer documentation.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
docs/MY_CLAS_API.md |
Documents fields and console routing. |
cla-backend-go/v2/my_clas/service.go |
Resolves and returns Salesforce IDs. |
cla-backend-go/v2/my_clas/service_test.go |
Tests ID behavior across mapping shapes. |
cla-backend-go/swagger/common/my-cla.yaml |
Defines the new response fields. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Promotes #5158 to PROD.
What
GET /v4/my-clasnow returns two optional fields on each row:projectSFIDandfoundationSFID.Why
The endpoint already resolves the Salesforce ids of a CLA Group's
projects_cla_groupsmapping inorder to fetch
projectNameandprojectLogo, then throws them away. Consumers are left with no wayto address the CLA Group in the LFX Corporate CLA Console.
The immediate consumer is LFX Self Serve's My CLAs page, which is adding a "Manage in CCLA Console"
link for CLA managers — linuxfoundation/lfx-self-serve#1575.
Contract
Presence is the discriminator. Consumers branch on which ids arrived rather than concatenating them:
foundationSFIDprojectSFIDproject_sfid == foundation_sfid)/foundation/{foundationSFID}/cla/foundation/{foundationSFID}/project/{projectSFID}/claA foundation-level group deliberately omits
projectSFIDrather than echoing the foundation id intoboth, so a consumer can tell "foundation" apart from "project under a foundation" without comparing
ids. This matches
emails.CLAProjectParams.GetProjectFullURL, which ignoresProjectSFIDentirelyon its foundation branch. The unresolved case matches how
projectNameandprojectLogoalreadybehave.
Both fields marshal with
omitempty, so existing clients see no change.Changes
swagger/common/my-cla.yaml— declares both fields, with the branching rule in the description.v2/my_clas/service.go—projectInforetains the ids it already computed;GetMyClascopiesthem onto
models.MyCla. The local driving the project-service lookup is renamedprojectSFID→lookupSFID, since it can hold a foundation id; its log field key follows.docs/MY_CLAS_API.md— sample body, field reference, and the Self Serve mapping section.The four changed files are byte-identical to
dev(merged in #5158), wheremake fmt,make build-mac,make test, andmake lintpassed. Cherry-picked asecc6d7df7from71e8c4268../v2/my_clastests re-ran clean on this branch.Note:
mainCI does not run build/test/lint, andmake swaggerregeneratesmodels.MyCla.{ProjectSFID,FoundationSFID}at deploy time from the editedmy-cla.yaml.