Repository navigation
Add MyCLAs/DownloadCLAPDF API(s) in EasyCLA - #5125
Conversation
Signed-off-by: Łukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds authenticated v2 My CLAs endpoints for listing signed ICLAs/ECLAs and retrieving signed ICLA PDF URLs. The implementation resolves and authorizes identities, queries signatures and users, evaluates validity, exposes OpenAPI schemas, registers routes, and adds service tests. ChangesMy CLAs v2 API
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant MyClasHandlers
participant my_clasService
participant user_serviceClient
participant DynamoDB
participant SignaturesService
participant S3
Client->>MyClasHandlers: authenticated My CLAs request
MyClasHandlers->>my_clasService: GetMyClas or GetMyClaPdfURL
my_clasService->>user_serviceClient: resolve platform identities
my_clasService->>DynamoDB: resolve users and query signatures
my_clasService->>SignaturesService: evaluate current CCLA approval
my_clasService->>S3: generate presigned ICLA PDF URL
my_clasService-->>MyClasHandlers: CLA list or PDF response
MyClasHandlers-->>Client: HTTP response
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds authenticated v4 APIs for listing a contributor’s ICLAs/ECLAs and downloading signed ICLA PDFs.
Changes:
- Adds identity resolution, ownership checks, and CLA validity evaluation.
- Adds PDF download-link generation and user-service identity lookup.
- Defines Swagger contracts, tests, documentation, and server wiring.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
MY_CLAS_API.md |
Documents behavior, security, rollout, and limitations. |
cla-backend-go/v2/user-service/client.go |
Adds connected-identity retrieval. |
cla-backend-go/v2/my_clas/service.go |
Implements identity resolution and CLA processing. |
cla-backend-go/v2/my_clas/service_test.go |
Tests service behavior and authorization. |
cla-backend-go/v2/my_clas/repository.go |
Queries user ICLA/ECLA records. |
cla-backend-go/v2/my_clas/handlers.go |
Implements HTTP handlers. |
cla-backend-go/swagger/common/my-cla.yaml |
Defines CLA response rows. |
cla-backend-go/swagger/common/my-cla-pdf.yaml |
Defines PDF-link responses. |
cla-backend-go/swagger/common/my-cla-list.yaml |
Defines CLA-list responses. |
cla-backend-go/swagger/cla.v2.yaml |
Adds endpoints and identity parameters. |
cla-backend-go/cmd/server.go |
Registers the module. |
Comments suppressed due to low confidence (3)
cla-backend-go/v2/my_clas/service.go:384
- A platform username proves who owns that username now, but GitHub/GitLab usernames can be renamed and recycled. Authorizing a username-only GSI lookup can therefore resolve a prior holder's EasyCLA record and expose its CLA history and PDFs. Do not authorize username-only historical records without corroborating them with a stable provider ID or another non-reusable account link; apply the same rule to the GitLab branch below.
if (selfGithubUsername != "" && strings.EqualFold(githubUsername, selfGithubUsername)) || usernameAllowed(identitySourceGithub, githubUsername) {
allowed.GithubUsernames = append(allowed.GithubUsernames, githubUsername)
cla-backend-go/v2/my_clas/service.go:688
- All company-repository errors are converted to a missing company. A DynamoDB outage or unmarshal failure therefore marks every affected ECLA invalid instead of returning an error; the documented consumer then hides those ECLAs, producing a partial history. Only
CompanyNotFoundshould mean not covered, while operational/data errors must propagate to the handler.
companyModel, err := s.companyRepo.GetCompany(ctx, companyID)
if err != nil {
log.WithFields(logrus.Fields{
"functionName": "v2.my_clas.service.company",
utils.XREQUESTID: ctx.Value(utils.XREQUESTID),
cla-backend-go/v2/my_clas/service.go:724
- Matching arbitrary error text makes infrastructure failures look like an expected miss. For example, DynamoDB's
ResourceNotFoundExceptioncontains “not found”, so an unavailable/misnamed table can be silently skipped and return partial CLA history instead of the promised 500. Restrict not-found detection to the typed errors above.
return strings.Contains(strings.ToLower(err.Error()), "not found")
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
cla-backend-go/v2/my_clas/service_test.go (2)
104-130: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUnused error-path fixtures leave ECLA validity's failure handling untested.
fakeSignatures.userIsApprovedErr(Line 107) is checked inUserIsApproved(Lines 114-119) but is never set to a non-nil value in any test. Similarly,fakeCompanies.GetCompany's not-found branch (Lines 128-129) is never triggered, since every test populates all referenced company IDs. Both fixtures appear purpose-built for negative-path testing but are currently dead weight — consider adding a case toTestGetMyClasEclaValidity(or a new test) that setsuserIsApprovedError references a missing company ID to confirm the service surfaces or gracefully handles these external-call failures rather than panicking or silently marking records invalid/valid incorrectly.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cla-backend-go/v2/my_clas/service_test.go` around lines 104 - 130, Add negative-path coverage for TestGetMyClasEclaValidity using the existing fakeSignatures.userIsApprovedErr or a missing company ID in fakeCompanies.byID. Assert the service’s expected handling of the external error, including that it neither panics nor incorrectly marks the ECLA validity result.
189-202: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
assert.NoError/assert.NotNilfollowed by direct field dereference risks a nil-pointer panic instead of a clean failure.This pattern (assert on error/nilness, then immediately dereference
resultfields) repeats throughout the file — e.g. Lines 193-201, 243-246, 283-287, 317-320, 341-345, 362-380, 411-430, 448-452, 470-486, 507-513.assert.*records a failure but does not stop execution, so iferris ever unexpectedly non-nil (withresultnil, as would typically happen), the very next line's field access (result.UserIds,result.SignatureID, etc.) panics with a nil-pointer dereference, turning an informative assertion failure into an opaque panic/stack trace.Swap the gating checks to
require.NoError/require.NotNil(fromgithub.com/stretchr/testify/require) so the test aborts cleanly at the first failure instead of risking a panic on subsequent lines.Example fix (applies to every similar occurrence in this file)
result, err := svc.GetMyClas(context.Background(), "someone", false, &Identity{ Emails: []string{"[email protected] "}, GithubIDs: []int64{12345}, }) -assert.NoError(t, err) +require.NoError(t, err) assert.Equal(t, []string{"user-a", "user-b"}, result.UserIds)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cla-backend-go/v2/my_clas/service_test.go` around lines 189 - 202, Replace the gating assert.NoError and assert.NotNil checks in service_test.go with require.NoError and require.NotNil, importing github.com/stretchr/testify/require. Apply this to every listed GetMyClas test occurrence before dereferencing result or related values, while leaving non-gating assertions unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cla-backend-go/v2/my_clas/handlers.go`:
- Around line 27-35: Remove or defer utils.SetAuthUserProperties in both
handlers so request headers cannot overwrite token-derived authUser identity
before principal(authUser) and downstream authorization or service calls.
Preserve verified claims as the authoritative user and retain X-USERNAME/X-EMAIL
only as non-authoritative metadata when supplied by trusted ingress.
In `@cla-backend-go/v2/my_clas/repository.go`:
- Line 74: Update the DynamoDB query invocation in the repository method to use
QueryWithContext(ctx, queryInput) instead of Query(queryInput), preserving the
existing query inputs and error handling while propagating request cancellation.
---
Nitpick comments:
In `@cla-backend-go/v2/my_clas/service_test.go`:
- Around line 104-130: Add negative-path coverage for TestGetMyClasEclaValidity
using the existing fakeSignatures.userIsApprovedErr or a missing company ID in
fakeCompanies.byID. Assert the service’s expected handling of the external
error, including that it neither panics nor incorrectly marks the ECLA validity
result.
- Around line 189-202: Replace the gating assert.NoError and assert.NotNil
checks in service_test.go with require.NoError and require.NotNil, importing
github.com/stretchr/testify/require. Apply this to every listed GetMyClas test
occurrence before dereferencing result or related values, while leaving
non-gating assertions unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6ddbc3d5-3592-4404-83d5-9053fa209d66
📒 Files selected for processing (11)
MY_CLAS_API.mdcla-backend-go/cmd/server.gocla-backend-go/swagger/cla.v2.yamlcla-backend-go/swagger/common/my-cla-list.yamlcla-backend-go/swagger/common/my-cla-pdf.yamlcla-backend-go/swagger/common/my-cla.yamlcla-backend-go/v2/my_clas/handlers.gocla-backend-go/v2/my_clas/repository.gocla-backend-go/v2/my_clas/service.gocla-backend-go/v2/my_clas/service_test.gocla-backend-go/v2/user-service/client.go
Signed-off-by: Łukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cla-backend-go/v2/user-service/client.go (1)
282-308: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winPropagate context and bound the HTTP request.
ListUserIdentitiesincla-backend-go/v2/user-service/client.go:282-308builds requests without context and sends them throughhttp.DefaultClient, so a stalled user-service call can’t be canceled by the caller and has no request timeout. Threadcontext.ContextthroughPlatformUsersService, switch tohttp.NewRequestWithContext, and use a client with a finite timeout.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cla-backend-go/v2/user-service/client.go` around lines 282 - 308, The ListUserIdentities request flow lacks caller cancellation and a finite timeout. Add context.Context to ListUserIdentities and propagate it through PlatformUsersService callers, build each request with http.NewRequestWithContext, and execute it with an HTTP client configured with a finite timeout instead of http.DefaultClient.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cla-backend-go/v2/my_clas/repository.go`:
- Around line 102-106: Update the log fields in GetUsersBySecondaryEmails to
stop recording raw secondary email addresses: replace the “emails” field value
with the number of requested emails, while preserving the existing functionName
and XREQUESTID fields.
---
Outside diff comments:
In `@cla-backend-go/v2/user-service/client.go`:
- Around line 282-308: The ListUserIdentities request flow lacks caller
cancellation and a finite timeout. Add context.Context to ListUserIdentities and
propagate it through PlatformUsersService callers, build each request with
http.NewRequestWithContext, and execute it with an HTTP client configured with a
finite timeout instead of http.DefaultClient.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 58597003-5f43-4787-b12f-7faa61d8a352
📒 Files selected for processing (7)
cla-backend-go/swagger/cla.v2.yamlcla-backend-go/v2/my_clas/handlers.gocla-backend-go/v2/my_clas/repository.gocla-backend-go/v2/my_clas/service.gocla-backend-go/v2/my_clas/service_test.gocla-backend-go/v2/user-service/client.godocs/MY_CLAS_API.md
💤 Files with no reviewable changes (1)
- cla-backend-go/v2/my_clas/handlers.go
🚧 Files skipped from review as they are similar to previous changes (3)
- cla-backend-go/v2/my_clas/service_test.go
- cla-backend-go/swagger/cla.v2.yaml
- cla-backend-go/v2/my_clas/service.go
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
cla-backend-go/swagger/cla.v2.yaml:4967
- The repeatable indexed-identity parameters are unbounded (only
secondaryEmailhasmaxItems), while ID and username values are not deduplicated before lookup. An authenticated caller can repeat one owned value hundreds of times within the URL limit and force hundreds of sequential DynamoDB queries, causing timeouts and avoidable read load. Apply a consistent bound to every repeatable identity parameter and deduplicate IDs/usernames server-side.
myClasGithubId:
name: githubId
description: GitHub numeric user IDs linked to the user
in: query
type: array
items:
type: integer
collectionFormat: multi
cla-backend-go/v2/my_clas/service.go:673
- The final message-based fallback also classifies infrastructure failures such as DynamoDB
ResourceNotFoundException: Requested resource not foundas an ordinary missing user. Those errors are then ignored byauthorizeIdentity/resolveUsers, so a missing table or index can produce a partial200instead of the promised500. The concrete user-missing cases are already represented byutils.UserNotFound, OpenAPI 404s, ornil, so unknown errors should be propagated.
return strings.Contains(strings.ToLower(err.Error()), "not found")
cla-backend-go/v2/my_clas/service.go:354
- Authorization compares provider usernames case-insensitively, but it retains the caller's spelling for resolution. The underlying GitHub/GitLab GSIs use exact string equality and user creation stores usernames without lowercasing (
users/repository.go:109-112,1100), so an allowed request such asoctocatfor a connected identity stored asOctocatreturns no historical record. Preserve the canonical spelling from the matched EasyCLA/platform identity for the GSI lookup, or introduce normalized username indexes.
appendAllowedStrings(requested.GithubUsernames, "githubUsername", strings.TrimSpace, usernameAllowed(identitySourceGithub, selfGithubUsername), &allowed.GithubUsernames, &skipped)
appendAllowedIDs(requested.GitlabIDs, "gitlabId", idAllowed(selfGitlabID), &allowed.GitlabIDs, &skipped)
appendAllowedStrings(requested.GitlabUsernames, "gitlabUsername", strings.TrimSpace, usernameAllowed(identitySourceGitlab, selfGitlabUsername), &allowed.GitlabUsernames, &skipped)
appendAllowedStrings(requested.GerritUsernames, "gerritUsername", strings.TrimSpace, usernameAllowed(identitySourceGerrit, currentUsername), &allowed.GerritUsernames, &skipped)
cla-backend-go/v2/user-service/client.go:308
- This request uses
http.DefaultClientwith no timeout and cannot receive the incoming request context. A stalled user-service connection can therefore hold the Lambda until its global timeout, defeating the intended graceful degradation for optional identity enrichment. Accept a context (or use a client with a bounded timeout) and issue each paginated request with that context.
response, doErr := http.DefaultClient.Do(request)
Signed-off-by: Łukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (6)
cla-backend-go/v2/my_clas/service.go:50
- An admin principal with no username can bypass the intended 400 by passing only empty or whitespace query values:
IsEmptytreats any non-empty slice as an identity, whileresolveUserslater discards those strings. For example,?email=reaches the service and returns an empty 200 instead of “no identity provided.” Treat blank string elements as absent here.
func (i *Identity) IsEmpty() bool {
return i.LfUsername == "" && len(i.Emails) == 0 && len(i.SecondaryEmails) == 0 &&
len(i.GithubIDs) == 0 && len(i.GithubUsernames) == 0 &&
len(i.GitlabIDs) == 0 && len(i.GitlabUsernames) == 0 &&
len(i.GerritUsernames) == 0
}
cla-backend-go/v2/my_clas/service.go:182
- This sets
pdfAvailable=truefor every signed ICLA without checking the object. The same service explicitly returns not found whendocumentExistsis false (lines 257–260), so the list can advertise a download that deterministically fails. Either derive this flag from object existence or rename/document it as eligibility and make the consumer handle missing files.
row.PdfAvailable = true
cla-backend-go/v2/my_clas/service.go:497
- Wrapping these lookups as single-result functions prevents the promised union of all records matching an identity key. The existing GSI repositories explicitly return only
dbUserModels[0]when several rows match (for exampleusers/repository.go:645-651andusers/repository.go:1138-1144). Duplicate historical records or recycled SCM handles can therefore omit CLA history. Add plural, paginated LF/GitHub/GitLab lookup methods and pass every returned row toadd.
single := func(lookup func(string) (*v1Models.User, error)) func(string) ([]*v1Models.User, error) {
return func(value string) ([]*v1Models.User, error) {
userModel, err := lookup(value)
return []*v1Models.User{userModel}, err
}
cla-backend-go/v2/my_clas/service.go:518
- GitHub ownership is checked case-insensitively, but this lookup receives the caller's original casing. The underlying
github-username-indexquery is exact (users/repository.go:1100) and writes preserve casing (users/repository.go:109-112), so an allowed request such asoctocatwill miss a storedOctoCatrecord. Resolve with the canonical casing obtained from the EasyCLA/platform identity, or introduce a normalized username index.
if err := addByLookup(trimAll(identity.GithubUsernames), "GitHub username", single(s.usersService.GetUserByGitHubUsername)); err != nil {
cla-backend-go/v2/my_clas/repository.go:132
- This paginates through the entire users table for every
secondaryEmailrequest. Because any authenticated caller can submit one of their verified emails, “opt-in” andmaxItemsdo not bound the rows read or prevent repeated full-table scans; this can consume table capacity and throttle unrelated user operations. Use an indexed/materialized secondary-email mapping, or otherwise place an enforceable rate/capability boundary around this path.
scanResults, scanErr := repo.dynamoDBClient.ScanWithContext(ctx, scanInput)
cla-backend-go/v2/my_clas/service.go:579
- This converts an approval-list evaluation error into
valid=false, but the PR-gating path propagates the sameUserIsApprovederror (signatures/service.go:1578-1582). That means malformed approval criteria are reported as a definitive invalid ECLA here rather than an indeterminate failure, contrary to issue #1164's requirement to align exactly with gating. PropagateapprovedErrso the API does not return an inaccurate validity result.
covered, approvedErr := s.signaturesService.UserIsApproved(ctx, userModel, ccla)
if approvedErr != nil {
log.WithFields(f).WithError(approvedErr).Warn("unable to evaluate the approval list for the employee acknowledgement")
covered = false
}
Signed-off-by: Łukasz Gryglicki <[email protected]> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
docs/MY_CLAS_API.md (1)
533-542: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy liftRequire explicit security sign-off for recycled-identity access.
The documented design lets a new holder of a reused corporate email or renamed SCM handle access historical signed CLAs belonging to the previous holder. These are legal records; documenting this as an accepted limitation does not remove the privacy risk. Require immutable-identity corroboration or explicit product/security approval before release.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/MY_CLAS_API.md` around lines 533 - 542, The documentation in the “Current possession of an identity grants access…” section must not present recycled email or SCM identities as unconditionally accepted. Require immutable-identity corroboration for historical-record access, or explicitly gate the behavior on documented product/security approval before release; retain numeric githubId/gitlabId as the preferred immutable parameters.cla-backend-go/v2/my_clas/repository.go (1)
148-184: 🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy liftAvoid a full users-table scan on the listing path.
FilterExpressiondoes not reduce scanned capacity, so every secondary-email lookup pages through the entire users table. This makes a normal identity-resolution fallback unbounded and risks missing the documented list latency target or throttling DynamoDB. Add an indexed secondary-email lookup/materialized mapping instead.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cla-backend-go/v2/my_clas/repository.go` around lines 148 - 184, Replace the full-table ScanWithContext pagination in the secondary-email lookup with an indexed lookup or materialized secondary-email mapping keyed by the requested emails. Update the surrounding repository method to query that index/mapping and preserve the existing DBUser result and error behavior, without relying on FilterExpression to locate matches.
🧹 Nitpick comments (2)
docs/MY_CLAS_API.md (2)
367-367: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAvoid presenting eligibility as confirmed PDF availability.
pdfAvailable: truemeans the signed ICLA is eligible, but the S3 object is not checked until the PDF endpoint is called. Rename this to something likepdfEligible, or make the distinction explicit in the schema and consumer contract to avoid download failures after a positive availability signal.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/MY_CLAS_API.md` at line 367, Rename the documented `pdfAvailable` field to `pdfEligible` throughout the schema and consumer contract, and update its description to state that it indicates eligibility only; actual S3 PDF existence is verified by the PDF endpoint. Ensure all references use the new name so consumers do not interpret eligibility as confirmed availability.
471-485: 🚀 Performance & Scalability | 🔵 TrivialBound and validate the documented latency assumptions.
The performance section describes one GSI query even though the lookups are paginated, and GitHub approval checks can add one outbound API call per
(CLA group, company, user)evaluation. Please document the actual request count, caching/deduplication, timeouts, and worst-case behavior before claiming this is within the Lambda latency envelope.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/MY_CLAS_API.md` around lines 471 - 485, Update the performance section around the documented GSI, platform-service, and GitHub calls to state pagination-dependent request counts, caching and deduplication behavior, and applicable request timeouts. Describe the worst-case outbound-call scenario for GitHub approval evaluations and qualify or substantiate the claim that the read-only Me-lens page fits within the v4 Lambda latency envelope.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/MY_CLAS_API.md`:
- Around line 172-177: Clarify the failure policy in the “Empty results” section
by scoping the 500-response rule to EasyCLA repository history and display
lookups. Preserve the separate user-service behavior where outages skip entries
and report identities as unverifiable, while missing CLA groups or company
records still degrade gracefully.
In
`@specs/001-easycla-ss-integration-fable/m1-my-cla/contracts/upstream-easycla-api.md`:
- Line 5: Update the “Implementation update” statement in the upstream EasyCLA
API contract to describe the consolidated endpoints as implemented or planned in
this PR, not shipped, until deployment is complete; preserve the endpoint names
and rationale while avoiding language that implies consumers can use an
unavailable API.
In `@specs/001-easycla-ss-integration-fable/m1-my-cla/plan.md`:
- Line 68: The design artifacts still describe deprecated SS-side v3 identity,
signature, and PDF flows. Update plan.md lines 68-68 to describe the SS client
calling the consolidated authenticated list and PDF endpoints; update
data-model.md lines 7-7 to document the v4 endpoint’s internal identity
resolution; and update data-model.md lines 75-75 to remove SS-side EasyCLA
user-ID/signature/PDF authorization and instead forward session-derived identity
inputs to the consolidated endpoint.
- Line 54: Replace the developer-specific absolute path in the “Primary repo”
entry with a repository-relative path or canonical repository identifier,
removing the personal username and workstation-specific layout while preserving
the repository reference.
---
Outside diff comments:
In `@cla-backend-go/v2/my_clas/repository.go`:
- Around line 148-184: Replace the full-table ScanWithContext pagination in the
secondary-email lookup with an indexed lookup or materialized secondary-email
mapping keyed by the requested emails. Update the surrounding repository method
to query that index/mapping and preserve the existing DBUser result and error
behavior, without relying on FilterExpression to locate matches.
In `@docs/MY_CLAS_API.md`:
- Around line 533-542: The documentation in the “Current possession of an
identity grants access…” section must not present recycled email or SCM
identities as unconditionally accepted. Require immutable-identity corroboration
for historical-record access, or explicitly gate the behavior on documented
product/security approval before release; retain numeric githubId/gitlabId as
the preferred immutable parameters.
---
Nitpick comments:
In `@docs/MY_CLAS_API.md`:
- Line 367: Rename the documented `pdfAvailable` field to `pdfEligible`
throughout the schema and consumer contract, and update its description to state
that it indicates eligibility only; actual S3 PDF existence is verified by the
PDF endpoint. Ensure all references use the new name so consumers do not
interpret eligibility as confirmed availability.
- Around line 471-485: Update the performance section around the documented GSI,
platform-service, and GitHub calls to state pagination-dependent request counts,
caching and deduplication behavior, and applicable request timeouts. Describe
the worst-case outbound-call scenario for GitHub approval evaluations and
qualify or substantiate the claim that the read-only Me-lens page fits within
the v4 Lambda latency envelope.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 33c5904a-f9cb-4c89-aacf-e19f8a07b27c
📒 Files selected for processing (11)
cla-backend-go/cmd/server.gocla-backend-go/swagger/common/my-cla.yamlcla-backend-go/v2/my_clas/repository.gocla-backend-go/v2/my_clas/service.gocla-backend-go/v2/my_clas/service_test.gocla-backend-go/v2/user-service/client.godocs/MY_CLAS_API.mdspecs/001-easycla-ss-integration-fable/m1-my-cla/contracts/upstream-easycla-api.mdspecs/001-easycla-ss-integration-fable/m1-my-cla/data-model.mdspecs/001-easycla-ss-integration-fable/m1-my-cla/plan.mdspecs/001-easycla-ss-integration-fable/m1-my-cla/spec.md
🚧 Files skipped from review as they are similar to previous changes (3)
- cla-backend-go/swagger/common/my-cla.yaml
- cla-backend-go/cmd/server.go
- cla-backend-go/v2/my_clas/service_test.go
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (5)
cla-backend-go/v2/my_clas/service.go:617
- This treats the presence of any GitLab-group approval as proof that this user is currently a member. The actual GitLab gating path checks membership (
v2/gitlab-activity/service.go:690-703), so a stalesignature_approved=truerow is reported valid after the user leaves the group. That contradicts lfx-self-serve#1164's requirement to align validity exactly with PR gating; perform the live group check or avoid claiming current validity.
// UserIsApproved cannot evaluate GitLab group membership (it needs per-group OAuth
// tokens); defer to the signature_approved flag, which the approval-list
// invalidation flow maintains (see docs/MY_CLAS_API.md).
if !covered && approvedErr == nil && len(ccla.GitlabOrgApprovalList) > 0 {
covered = true
cla-backend-go/v2/my_clas/service.go:361
- The Self Serve request documented in
docs/MY_CLAS_API.md:441-448supplies GitHub numeric IDs, but this permits an ID only when it is already present on an LFID-matched EasyCLA row. In the pre-LF-login case FR-005 targets, that ID can exist only on the detached historical row, so it is skipped before lookup and the user's history remains missing. Pass and verify the connected GitHub username as well, or add a trusted username-to-ID verification path.
appendAllowedIDs(requested.GithubIDs, "githubId", idAllowed(selfGithubIDs), &allowed.GithubIDs, &skipped)
cla-backend-go/v2/my_clas/service.go:548
- Verified emails passed through the documented
emailparameter are queried only againstlf_email; records containing the address solely inuser_emailsare searched only when the caller separately usessecondaryEmail. Since the documented Self Serve mapping passesemailvalues but notsecondaryEmail, those historical records are omitted, contrary to FR-005. Make the consumer send verified addresses through both lookup paths or make this resolution cover both fields.
if err := addByLookup(normalizeEmails(identity.Emails), "email", s.repo.GetUsersByPrimaryEmail); err != nil {
return nil, err
}
if secondaryEmails := normalizeEmails(identity.SecondaryEmails); len(secondaryEmails) > 0 {
matches, err := s.repo.GetUsersBySecondaryEmails(ctx, secondaryEmails)
cla-backend-go/v2/my_clas/service.go:612
- Approval-list evaluation errors are converted into
valid=false, so the consumer filters out a potentially valid ECLA while the request still succeeds. This differs fromProcessEmployeeSignature, which propagatesUserIsApprovederrors, and from the API contract's no-partial-history behavior. Propagate the error instead of silently returning an inaccurate list.
covered, approvedErr := s.signaturesService.UserIsApproved(ctx, userModel, ccla)
if approvedErr != nil {
log.WithFields(f).WithError(approvedErr).Warn("unable to evaluate the approval list for the employee acknowledgement")
covered = false
}
cla-backend-go/v2/my_clas/service.go:169
- Approved signed ICLAs are always marked valid here, so a signature against an older CLA document is never identified as superseded. FR-001 requires a validity status, and the proposed Self Serve mapping derives status from this boolean while the response does not expose the current document version needed for comparison. Compute supersession or return enough current-version data for the consumer to do so.
if sig.SignatureUserCompanyID == "" {
row.ClaType = utils.ClaTypeICLA
row.Valid = sig.SignatureApproved
row.PdfAvailable = true
Switch the read-only "My CLAs" server module from client-side signature composition (GET /v4/users/by-identity + GET /v4/signatures/user + local classify/filter/dedupe) to the EasyCLA-composed endpoints merged in linuxfoundation/easycla#5125 / #5128: - getMyClas -> single GET /v4/my-clas; upstream computes validity against the current CCLA approval lists and returns classified/deduped/sorted ICLAs+ECLAs, mapped 1:1 to the UI view model. - PDF -> GET /v4/my-clas/{signatureID}/pdf; ownership + ICLA eligibility is enforced upstream (404 on unknown/not-owned/ECLA), so the SS-side re-resolve pre-check is removed. resolveIdentity now sends both githubId and githubUsername: the numeric id validates upstream against EasyCLA records, the username validates via the platform user-service, which is the only path that authorizes a pre-LFID GitHub-only signer whose id has no EasyCLA LFID record. The linked-identity (GitHub) lookup is best-effort: an auth-service/NATS failure degrades to LF-username + email resolution instead of failing the whole page. Response contract to the frontend is unchanged; the superseded status label is no longer produced (the endpoint does not expose the current version). Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Michal Lehotsky <[email protected]>
Adds the architecture-review context for the EasyCLA → LFX Self Serve migration under docs/easycla-ss-migration/: the milestone proposal (M1–M6), the EasyCLA↔SS role-mapping feasibility memo, the spike runbook, and a README (which links the architecture-review Google Slides deck). Scoped to the architecture docs only. The M1 spec-kit set (specs/…/m1-my-cla/) is intentionally not carried here — M1 is shipped and its spec docs already live on dev via the My CLAs API PRs (#5125/#5128). Docs only — no code changes. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Michal Lehotsky <[email protected]>
…"My CLAs" feature) (#1226) * feat(cla): read-only My CLAs server slice (EasyCLA M1) Adds the Me-lens "My CLAs" backend for Milestone 1 of the EasyCLA → Self Serve integration: a read-only list of a user's signed ICLAs/ECLAs plus short-lived ICLA PDF-URL resolution, calling the existing EasyCLA v3/v4 APIs through lfx-gateway /cla-service. - shared: MyClaAgreement / MyClasResponse / PdfUrlResponse interfaces - server/types: upstream EasyCLA signature/user shapes + ResolvedClaIdentity - server/services/cla.service.ts: username-only identity resolution via /v3/users/username/{userName} (interim path; three-key union lands with GET /v4/users/by-identity), paginated user-signatures fetch, signed-document URL, and pure classification/status helpers - server/controllers + routes: GET /api/me/clas and GET /api/me/clas/:signatureId/pdf-url; identity derived strictly from the session (SS is the authz boundary), PDF handler returns 404 (never 403) for unknown/not-owned/ECLA signatures Uses the standard gatewayFetch + req.apiGatewayToken pattern; base URL derived from API_GW_AUDIENCE (no new env). Feature gating is applied Angular-side. Ref: specs/001-easycla-ss-integration-fable/m1-my-cla (T012, T016-T018) Signed-off-by: Michal Lehotsky <[email protected]> * test(cla): unit tests for My CLAs service + controller (M1) - cla.service.spec.ts (T013/T014): claType classification with fallback heuristic, status derivation incl. superseded, ECLA-invalid filtering, dedupe + signedOn-desc sort, normalizeGithubId (prefixed vs bare), and identity resolution (username match, 404 no-match, github-link detection). - clas.controller.spec.ts (T015): 401 without session, session-derived identity only (request-supplied ids ignored), upstream errors forwarded to next(), and the PDF authz boundary — 404 (never 403) for unknown, not-owned, and ECLA signatures; presigned URL only for owned ICLAs. 32 tests, all passing. Ref: specs/001-easycla-ss-integration-fable/m1-my-cla (T013-T015) Signed-off-by: Michal Lehotsky <[email protected]> * feat(cla): My CLAs Profile tab UI (EasyCLA M1, T020-T022) Adds the read-only "My CLAs" Angular view under the Me lens Profile hub, dark-launched behind the `my-clas-enabled` flag: - profile.routes.ts: `profile/clas` route gated by a myClasEnabledGuard (CanMatch); profile-layout appends the "My CLAs" tab (before Transactions) only when the flag is on, keeping tab + route in lockstep. - my-clas.service.ts: client for GET /api/me/clas and the ICLA pdf-url endpoint. - profile-clas.component: ICLA/ECLA sections, loading/error(retry)/empty states, "history may be incomplete" hint on unmatched identity, GitHub-link CTA into the identities flow, and a "Sign a new CLA" link-out to the Contributor Console. PDF download opens a blank tab synchronously (popup-safe) then sets its URL. - agreement-card.component: per-row kind badge, status label (ICLA), signed date, and Download PDF for ICLAs / "Covered by Corporate CLA (CCLA)" for ECLAs. - environments: contributorConsole URL per env (host TBD — see TODO). - feature-flags: MY_CLAS_ENABLED_FLAG constant. Also folds in a small test-fixture fix in cla.service.spec.ts (drop a field that isn't on EasyClaSignature; assert lfUsername instead of a non-existent field) so the strict-template build is green. ng build (strict templates) clean apart from a pre-existing unrelated error; 32 server unit tests pass. Ref: specs/001-easycla-ss-integration-fable/m1-my-cla (T020-T022) Signed-off-by: Michal Lehotsky <[email protected]> * fix(cla): use confirmed Contributor Console URLs per environment EasyCLA team confirmed the sign-out targets: - dev/local: https://easycla.dev.communitybridge.org/ - staging: https://easycla.staging.communitybridge.org/ - prod: https://contributor.easycla.lfx.linuxfoundation.org/ Removes the placeholder dev/staging hosts and the confirm-with-team TODOs. Ref: specs/001-easycla-ss-integration-fable/m1-my-cla Signed-off-by: Michal Lehotsky <[email protected]> * feat(cla): consume /v4/users/by-identity + projectName (full identity union) Wires the My CLAs server to the new upstream endpoint (linuxfoundation/easycla#5126): - resolveIdentity now calls GET /v4/users/by-identity with the three keys (lfUsername + verified emails + linked GitHub numeric IDs), unioning all matched EasyCLA user records — replacing the interim username-only lookup. Falls back to /v3/users/username/{userName} if by-identity 404s, so the feature still works in environments where it is not yet deployed. - toMyClaAgreement now prefers the upstream-resolved projectName, falling back to the CLA Group ID only when the name is absent. - EasyClaSignature gains an optional projectName field. Tests updated to the array-returning by-identity shape; added cases for the union, the query-param wiring, the username-only fallback, and the projectName-preference. 35 tests pass; tsc + eslint clean. Signed-off-by: Michal Lehotsky <[email protected]> * test(cla): extract My CLAs view logic to tested pure helpers (T024) The repo has no Angular component-test harness (vitest is server/shared only, no TestBed), so component specs would mean introducing infra no other component uses. Instead, extract the components' branching logic into framework-free helpers in @lfx-one/shared and unit-test those: - cla-view.utils.ts: splitAgreementsByKind, isMyClasEmpty, shouldShowGithubCta, claKindSeverity, claStatusLabel, claStatusSeverity. - profile-clas + agreement-card now delegate to these helpers (no behaviour change; thinner computeds). - 13 unit tests covering the ICLA/ECLA split, empty-vs-loading-vs-error, CTA-visibility rules, and status/kind label+severity mapping. Full suites: 121 server + 366 shared tests pass; ng build clean. Signed-off-by: Michal Lehotsky <[email protected]> * fix(cla): keep window handle for PDF download popup (PR #1203 review) Address review feedback from copilot[bot]: - profile-clas.component.ts: window.open('', '_blank', 'noopener,noreferrer') returns null in modern browsers, so the popup-safe download always fell through to same-tab navigation and could orphan a blank tab. Open without `noopener` to retain the handle and sever `tab.opener` manually for the same reverse-tabnabbing protection. Resolves 1 review thread. Signed-off-by: Michal Lehotsky <[email protected]> * style(cla): apply prettier formatting (PR #1203 Code Quality Checks) Resolves the "Check formatting" failure — prettier --write on the four flagged files. Formatting-only, no behaviour change. Signed-off-by: Michal Lehotsky <[email protected]> * fix(review): address PR #1203 review feedback Address review comment from cursor[bot]: - shared/utils/cla-view.utils.ts: add buildProfileTabs(myClasEnabled) helper that appends the read-only "My CLAs" tab before Transactions when the flag is on - sidebar.component.ts: bind the me-lens ⋯ profile menu to buildProfileTabs() instead of the static PROFILE_TABS, so the sidebar entry point surfaces My CLAs whenever the flag is on — keeping it in sync with the profile-layout subtab strip (per cursor[bot]) - profile-layout.component.ts: use the shared buildProfileTabs helper in place of the inline insert logic (single source of truth) - cla-view.utils.spec.ts: cover buildProfileTabs (flag on/off, insert position, no mutation of the shared constant) Resolves 1 review thread. Signed-off-by: Michal Lehotsky <[email protected]> * feat(cla): consume EasyCLA /v4/my-clas endpoints for My CLAs Switch the read-only "My CLAs" server module from client-side signature composition (GET /v4/users/by-identity + GET /v4/signatures/user + local classify/filter/dedupe) to the EasyCLA-composed endpoints merged in linuxfoundation/easycla#5125 / #5128: - getMyClas -> single GET /v4/my-clas; upstream computes validity against the current CCLA approval lists and returns classified/deduped/sorted ICLAs+ECLAs, mapped 1:1 to the UI view model. - PDF -> GET /v4/my-clas/{signatureID}/pdf; ownership + ICLA eligibility is enforced upstream (404 on unknown/not-owned/ECLA), so the SS-side re-resolve pre-check is removed. resolveIdentity now sends both githubId and githubUsername: the numeric id validates upstream against EasyCLA records, the username validates via the platform user-service, which is the only path that authorizes a pre-LFID GitHub-only signer whose id has no EasyCLA LFID record. The linked-identity (GitHub) lookup is best-effort: an auth-service/NATS failure degrades to LF-username + email resolution instead of failing the whole page. Response contract to the frontend is unchanged; the superseded status label is no longer produced (the endpoint does not expose the current version). Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Michal Lehotsky <[email protected]> * feat(cla): remove "Sign a new CLA" button from My CLAs header Drops the Contributor Console link button (and the now-unused contributorConsoleUrl property + environment import) from the My CLAs Profile tab header per design. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Michal Lehotsky <[email protected]> * fix(clas): correct impersonation token + ICLA PDF-unavailable label (PR #1226) Address review feedback from copilot[bot], coderabbitai[bot], cursor[bot]: - cla.service.ts: pass the target user's bearerToken on /v4/my-clas and /v4/my-clas/{id}/pdf during impersonation, so upstream authorization runs under the impersonated principal instead of the impersonator's apiGatewayToken (matches the EnrollmentService pattern). Adds coverage. - agreement-card.component.html: only show "Covered by Corporate CLA (CCLA)" for ECLAs; an ICLA with no stored PDF now shows a neutral "PDF unavailable" instead of a false CCLA-coverage statement. - clas.controller.ts: correct the trust-model comment — EasyCLA (not SS) is the ownership authorization boundary; SS only asserts trusted identity keys. Style/convention and speculative suggestions left as-is (see PR thread replies). Signed-off-by: Michal Lehotsky <[email protected]> * feat(profile): render my clas as a single lfx-table (no status column) (#1269) * feat(profile): render My CLAs as a single lfx-table (no status column) Rework the My CLAs profile tab from grouped ICLA/ECLA cards to a single house lfx-table (Project / Type / Signed / Document) with an always-on identity-linking info banner, an lfx-empty-state-based error state, and lfx-table's built-in loading skeleton. Match the approved M1 mockup and reuse the shared lfx-table instead of a bespoke card/row component. - Reworked profile-clas.component.html/.ts to render a single lfx-table - Added an always-on identity-linking info banner (links to /profile/identities) - Added an lfx-empty-state-based error state and table-shaped loading skeleton - Deleted the now-unused agreement-card component - Status column intentionally omitted per the mockup; claStatusLabel/ claStatusSeverity/ClaStatus remain in cla-view.utils.ts as deliberate deadcode pending design confirmation on #1162 Closes #1162 Signed-off-by: ahmedomosanya <[email protected]> * fix(clas): show only valid CLAs (ICLA + ECLA) in My CLAs list Filter /v4/my-clas to `valid === true` for both ICLA and ECLA in the BFF (getMyClas), so every row rendered in the My CLAs table is currently valid. This makes the approved no-status mockup correct (closes D1) and adds the previously-missing consumer-side ECLA valid-only display filter (FR-002). The endpoint intentionally returns invalid rows too (valid=false) and leaves the final display filter to the consumer; the endpoint owner endorsed skipping `valid != true` records. Trade-off: invalid/superseded ICLAs are now hidden, which deviates from #1158's literal "ICLAs in all statuses" wording -- flagged to design for a courtesy confirm. Flip the pass-through unit test to assert filtering and revise the component JSDoc to valid-only. Signed-off-by: ahmedomosanya <[email protected]> --------- Signed-off-by: ahmedomosanya <[email protected]> * fix(clas): skip My CLAs fetch during SSR to avoid a false error flash ProfileClasComponent kicked off getMyClas() during SSR with no browser guard. The server's HTTP call doesn't carry the user's session cookie reliably, so it tends to fail and bakes a false "Couldn't load your CLAs" error into the SSR HTML -- a red-banner flash on hydration before the browser's authenticated fetch resolves. Guard the fetch with isPlatformBrowser and return a not-loaded state on the server, mirroring the sibling ProfileIdentitiesComponent and .claude/rules/ ssr-safety.md. The browser re-runs the fetch on hydration. Signed-off-by: ahmedomosanya <[email protected]> * feat(cla): surface salesforce project name and logo in my clas The EasyCLA backend now resolves the Salesforce project name and logo for each signed CLA, so consume the newly-added projectName/projectLogo from the /v4/my-clas endpoint across the My CLAs stack instead of showing only the CLA-group name. - Add projectName/projectLogo to the raw type (cla.types.ts) and the shared UI interface (cla.interface.ts), renaming the pre-existing projectName (which was actually the CLA-group name) to claGroupName - Map the new fields in cla.service.ts, normalizing empty upstream strings to undefined so template fallbacks trigger correctly - Render the Salesforce project logo (fa-file-signature fallback) and the project name (claGroupName as subtext / fallback) in the Project cell of profile-clas.component.html Signed-off-by: ahmedomosanya <[email protected]> * refactor(cla): move MyClasState interface to shared Relocate the MyClasState view-state interface out of the profile-clas component file into @lfx-one/shared/interfaces (cla.interface.ts), per the project rule that all interfaces — including component-only view types — live in the shared barrel rather than local to a component. Switch the component's remaining type-only imports (MyClaAgreement, MyClasState) to import type. Signed-off-by: ahmedomosanya <[email protected]> --------- Signed-off-by: Michal Lehotsky <[email protected]> Signed-off-by: ahmedomosanya <[email protected]> Signed-off-by: GitHub <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: ahmedomosanya <[email protected]> Co-authored-by: copilot-swe-agent[bot] <[email protected]>
* feat(cla): read-only My CLAs server slice (EasyCLA M1)
Adds the Me-lens "My CLAs" backend for Milestone 1 of the EasyCLA → Self
Serve integration: a read-only list of a user's signed ICLAs/ECLAs plus
short-lived ICLA PDF-URL resolution, calling the existing EasyCLA v3/v4
APIs through lfx-gateway /cla-service.
- shared: MyClaAgreement / MyClasResponse / PdfUrlResponse interfaces
- server/types: upstream EasyCLA signature/user shapes + ResolvedClaIdentity
- server/services/cla.service.ts: username-only identity resolution via
/v3/users/username/{userName} (interim path; three-key union lands with
GET /v4/users/by-identity), paginated user-signatures fetch, signed-document
URL, and pure classification/status helpers
- server/controllers + routes: GET /api/me/clas and
GET /api/me/clas/:signatureId/pdf-url; identity derived strictly from the
session (SS is the authz boundary), PDF handler returns 404 (never 403) for
unknown/not-owned/ECLA signatures
Uses the standard gatewayFetch + req.apiGatewayToken pattern; base URL derived
from API_GW_AUDIENCE (no new env). Feature gating is applied Angular-side.
Ref: specs/001-easycla-ss-integration-fable/m1-my-cla (T012, T016-T018)
Signed-off-by: Michal Lehotsky <[email protected]>
* test(cla): unit tests for My CLAs service + controller (M1)
- cla.service.spec.ts (T013/T014): claType classification with fallback
heuristic, status derivation incl. superseded, ECLA-invalid filtering,
dedupe + signedOn-desc sort, normalizeGithubId (prefixed vs bare), and
identity resolution (username match, 404 no-match, github-link detection).
- clas.controller.spec.ts (T015): 401 without session, session-derived
identity only (request-supplied ids ignored), upstream errors forwarded to
next(), and the PDF authz boundary — 404 (never 403) for unknown, not-owned,
and ECLA signatures; presigned URL only for owned ICLAs.
32 tests, all passing.
Ref: specs/001-easycla-ss-integration-fable/m1-my-cla (T013-T015)
Signed-off-by: Michal Lehotsky <[email protected]>
* feat(cla): My CLAs Profile tab UI (EasyCLA M1, T020-T022)
Adds the read-only "My CLAs" Angular view under the Me lens Profile hub,
dark-launched behind the `my-clas-enabled` flag:
- profile.routes.ts: `profile/clas` route gated by a myClasEnabledGuard
(CanMatch); profile-layout appends the "My CLAs" tab (before Transactions)
only when the flag is on, keeping tab + route in lockstep.
- my-clas.service.ts: client for GET /api/me/clas and the ICLA pdf-url endpoint.
- profile-clas.component: ICLA/ECLA sections, loading/error(retry)/empty states,
"history may be incomplete" hint on unmatched identity, GitHub-link CTA into the
identities flow, and a "Sign a new CLA" link-out to the Contributor Console.
PDF download opens a blank tab synchronously (popup-safe) then sets its URL.
- agreement-card.component: per-row kind badge, status label (ICLA), signed date,
and Download PDF for ICLAs / "Covered by Corporate CLA (CCLA)" for ECLAs.
- environments: contributorConsole URL per env (host TBD — see TODO).
- feature-flags: MY_CLAS_ENABLED_FLAG constant.
Also folds in a small test-fixture fix in cla.service.spec.ts (drop a field that
isn't on EasyClaSignature; assert lfUsername instead of a non-existent field) so
the strict-template build is green.
ng build (strict templates) clean apart from a pre-existing unrelated error;
32 server unit tests pass.
Ref: specs/001-easycla-ss-integration-fable/m1-my-cla (T020-T022)
Signed-off-by: Michal Lehotsky <[email protected]>
* fix(cla): use confirmed Contributor Console URLs per environment
EasyCLA team confirmed the sign-out targets:
- dev/local: https://easycla.dev.communitybridge.org/
- staging: https://easycla.staging.communitybridge.org/
- prod: https://contributor.easycla.lfx.linuxfoundation.org/
Removes the placeholder dev/staging hosts and the confirm-with-team TODOs.
Ref: specs/001-easycla-ss-integration-fable/m1-my-cla
Signed-off-by: Michal Lehotsky <[email protected]>
* feat(cla): consume /v4/users/by-identity + projectName (full identity union)
Wires the My CLAs server to the new upstream endpoint (linuxfoundation/easycla#5126):
- resolveIdentity now calls GET /v4/users/by-identity with the three keys
(lfUsername + verified emails + linked GitHub numeric IDs), unioning all
matched EasyCLA user records — replacing the interim username-only lookup.
Falls back to /v3/users/username/{userName} if by-identity 404s, so the
feature still works in environments where it is not yet deployed.
- toMyClaAgreement now prefers the upstream-resolved projectName, falling back
to the CLA Group ID only when the name is absent.
- EasyClaSignature gains an optional projectName field.
Tests updated to the array-returning by-identity shape; added cases for the
union, the query-param wiring, the username-only fallback, and the
projectName-preference. 35 tests pass; tsc + eslint clean.
Signed-off-by: Michal Lehotsky <[email protected]>
* test(cla): extract My CLAs view logic to tested pure helpers (T024)
The repo has no Angular component-test harness (vitest is server/shared only,
no TestBed), so component specs would mean introducing infra no other component
uses. Instead, extract the components' branching logic into framework-free
helpers in @lfx-one/shared and unit-test those:
- cla-view.utils.ts: splitAgreementsByKind, isMyClasEmpty, shouldShowGithubCta,
claKindSeverity, claStatusLabel, claStatusSeverity.
- profile-clas + agreement-card now delegate to these helpers (no behaviour
change; thinner computeds).
- 13 unit tests covering the ICLA/ECLA split, empty-vs-loading-vs-error,
CTA-visibility rules, and status/kind label+severity mapping.
Full suites: 121 server + 366 shared tests pass; ng build clean.
Signed-off-by: Michal Lehotsky <[email protected]>
* fix(cla): keep window handle for PDF download popup (PR #1203 review)
Address review feedback from copilot[bot]:
- profile-clas.component.ts: window.open('', '_blank', 'noopener,noreferrer')
returns null in modern browsers, so the popup-safe download always fell
through to same-tab navigation and could orphan a blank tab. Open without
`noopener` to retain the handle and sever `tab.opener` manually for the same
reverse-tabnabbing protection.
Resolves 1 review thread.
Signed-off-by: Michal Lehotsky <[email protected]>
* style(cla): apply prettier formatting (PR #1203 Code Quality Checks)
Resolves the "Check formatting" failure — prettier --write on the four flagged
files. Formatting-only, no behaviour change.
Signed-off-by: Michal Lehotsky <[email protected]>
* fix(review): address PR #1203 review feedback
Address review comment from cursor[bot]:
- shared/utils/cla-view.utils.ts: add buildProfileTabs(myClasEnabled)
helper that appends the read-only "My CLAs" tab before Transactions
when the flag is on
- sidebar.component.ts: bind the me-lens ⋯ profile menu to
buildProfileTabs() instead of the static PROFILE_TABS, so the sidebar
entry point surfaces My CLAs whenever the flag is on — keeping it in
sync with the profile-layout subtab strip (per cursor[bot])
- profile-layout.component.ts: use the shared buildProfileTabs helper
in place of the inline insert logic (single source of truth)
- cla-view.utils.spec.ts: cover buildProfileTabs (flag on/off, insert
position, no mutation of the shared constant)
Resolves 1 review thread.
Signed-off-by: Michal Lehotsky <[email protected]>
* feat(cla): consume EasyCLA /v4/my-clas endpoints for My CLAs
Switch the read-only "My CLAs" server module from client-side signature
composition (GET /v4/users/by-identity + GET /v4/signatures/user + local
classify/filter/dedupe) to the EasyCLA-composed endpoints merged in
linuxfoundation/easycla#5125 / #5128:
- getMyClas -> single GET /v4/my-clas; upstream computes validity against
the current CCLA approval lists and returns classified/deduped/sorted
ICLAs+ECLAs, mapped 1:1 to the UI view model.
- PDF -> GET /v4/my-clas/{signatureID}/pdf; ownership + ICLA eligibility is
enforced upstream (404 on unknown/not-owned/ECLA), so the SS-side
re-resolve pre-check is removed.
resolveIdentity now sends both githubId and githubUsername: the numeric id
validates upstream against EasyCLA records, the username validates via the
platform user-service, which is the only path that authorizes a pre-LFID
GitHub-only signer whose id has no EasyCLA LFID record.
The linked-identity (GitHub) lookup is best-effort: an auth-service/NATS
failure degrades to LF-username + email resolution instead of failing the
whole page.
Response contract to the frontend is unchanged; the superseded status label
is no longer produced (the endpoint does not expose the current version).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Michal Lehotsky <[email protected]>
* feat(cla): remove "Sign a new CLA" button from My CLAs header
Drops the Contributor Console link button (and the now-unused
contributorConsoleUrl property + environment import) from the My CLAs
Profile tab header per design.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Michal Lehotsky <[email protected]>
* fix(clas): correct impersonation token + ICLA PDF-unavailable label (PR #1226)
Address review feedback from copilot[bot], coderabbitai[bot], cursor[bot]:
- cla.service.ts: pass the target user's bearerToken on /v4/my-clas and
/v4/my-clas/{id}/pdf during impersonation, so upstream authorization runs
under the impersonated principal instead of the impersonator's
apiGatewayToken (matches the EnrollmentService pattern). Adds coverage.
- agreement-card.component.html: only show "Covered by Corporate CLA (CCLA)"
for ECLAs; an ICLA with no stored PDF now shows a neutral "PDF unavailable"
instead of a false CCLA-coverage statement.
- clas.controller.ts: correct the trust-model comment — EasyCLA (not SS) is
the ownership authorization boundary; SS only asserts trusted identity keys.
Style/convention and speculative suggestions left as-is (see PR thread replies).
Signed-off-by: Michal Lehotsky <[email protected]>
* feat(profile): render my clas as a single lfx-table (no status column) (#1269)
* feat(profile): render My CLAs as a single lfx-table (no status column)
Rework the My CLAs profile tab from grouped ICLA/ECLA cards to a single
house lfx-table (Project / Type / Signed / Document) with an always-on
identity-linking info banner, an lfx-empty-state-based error state, and
lfx-table's built-in loading skeleton. Match the approved M1 mockup and
reuse the shared lfx-table instead of a bespoke card/row component.
- Reworked profile-clas.component.html/.ts to render a single lfx-table
- Added an always-on identity-linking info banner (links to /profile/identities)
- Added an lfx-empty-state-based error state and table-shaped loading skeleton
- Deleted the now-unused agreement-card component
- Status column intentionally omitted per the mockup; claStatusLabel/
claStatusSeverity/ClaStatus remain in cla-view.utils.ts as deliberate
deadcode pending design confirmation on #1162
Closes #1162
Signed-off-by: ahmedomosanya <[email protected]>
* fix(clas): show only valid CLAs (ICLA + ECLA) in My CLAs list
Filter /v4/my-clas to `valid === true` for both ICLA and ECLA in the BFF
(getMyClas), so every row rendered in the My CLAs table is currently valid.
This makes the approved no-status mockup correct (closes D1) and adds the
previously-missing consumer-side ECLA valid-only display filter (FR-002).
The endpoint intentionally returns invalid rows too (valid=false) and leaves
the final display filter to the consumer; the endpoint owner endorsed skipping
`valid != true` records. Trade-off: invalid/superseded ICLAs are now hidden,
which deviates from #1158's literal "ICLAs in all statuses" wording -- flagged
to design for a courtesy confirm.
Flip the pass-through unit test to assert filtering and revise the component
JSDoc to valid-only.
Signed-off-by: ahmedomosanya <[email protected]>
---------
Signed-off-by: ahmedomosanya <[email protected]>
* fix(clas): skip My CLAs fetch during SSR to avoid a false error flash
ProfileClasComponent kicked off getMyClas() during SSR with no browser guard.
The server's HTTP call doesn't carry the user's session cookie reliably, so it
tends to fail and bakes a false "Couldn't load your CLAs" error into the SSR
HTML -- a red-banner flash on hydration before the browser's authenticated
fetch resolves.
Guard the fetch with isPlatformBrowser and return a not-loaded state on the
server, mirroring the sibling ProfileIdentitiesComponent and .claude/rules/
ssr-safety.md. The browser re-runs the fetch on hydration.
Signed-off-by: ahmedomosanya <[email protected]>
* feat(cla): surface salesforce project name and logo in my clas
The EasyCLA backend now resolves the Salesforce project name and logo for
each signed CLA, so consume the newly-added projectName/projectLogo from
the /v4/my-clas endpoint across the My CLAs stack instead of showing only
the CLA-group name.
- Add projectName/projectLogo to the raw type (cla.types.ts) and the shared
UI interface (cla.interface.ts), renaming the pre-existing projectName
(which was actually the CLA-group name) to claGroupName
- Map the new fields in cla.service.ts, normalizing empty upstream strings
to undefined so template fallbacks trigger correctly
- Render the Salesforce project logo (fa-file-signature fallback) and the
project name (claGroupName as subtext / fallback) in the Project cell of
profile-clas.component.html
Signed-off-by: ahmedomosanya <[email protected]>
* refactor(cla): move MyClasState interface to shared
Relocate the MyClasState view-state interface out of the profile-clas
component file into @lfx-one/shared/interfaces (cla.interface.ts), per the
project rule that all interfaces — including component-only view types —
live in the shared barrel rather than local to a component. Switch the
component's remaining type-only imports (MyClaAgreement, MyClasState) to
import type.
Signed-off-by: ahmedomosanya <[email protected]>
* feat(cla): send all verified emails for My CLAs (#1227)
## Summary
`ClaService.resolveIdentity` now sends **all** of the user's verified emails to EasyCLA's `GET /v4/my-clas` (previously only the session primary email). Contributors often sign a CLA under a work email that isn't their LFID primary, so those signatures were silently missed. Implements #1227 (follow-up to #1226, part of EPIC #1157).
## What changed
- New exported pure helper `collectClaEmails(primaryEmail, emailData, identities)` — unions three server-side sources, lowercased/trimmed and deduped:
- the session primary email (always included as a floor, so behaviour never regresses);
- the verified-email list from auth-service `user_emails.read` (primary + `verified === true` alternates);
- emails carried on the already-fetched linked identities (`profileData.email`).
- `resolveIdentity` now fetches linked identities and the verified-email set **concurrently** (`Promise.allSettled`), keyed by the effective (impersonation-aware) sub. Both are best-effort: a NATS/auth-service failure degrades to session-primary-email resolution rather than failing the page.
- `identityQuery` already emits each email as a repeated indexed `email=` param, and `getMyClas` already logs `skippedIdentities`, so no change was needed there.
## Why `email`, not `secondaryEmail`
Emails are sent only via the indexed `email` param. EasyCLA's `email` lookup hits an indexed GSI (one query per value); `secondaryEmail` forces a full users-table scan. A work email EasyCLA filed solely as a record's *secondary* email is therefore intentionally not matched — a conscious performance trade-off.
## Safety
Identity keys are still sourced only from the trusted session, never from request input. EasyCLA re-verifies every email against the authenticated user and drops unowned ones into `skippedIdentities`, so sending the full set is safe.
## Testing
- `cd apps/lfx-one && npx vitest run src/server/services/cla.service.spec.ts` — 33 pass (added: `collectClaEmails` helper cases, the multi-email union, and the degraded lookup-returns-null path).
- `npx tsc --noEmit -p tsconfig.app.json` — clean.
- Gauntlet: `./check-headers.sh`, `yarn format:check`, `yarn lint:check`, `yarn check-types` — all pass.
Signed-off-by: ahmedomosanya <[email protected]>
* fix(cla): cap My CLAs email set at the upstream 100-item limit (#1227)
collectClaEmails could union more than 100 unique addresses across the
verified-email list and linked identities. /v4/my-clas caps the repeatable
`email` param at maxItems: 100 (easycla cla.v2.yaml), so an oversized set
would fail upstream validation and 400 the whole My CLAs page instead of
degrading. Cap the result at 100; the session primary is added first and
higher-signal sources precede linked-identity emails, so truncation preserves
primary-email priority.
Reviewer feedback: PR #1292, Copilot inline comment on cla.service.ts.
Signed-off-by: ahmedomosanya <[email protected]>
---------
Signed-off-by: Michal Lehotsky <[email protected]>
Signed-off-by: ahmedomosanya <[email protected]>
Signed-off-by: GitHub <[email protected]>
Co-authored-by: Michal Lehotsky <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ution Address review feedback on PR #5174 from copilot-pull-request-reviewer: - data-model.md: correct the MyClaAgreement TypeScript shape to match lfx-self-serve's cla.interface.ts (claGroupName required, projectName optional, status enum instead of a valid boolean) and restore matchedUserIds on the identity summary - data-model.md, spec.md, plan.md, contracts/upstream-easycla-api.md: stop claiming EasyCLA verifies every forwarded identity key. effectiveIdentity skips per-key ownership verification for admins and trusted callers (allow-listed azp), which is how Self Serve calls the endpoint, so SS remains the boundary for the keys it forwards. Document the bypass and its rationale. - spec.md, contracts/upstream-easycla-api.md: attribute GET /v4/my-clas/identities to #5128, not #5125 - docs/MY_CLAS_API.md: finish the Auth0 third-source update left incomplete in 42ff484 — the identities union is three sources, and numeric GitHub/GitLab IDs are verifiable against Auth0 linked identities, not only EasyCLA records Resolves 5 review threads. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Michal Lehotsky <[email protected]>
Adds the architecture-review context for the EasyCLA → LFX Self Serve migration under docs/easycla-ss-migration/: the milestone proposal (M1–M6), the EasyCLA↔SS role-mapping feasibility memo, the spike runbook, and a README (which links the architecture-review Google Slides deck). Scoped to the architecture docs only. The M1 spec-kit set (specs/…/m1-my-cla/) is intentionally not carried here — M1 is shipped and its spec docs already live on dev via the My CLAs API PRs (#5125/#5128). Docs only — no code changes. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Michal Lehotsky <[email protected]>
…ution Address review feedback on PR #5174 from copilot-pull-request-reviewer: - data-model.md: correct the MyClaAgreement TypeScript shape to match lfx-self-serve's cla.interface.ts (claGroupName required, projectName optional, status enum instead of a valid boolean) and restore matchedUserIds on the identity summary - data-model.md, spec.md, plan.md, contracts/upstream-easycla-api.md: stop claiming EasyCLA verifies every forwarded identity key. effectiveIdentity skips per-key ownership verification for admins and trusted callers (allow-listed azp), which is how Self Serve calls the endpoint, so SS remains the boundary for the keys it forwards. Document the bypass and its rationale. - spec.md, contracts/upstream-easycla-api.md: attribute GET /v4/my-clas/identities to #5128, not #5125 - docs/MY_CLAS_API.md: finish the Auth0 third-source update left incomplete in 42ff484 — the identities union is three sources, and numeric GitHub/GitLab IDs are verifiable against Auth0 linked identities, not only EasyCLA records Resolves 5 review threads. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Michal Lehotsky <[email protected]>
…ution Address review feedback on PR #5174 from copilot-pull-request-reviewer: - data-model.md: correct the MyClaAgreement TypeScript shape to match lfx-self-serve's cla.interface.ts (claGroupName required, projectName optional, status enum instead of a valid boolean) and restore matchedUserIds on the identity summary - data-model.md, spec.md, plan.md, contracts/upstream-easycla-api.md: stop claiming EasyCLA verifies every forwarded identity key. effectiveIdentity skips per-key ownership verification for admins and trusted callers (allow-listed azp), which is how Self Serve calls the endpoint, so SS remains the boundary for the keys it forwards. Document the bypass and its rationale. - spec.md, contracts/upstream-easycla-api.md: attribute GET /v4/my-clas/identities to #5128, not #5125 - docs/MY_CLAS_API.md: finish the Auth0 third-source update left incomplete in 42ff484 — the identities union is three sources, and numeric GitHub/GitLab IDs are verifiable against Auth0 linked identities, not only EasyCLA records Resolves 5 review threads. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Michal Lehotsky <[email protected]>
Signed-off-by: Łukasz Gryglicki [email protected]
Assisted by OpenAI
Assisted by GitHub Copilot
Assisted by Claude