Skip to content

Add Salesforce project and foundation ids to My CLAs rows - #5158

Merged
lukaszgryglicki merged 1 commit into
devfrom
feat/GH-1575-console-sfids
Aug 25, 2026
Merged

Add Salesforce project and foundation ids to My CLAs rows#5158
lukaszgryglicki merged 1 commit into
devfrom
feat/GH-1575-console-sfids

Conversation

@ahmedomosanya

Copy link
Copy Markdown
Contributor

What

GET /v4/my-clas now returns two optional fields on each row: projectSFID and foundationSFID.

Why

The endpoint already resolves the Salesforce ids of a CLA Group's projects_cla_groups mapping in
order to fetch projectName and projectLogo, then throws them away. Consumers are left with no way
to 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:

Mapping shape foundationSFID projectSFID Console route
Foundation-level (marker row where project_sfid == foundation_sfid) set omitted /foundation/{foundationSFID}/cla
Single project-level mapping set set /foundation/{foundationSFID}/project/{projectSFID}/cla
Several project-level mappings, no foundation marker omitted omitted none — unresolved

A foundation-level group deliberately omits projectSFID rather than echoing the foundation id into
both, so a consumer can tell "foundation" apart from "project under a foundation" without comparing
ids. This matches emails.CLAProjectParams.GetProjectFullURL, which ignores ProjectSFID entirely
on its foundation branch. The unresolved case matches how projectName and projectLogo already
behave.

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.goprojectInfo retains the ids it already computed; GetMyClas copies
    them onto models.MyCla. The local driving the project-service lookup is renamed projectSFID
    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.

Testing

Swagger regenerated, then make fmt, make build-mac, make test, and make lint all pass
locally (lint includes ./check-headers.sh across 3132 files).

TestGetMyClasProjectNameAndLogo covers all three mapping shapes above.
TestGetMyClasProjectLookupDegradesGracefully now asserts both ids survive a project-service
outage, which proves they are mapping-derived rather than project-service-derived.

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>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0d4bc6ce-7185-4133-8205-4079abe21828

📥 Commits

Reviewing files that changed from the base of the PR and between 3436723 and 71e8c42.

📒 Files selected for processing (4)
  • cla-backend-go/swagger/common/my-cla.yaml
  • cla-backend-go/v2/my_clas/service.go
  • cla-backend-go/v2/my_clas/service_test.go
  • docs/MY_CLAS_API.md

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

The My CLA API now returns optional project and foundation Salesforce IDs. Resolution preserves mapping identifiers across supported cases, and documentation defines Corporate Console and Self Serve routing behavior.

Changes

My CLA Salesforce identifiers

Layer / File(s) Summary
Response contract and identifier propagation
cla-backend-go/swagger/common/my-cla.yaml, cla-backend-go/v2/my_clas/service.go
The schema and CLA response now include optional projectSFID and foundationSFID fields.
Mapping resolution and validation
cla-backend-go/v2/my_clas/service.go, cla-backend-go/v2/my_clas/service_test.go
Resolution retains foundation and project identifiers for supported mappings. Ambiguous multi-project mappings remain empty. Tests cover lookup misses and identifier presence.
API and Self Serve routing documentation
docs/MY_CLAS_API.md
The documentation defines identifier omission rules, Corporate Console routes, Self Serve mapping, and company-dashboard fallback behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 71e8c

The change adds optional Salesforce identifiers while preserving existing responses and documents the supported mapping behavior; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant GetMyClas
  participant MappingTable
  participant ProjectService
  GetMyClas->>MappingTable: read foundation and project SFIDs
  GetMyClas->>ProjectService: resolve selected lookupSFID
  ProjectService-->>GetMyClas: return project metadata or miss
  GetMyClas-->>GetMyClas: populate projectSFID and foundationSFID
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding Salesforce project and foundation IDs to My CLAs rows.
Description check ✅ Passed The description directly explains the new API fields, their mapping rules, compatibility behavior, implementation changes, and test coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/GH-1575-console-sfids

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Salesforce project and foundation identifiers to /v4/my-clas rows for Corporate CLA Console deep links.

Changes:

  • Extends the Swagger contract and API documentation.
  • Populates IDs according to project-, foundation-, and unresolved-mapping rules.
  • Adds unit coverage for mapping shapes and lookup degradation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
docs/MY_CLAS_API.md Documents fields and consumer 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 resolution behavior.
cla-backend-go/swagger/common/my-cla.yaml Defines the optional response fields.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@lukaszgryglicki lukaszgryglicki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm - but please also create a mirrored PR based on main instead of dev - this would be for prod deployment.

@lukaszgryglicki
lukaszgryglicki merged commit e36a074 into dev Aug 25, 2026
10 checks passed
@lukaszgryglicki
lukaszgryglicki deleted the feat/GH-1575-console-sfids branch August 25, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants