Skip to content

Fixes #35869: Add tests for leaving a non-joinable team - #39677

Merged
sonika-shah merged 2 commits into
mainfrom
fix/35869-leave-nonjoinable-team
Dec 4, 2026
Merged

sonika-shah merged 2 commits into
mainfrom
fix/35869-leave-nonjoinable-team

Conversation

@sonika-shah

@sonika-shah sonika-shah commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #35869

The check itself is already on main: #36952 made a non-admin's team change count teams the user leaves as well as joins (changesClosedTeamMembership), and #38848 moved it into UserRepository and applied it to user CSV import. This PR adds the tests and the documentation the issue still asks for. No server code changes.

  • Tests (UserTeamAssignmentPrivilegeIT):
    • test_selfUpdate_cannotLeaveClosedTeam: a user swapping their closed team for an open one by PUT and by PATCH replace /teams gets 403, stays in the closed team, is not added to the open one, and keeps the team's default role.
    • test_selfUpdate_canLeaveOpenTeam: leaving an open team still works, by PUT and by PATCH remove.
    • test_adminRemoval_fromClosedTeam_stillWorks: an admin still removes a user from a closed team (PATCH) and moves one between closed teams (PUT).
    • The issue's exact steps (PATCH remove /teams/0) are already covered by UserResourceIT#test_nonAdmin_cannotLeaveClosedTeam.
  • isJoinable description (team.json, createTeam.json, teamHierarchy.json, openmetadata.ttl, generated TS): it said only "Can any user join this team during sign up?". It now reads: "Can users join or leave this team on their own? When false, only an admin (by editing the user) or someone allowed to edit the team's users (by editing the team) can add or remove members."
  • Decision record: adds the new tests to the record's Guard list (ADR:2026-10-30-only-admins-add-roles-or-policies-to-a-team, v4).

Type of change:

  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests around the new logic.

…dmin

Leaving a team that is not joinable already needs an admin on user PUT,
PATCH and CSV import (UserRepository.changesClosedTeamMembership). Add
the missing ITs: swapping a closed team for an open one by PUT and PATCH
is refused and keeps the team's default role, leaving an open team still
works, and an admin still removes a user from a closed team. Describe the
rule on isJoinable and record it in the closed-team decision record.
Copilot AI balanced review requested due to automatic review settings December 3, 2026 11:00

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 was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

On a team that is not joinable, members are added or removed by an admin
editing the user, or by anyone allowed to edit the team's users editing the
team. The description now says so. The decision record's v4 entry only adds
the new tests to its Guard list.
Copilot AI balanced review requested due to automatic review settings December 3, 2026 13:31

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 was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@sonika-shah sonika-shah changed the title Fixes #35869: Test and document that leaving a closed team needs an admin Fixes #35869: Add tests for leaving a non-joinable team Dec 3, 2026
@gitar-bot

gitar-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟢 Low risk

The added tests and clarified team-joinability descriptions document existing behavior; no production logic or access rules change.

Adds tests and documentation confirming that non-admin users cannot leave a closed team via PUT or PATCH on /teams, while leaving open teams and admin removals still work. Updates the isJoinable field description across the schema and generated files and amends the related ADR. No issues found.

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

@sonika-shah
sonika-shah merged commit 42bd0d1 into main Dec 4, 2026
36 checks passed
@sonika-shah
sonika-shah deleted the fix/35869-leave-nonjoinable-team branch December 4, 2026 13:08
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.1 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.0 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@gh-bot-collate

gh-bot-collate Bot commented Dec 4, 2026

Copy link
Copy Markdown

🤖 Backport to 2.1 opened as #39840. Claude resolved a cherry-pick conflict to build it. It merges itself once the checks pass, so read the diff now if this change is a sensitive one.

@gh-bot-collate

gh-bot-collate Bot commented Dec 4, 2026

Copy link
Copy Markdown

🤖 Backport to 2.0 opened as #39841. Claude resolved a cherry-pick conflict to build it. It merges itself once the checks pass, so read the diff now if this change is a sensitive one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Users can leave a team that is not joinable and escape the restrictions it gives them

3 participants