Skip to content

Backport to 2.1: cap the approval threshold at the users able to vote - #37651

Merged
shah-harshit merged 4 commits into
2.1from
shah-harshit/approval-threshold-cap-2.1
Nov 12, 2026
Merged

shah-harshit merged 4 commits into
2.1from
shah-harshit/approval-threshold-cap-2.1

Conversation

@shah-harshit

@shah-harshit shah-harshit commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of #37648 to 2.1.

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.

Cherry-pick of both main commits, including the follow-up that also caps the change-request ReviewPolicy threshold.

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:

  • Bug fix

Tests:

  • CreateTaskTest#approvalThresholdNeverExceedsTheUsersAbleToVote, #changeRequestPolicyNeverRequiresMoreApprovalsThanTheUsersAbleToVote
  • mvn test -pl openmetadata-service -Dtest=CreateTaskTest,UserApprovalTaskTest on this branch: CreateTaskTest 86/86 pass.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Decision check: carries docs/decisions/2026-11-12-approval-threshold-never-exceeds-eligible-voters.md.

🤖 Generated with Claude Code

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.1.
@shah-harshit
shah-harshit requested a review from a team as a code owner November 12, 2026 09:40
@shah-harshit shah-harshit added the safe to test Add this label to run secure Github workflows on PRs label Nov 12, 2026
@shah-harshit
shah-harshit removed the request for review from a team November 12, 2026 09:40
@shah-harshit shah-harshit self-assigned this Nov 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

The review policy attached to a change request still carried the node
threshold, so the only eligible reviewer's approval read as a disagreement.
@shah-harshit shah-harshit added the skip-pr-checks Bypass PR metadata validation check label Nov 12, 2026
With the requester removed, a rejection threshold above the remaining
voters could never be met either, leaving a rejected task open.
@shah-harshit
shah-harshit enabled auto-merge (squash) November 12, 2026 10:29
@gitar-bot

gitar-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findings

Capping approval and change-request thresholds to eligible users could let governed changes proceed with fewer independent approvals.

Caps the User Approval task threshold at the number of assignees when all assignees are users, so tasks can no longer stay open when the threshold exceeds eligible voters. Also applies the same cap to the change-request ReviewPolicy threshold. Resolved the finding that the cap contradicted the ontology ADR's allAssignees threshold rule. No open issues found.

✅ 1 closed
✅ Quality: Cap contradicts the ontology ADR's allAssignees threshold rule

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTask.java:990-998 📄 openmetadata-service/src/test/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/CreateTaskTest.java:74-80 📄 docs/decisions/2026-11-12-approval-threshold-never-exceeds-eligible-voters.md:7 📄 docs/decisions/2026-11-12-approval-threshold-never-exceeds-eligible-voters.md:16-20
The Accepted record docs/decisions/2026-10-14-ontology-reviews-bind-workflow-tasks-to-revisions.md (v13 amendment, lines 86-89) says that under approvalMode=allAssignees, CreateTask sets the task's approvalThreshold to "the larger of the node's threshold and the number of assignee entries". This change breaks that rule. Under AllReviewers with only user entries, the threshold is now min(max(node, entries), entries), so a node threshold above the entry count is lowered to the entry count. The PR also deletes the test line that pinned the old behaviour (assertEquals(2, ...("allAssignees", 2, users(1)))), and CreateTaskTest is listed as a guard of that ADR.

The new ADR 2026-11-12-approval-threshold-never-exceeds-eligible-voters doesn't mention the ontology record, and the ontology record's Status still says Accepted with no successor. Two Accepted records now give different thresholds for the same case. Amend the ontology ADR (bump its revision) so it says something like: "under allAssignees the threshold is the larger of the node's threshold and the entry count, capped at the entry count when every entry is a user (ADR:2026-11-12-approval-threshold-never-exceeds-eligible-voters)". Also add a Related: link from the new record back to the ontology record.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@shah-harshit
shah-harshit merged commit 9478d64 into 2.1 Nov 12, 2026
60 checks passed
@shah-harshit
shah-harshit deleted the shah-harshit/approval-threshold-cap-2.1 branch November 12, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants