Repository navigation
fix(company): return 404 when a CLA group's project is gone - #5222
Conversation
GET /v4/company/{companyID}/project/{projectSFID}/cla-managers answered
400 for every service error, including the project service reporting
that the project no longer exists. Callers could not tell that case
apart from a real bad request, so LFX Self Serve had no safe way to fall
back to the CLA-group manager list.
- Map a project-service GetProjectNotFound (wrapped or not) to the 404
the swagger already declares for this route; the permission check
still runs first
- Keep every other service error at 400
- Cover success, project-not-found, wrapped not-found, other failure,
and forbidden-before-lookup in handler tests
Refs linuxfoundation/lfx-self-serve#2953
Signed-off-by: ahmedomosanya <aopeyemi@contractor.linuxfoundation.org>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (2)
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. WalkthroughThe company project CLA-managers handler now returns 404 for project-service project-not-found errors. Other service errors retain the existing 400 response path. Tests cover successful lookup, error cases, and permission denial before lookup. ChangesCompany project CLA managers
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Missing projects now return 404 so clients can use their intended fallback, while other failures remain distinguishable. No actionable merge-blocking risk was identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation matches the existing API contract and includes appropriate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Returns the documented 404 when a project-service lookup fails because the project is missing.
Changes:
- Detects direct and wrapped project-not-found errors.
- Preserves permission-first behavior and existing 400 handling.
- Adds handler coverage for success, authorization, and error paths.
| File | Description |
|---|---|
cla-backend-go/v2/company/handlers.go |
Maps project-service not-found errors to HTTP 404. |
cla-backend-go/v2/company/handlers_test.go |
Tests status mapping and permission ordering. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
This looks like the test account or its credentials being refused by Auth0 (blocked user, rotated password, or grant setting), so it likely needs someone with access to the DEV Auth0 tenant to check. |
lukaszgryglicki
left a comment
There was a problem hiding this comment.
LGTM: permission check stays first, errors.As catches direct and wrapped project-service NotFound, swagger already declares 404, handler tests pass locally on the PR head; the Cypress failure is the known flaky run against the deployed dev API.
|
That cypress failure happened before (many times) and it seems to be related to cypress itself - the next day it just works OK and all same failures are green then. |
GET /v4/company/{companyID}/project/{projectSFID}/cla-managersnow returns 404 when the project service reports the CLA Group's project no longer exists, instead of the generic 400. The permission check still runs first, and every other error stays 400. The swagger already declared this 404, so there is no API contract change.This lets LFX Self Serve fall back to the CLA-group manager list for these CLA Groups without treating genuine bad requests the same way.
Refs linuxfoundation/lfx-self-serve#2953