Skip to content

Fix: re-adding a removed approval doesn't restore a not uuthorized acknowledgment SS #2980 - #5231

Merged
lukaszgryglicki merged 1 commit into
devfrom
unicron-2980-3008
Sep 30, 2026
Merged

lukaszgryglicki merged 1 commit into
devfrom
unicron-2980-3008

Conversation

@lukaszgryglicki

@lukaszgryglicki lukaszgryglicki commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

…knowledgment SS #2980

Signed-off-by: Łukasz 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)
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 24bf5f38-e708-4c86-89b6-b9739b2eac34

📥 Commits

Reviewing files that changed from the base of the PR and between d0601e9 and ecb342e.

📒 Files selected for processing (12)
  • cla-backend-go/signatures/approval_list_readd_criteria_test.go
  • cla-backend-go/signatures/approval_list_readd_e2e_test.go
  • cla-backend-go/signatures/approval_list_readd_test.go
  • cla-backend-go/signatures/approval_list_readd_unit_test.go
  • cla-backend-go/signatures/approval_list_removal_test.go
  • cla-backend-go/signatures/dbmodels.go
  • cla-backend-go/signatures/mocks/mock_repo.go
  • cla-backend-go/signatures/repository.go
  • cla-backend-go/signatures/service.go
  • cla-backend-go/v2/cla_manager/designee_test.go
  • cla-backend-go/v2/cla_manager/service.go
  • docs/M3_ORG_LENS_API.md

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

The pull request adds recovery of eligible employee acknowledgments when approval-list entries are re-added. It also corrects designee role detection when no project scope contains the role.

Changes

Approval-list recovery

Layer / File(s) Summary
Find eligible removal-invalidated acknowledgments
cla-backend-go/signatures/dbmodels.go, cla-backend-go/signatures/repository.go, cla-backend-go/signatures/approval_list_removal_test.go, cla-backend-go/signatures/approval_list_readd_unit_test.go
The repository finds signed employee acknowledgments whose invalidation is attributable only to approval-list removal. It uses paginated index queries and consistent batched reads, retrying unprocessed keys. The model also recognizes legacy removal notes.
Restore acknowledgments with conditional writes
cla-backend-go/signatures/repository.go, cla-backend-go/signatures/approval_list_readd_unit_test.go, cla-backend-go/signatures/approval_list_readd_criteria_test.go
The repository re-reads each candidate and restores it only if it still matches the snapshot and removal-only criteria. Conditional conflicts leave the record unchanged.
Integrate recovery into approval-list updates
cla-backend-go/signatures/service.go, cla-backend-go/signatures/mocks/mock_repo.go, cla-backend-go/signatures/approval_list_readd_*.go, docs/M3_ORG_LENS_API.md
UpdateApprovalList checks newly effective additions, re-evaluates when the persisted list changes, and records recovery failures while continuing other side effects. Tests cover matching, concurrent changes, scale, and end-to-end behavior. The API documentation describes the recovery behavior.

Designee role detection

Layer / File(s) Summary
Return false when no project has the designee role
cla-backend-go/v2/cla_manager/service.go, cla-backend-go/v2/cla_manager/designee_test.go
The service no longer sets hasRole to true when no project scope contains the role. Tests cover role presence, absence, missing mappings, and lookup failures.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant UpdateApprovalList
  participant SignatureRepository
  participant UserLookup
  participant GitHubOrganizationLookup
  UpdateApprovalList->>SignatureRepository: Load removal-invalidated employee acknowledgments
  UpdateApprovalList->>UserLookup: Resolve candidate acknowledgment users
  UpdateApprovalList->>GitHubOrganizationLookup: Check organization membership when required
  UpdateApprovalList->>SignatureRepository: Re-read corporate signature and restore eligible acknowledgment
Loading

Merge Risk: ⚪ Minimal · up to ecb34

Re-adding approval-list entries restores acknowledgments that were invalidated only by the earlier removal. Deliberate invalidations remain unchanged. The fix also stops reporting a designee role when no project grants one. No outstanding issues were found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 48.98% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 11 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title identifies the main change: preventing an unauthorized acknowledgment from being restored when a removed approval is re-added. It contains a typographical error, but remains related and unde…
Description check ✅ Passed The description references the issues addressed by the pull request and is therefore related to the changeset, despite providing limited implementation detail.
Full details: Docstring Coverage

Explanation

Docstring coverage is 48.98% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 49 functions across 11 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

Copilot review overview

🟡 Changes recommended

Restoration remains vulnerable to a concurrent Approval List removal and does not recover GitLab-group-only acknowledgments.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Restores removal-invalidated employee acknowledgments when matching Approval List entries are re-added, and fixes CLA Manager designee detection.

Changes:

  • Adds guarded acknowledgment restoration with strong reads and conditional writes.
  • Adds comprehensive restoration and concurrency tests.
  • Corrects false-positive CLA Manager designee results.
File Description
docs/​M3_ORG_LENS_API.md Documents restoration behavior and limitations.
cla-backend-go/​v2/​cla_manager/​service.go Fixes designee-role fallback result.
cla-backend-go/​v2/​cla_manager/​designee_test.go Tests designee-role resolution.
cla-backend-go/​signatures/​service.go Orchestrates acknowledgment restoration.
cla-backend-go/​signatures/​repository.go Adds candidate reads and conditional restores.
cla-backend-go/​signatures/​mocks/​mock_repo.go Regenerates repository mocks.
cla-backend-go/​signatures/​dbmodels.go Classifies removal-only invalidations.
cla-backend-go/​signatures/​approval_list_removal_test.go Extends the DynamoDB test harness.
cla-backend-go/​signatures/​approval_list_readd_unit_test.go Tests restoration helpers and repository behavior.
cla-backend-go/​signatures/​approval_list_readd_test.go Provides shared restoration fixtures.
cla-backend-go/​signatures/​approval_list_readd_e2e_test.go Tests end-to-end re-add recovery.
cla-backend-go/​signatures/​approval_list_readd_criteria_test.go Tests criteria, scale, and races.
Files not reviewed (1)
  • cla-backend-go/signatures/mocks/mock_repo.go: Generated file

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

Comment thread cla-backend-go/signatures/service.go
Comment thread cla-backend-go/signatures/service.go
@lukaszgryglicki
lukaszgryglicki merged commit 1bebe39 into dev Sep 30, 2026
9 of 10 checks passed
@lukaszgryglicki
lukaszgryglicki deleted the unicron-2980-3008 branch September 30, 2026 14:01

This branch had an error being deployed

1 failed deployment
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.

BUG: Re-adding a removed Approval List entry doesn't restore a Not Authorized acknowledgment

3 participants