Fix SSS updates in optional mode#5092
Conversation
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
WalkthroughBoth ChangesSSS Unexpected-Status Guard in Both Backends
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the company sanctions screening flow (SSS) to treat non-clean/non-flagged SSS statuses as ambiguous, preventing optional-mode runs from accidentally clearing an existing SSS-origin block when SSS returns an unexpected status.
Changes:
- Treat unexpected SSS statuses as “no actionable live result”: block with an error when SSS is required; otherwise keep the persisted sanction decision.
- Ensure optional mode does not auto-clear an SSS-origin block (and in v2, also avoids caching) when SSS returns an ambiguous status.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cla-backend-legacy/internal/api/handlers.go | In optional mode, unexpected SSS statuses now return the persisted sanction decision (no auto-clear on ambiguous statuses). |
| cla-backend-go/v2/sign/service.go | Routes unexpected SSS statuses through complianceUnavailable(...) so optional mode honors persisted sanction state and avoids caching/clearing. |
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> 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.
🧹 Nitpick comments (1)
cla-backend-go/v2/sign/service_sss_test.go (1)
89-120: 🏗️ Heavy liftAdd one guard-path test through
checkCompanyCompliancefor unexpected SSS status.These tests validate
complianceUnavailableitself, but they don’t verify thatcheckCompanyComplianceactually routes ambiguous statuses into that path. A regression in the guard (service.go, Line 3077) could slip through while Lines 89-120 still pass.🤖 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/sign/service_sss_test.go` around lines 89 - 120, Add a new test function that verifies the integration path through the checkCompanyCompliance function (the guard at service.go Line 3077) when handling unexpected SSS status values. This test should call checkCompanyCompliance directly rather than testing complianceUnavailable in isolation, and should verify that ambiguous SSS statuses are properly routed to and handled by the complianceUnavailable path. This ensures that a regression in the guard routing logic would be caught, since the current tests only validate complianceUnavailable itself without verifying that checkCompanyCompliance actually invokes it correctly for unexpected status cases.
🤖 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.
Nitpick comments:
In `@cla-backend-go/v2/sign/service_sss_test.go`:
- Around line 89-120: Add a new test function that verifies the integration path
through the checkCompanyCompliance function (the guard at service.go Line 3077)
when handling unexpected SSS status values. This test should call
checkCompanyCompliance directly rather than testing complianceUnavailable in
isolation, and should verify that ambiguous SSS statuses are properly routed to
and handled by the complianceUnavailable path. This ensures that a regression in
the guard routing logic would be caught, since the current tests only validate
complianceUnavailable itself without verifying that checkCompanyCompliance
actually invokes it correctly for unexpected status cases.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6a281c0d-ce41-48f1-bb37-09d48a4046a7
📒 Files selected for processing (1)
cla-backend-go/v2/sign/service_sss_test.go
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io> Assisted by [OpenAI](https://platform.openai.com/) Assisted by [GitHub Copilot](https://github.com/features/copilot) Assisted by [Claude](https://claude.ai)
Signed-off-by: Lukasz Gryglicki lgryglicki@cncf.io
Assisted by OpenAI
Assisted by GitHub Copilot
Assisted by Claude