Repository navigation
Description
Area / route
Projects → Overview → Sharing. /dashboard/{org}/projects/{projectId} — services/platform/app/features/projects/components/project-sharing-section.tsx (+ server services/platform/convex/projects/mutations.ts::updateProjectSharing).
Steps to reproduce
- As an org admin/owner, open a project owned by Team A that is also shared with Team B (
teamId = A,sharedWithTeamIds = [B]). - In the Sharing section, change the "Owning team" Select from Team A to "Org-wide".
- Confirm the narrowing-warning dialog (it appears because Team A loses access).
Expected
Either the project genuinely becomes org-wide (sharedWithTeamIds cleared so getProjectTeamIds returns []), OR the still-shared teams stay visible/removable so the admin can see and edit the real audience. The displayed Visibility must match effective access.
Actual
handleOwningTeamChange computes nextShared = sharedWithTeamIds.filter(id => id !== nextOwningTeam). Going org-wide makes nextOwningTeam = null, and null is never an element of the shared array, so no shared team is dropped. It saves { teamId: null, sharedWithTeamIds: [B] }. The server stores this verbatim (teamId cleared, sharedWithTeamIds = [B]) — validateSharing only rejects when the owning team is in the shared list, which no longer applies. So getProjectTeamIds() returns [B] and isOrgWideProject is false: the project is actually restricted to Team B (plus admins), not org-wide.
On the re-rendered Sharing section the Select shows value = teamId ?? NONE_OWNING_TEAM = "Org-wide", and the "Also shared with" multiselect is hidden because its render guard is teamId && shareableTeams.length > 0 (now undefined && … → falsy). The admin sees "Org-wide" selected with no control to view or remove Team B. Meanwhile the project overview header and the projects table both compute teamCount = (teamId?1:0) + sharedWithTeamIds.length = 1 and show "1 team". The Sharing Select silently contradicts the overview/table, effective access disagrees with the displayed Visibility, and the orphaned share can never be cleared through the UI.
Evidence (verified)
services/platform/app/features/projects/components/project-sharing-section.tsx:142-145—sharedWithTeamIds.filter(id => id !== nextOwningTeam)never drops a shared team whennextOwningTeamisnull(org-wide).:197—value={teamId ?? NONE_OWNING_TEAM}renders "Org-wide" onceteamIdis cleared.:203— multiselect guardteamId && shareableTeams.length > 0hides the "Also shared with" control (and thus Team B) whenteamIdis null/undefined.services/platform/convex/projects/mutations.ts:539-571—updateProjectSharingpatchesteamId=undefinedandsharedWithTeamIds=[B]verbatim; no normalization clearing shares when going org-wide.services/platform/convex/projects/mutations.ts:245-260—validateSharingonly rejects when the owning team appears in the shared list; passes here.services/platform/convex/projects/access.ts:36-49,54-55—getProjectTeamIdsreturns[B]andisOrgWideProjectisfalsewith no owning team, so access is restricted to Team B.services/platform/app/features/projects/components/project-overview.tsx:157-158,175-178andprojects-table.tsx:135— both show "1 team", contradicting the "Org-wide" Select.
Notes
Two-part fix candidate: (1) When nextOwningTeam === null, clear sharedWithTeamIds to genuinely make the project org-wide (and/or have the server normalize: dropping the owning team without re-targeting shares is the ambiguous case). (2) Show the "Also shared with" audience even when org-wide so any remaining shares are visible and removable. The narrowing-confirmation dialog already fires correctly here (Team A losing access is detected), but the post-confirm result is the buggy orphaned state.
Filed by an automated manual-review pass (live browser QA + a 25-agent code-grounded audit, each finding adversarially verified). Deduped against open issues (incl. #1972–#1999, settings/forms epic #1941–#1966, audit cluster #1842–#1846) and recently-closed issues.
Activity
fix(platform): clear orphaned sharedWithTeamIds when a project goes o…