Repository navigation
Backport to 2.0: cap the approval threshold at the users able to vote - #37650
Conversation
Self-approval prevention removes the requester from the assignees, so a fixed threshold could exceed the remaining voters and leave the task open forever (e.g. owner + reviewer, threshold 2, reviewer made the change). Backport of #37648 to 2.0.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
With the requester removed, a rejection threshold above the remaining voters could never be met either, leaving a rejected task open.
| * An approval or rejection threshold never exceeds the number of users able to vote. The requester is removed from | ||
| * the assignees to prevent self-approval, so a node requiring two approvals from an owner and a | ||
| * reviewer would otherwise leave the task open forever when the reviewer made the change. A list | ||
| * holding a team is not capped, since any number of its members can vote. | ||
| * ADR:2026-11-12-approval-threshold-never-exceeds-eligible-voters |
There was a problem hiding this comment.
💡 Quality: Reworded Javadoc line exceeds 100 columns; spotless:check will fail
In the rewritten Javadoc for capAtUsersAbleToVote, line 1310 is now about 118 characters long. google-java-format reflows Javadoc to 100 columns, so mvn spotless:check will flag this file. The repo guidelines require mvn spotless:apply before merging, and this PR has skip-pr-checks, so CI may not catch it before merge. Run mvn spotless:apply -pl openmetadata-service or rewrap the comment by hand.
Rewrap the Javadoc to 100 columns (or run mvn spotless:apply).:
/**
* An approval or rejection threshold never exceeds the number of users able to vote. The
* requester is removed from the assignees to prevent self-approval, so a node requiring two
* approvals from an owner and a reviewer would otherwise leave the task open forever when the
* reviewer made the change. A list holding a team is not capped, since any number of its members
* can vote. ADR:2026-11-12-approval-threshold-never-exceeds-eligible-voters
*/
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 🔴 High risk 1 closed / 2 findingsCapping approval thresholds at eligible user assignees could let workflows advance with fewer independent approvals than configured. Caps the User Approval task threshold (and rejection threshold) at the number of assignees when all assignees are users, so tasks can no longer stay open when too few voters remain. Resolved the ADR referencing a nonexistent
💡 Quality: Reworded Javadoc line exceeds 100 columns; spotless:check will failIn the rewritten Javadoc for Rewrap the Javadoc to 100 columns (or run mvn spotless:apply).✅ 1 closed✅ Quality: ADR names CreateTask.resolveApprovalThreshold, which doesn't exist on 2.0
🤖 Prompt for agentsVerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Backport of #37648 to
2.0.A User Approval task could stay open forever when the approval threshold was higher than the number of users left to vote. A customer on 2.0.7 hit this: a data contract with one owner and one reviewer had threshold 2. When the reviewer made the change, self-approval prevention removed them from the assignees. After the owner approved, nobody was left to vote and the task stayed open.
The threshold is now capped at the number of assignees when every assignee is a user. A list holding a team, and an empty list, are not capped. The requester's change is not counted as an approval, because that would be self-approval. Details and rationale are in #37648 and
ADR:2026-11-12-approval-threshold-never-exceeds-eligible-voters.2.0 has no
resolveApprovalThreshold(added on 2.1 with theallAssigneesmode), so this addsCreateTask.capApprovalThresholdand applies it where the task'sapprovalThresholdvariable is set. Same rule, same decision record.The rejection threshold gets the same cap, so the one remaining voter can also reject. A split vote (two voters, thresholds 2/2, one approves and one rejects) can still leave a task open; that predates this change.
Limit: the cap applies when the task is created. Tasks that are already open keep their threshold.
Type of change:
Tests:
CreateTaskTest#approvalThresholdNeverExceedsTheUsersAbleToVotemvn test -pl openmetadata-service -Dtest=CreateTaskTest,UserApprovalTaskTeston this branch: 71/71 pass.Checklist:
docs/decisions/2026-11-12-approval-threshold-never-exceeds-eligible-voters.md.🤖 Generated with Claude Code