Catalog: stop offering a refused Save for service users (5217 stack 6/9) - #5264
Catalog: stop offering a refused Save for service users (5217 stack 6/9)#5264nl0 wants to merge 6 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## stack/5217-5-admin-disabled-switch-reason #5264 +/- ##
=============================================================================
+ Coverage 35.70% 35.99% +0.29%
=============================================================================
Files 741 741
Lines 23823 23829 +6
Branches 6433 6434 +1
=============================================================================
+ Hits 8505 8577 +72
+ Misses 13577 13520 -57
+ Partials 1741 1732 -9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6600455 to
18807b2
Compare
18807b2 to
f9e4077
Compare
f9e4077 to
6b359d4
Compare
6b359d4 to
285bfcd
Compare
2498b4a to
4b958a8
Compare
Review pass on this layerLocal code review at high effort against this PR's own base ( Greptile has reviewed this content — its pass is the summary block in the description (confidence 5/5, no actionable regressions), with no review threads or inline comments, so there was nothing to reply to. Its last-reviewed commit predates the rebase, so I diffed the two: the reviewed commit's layer payload is line-for-line identical to head, i.e. it did review exactly what is here. No correctness bug was found in the layer. Accepted1 + 2 — the read-only predicate was duplicated, and the reason was derived separately (caf854d) The expression was written out twice, in 5 — the module stubs in the spec were dishonest (1e1ee82)
4 (in part) — the changelog over-claimed (fabdaf1) The entry said the change reads read-only "end to end". The Role column's signal is the Also addedThe service-user helper copy ("Roles for this service user are managed by the stack.") only became reachable in this layer — before it, the select was not disabled for that flag combination — and nothing pinned it. Both read-only cases now assert their cause, so the copy cannot drift from the predicate that selects it. Declined3 — add a 4 (in full) — make the Role column's read-only state non-mouse-only. Real, but pre-existing and wider than this layer: Verification
Both new assertions were checked to be load-bearing rather than decorative: reverting the resolver to the single flag fails exactly the two service-user cases, and mapping a service user to the SSO reason fails the new copy assertion. Layers 7–9 were rebased onto this branch in order and force-pushed with lease; each of #5265, #5266 and #5267 still shows only its own layer (5f/+200−20, 3f/+76−9, 15f/+524−45, unchanged). |
fabdaf1 to
ffde1c0
Compare
…ce users The roles dialog gated its title, its `RoleSelect` and its Save action on `isRoleAssignmentDisabled` alone. A service user with that flag unset therefore got a dialog headed "Assign roles to …", an assignable select and a live Save — a Save the registry refuses. The Role column's tooltip invited the edit on the same basis. One expression for both, derived from the pair rather than either flag: the registry couples them, but nothing here depends on that holding. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
addresses review finding f49 The Role column's half of this change was covered; the dialog's was not, and the dialog is where the Save the registry refuses used to be offered. `EditRoles` was unexported and `Users.spec.tsx` never rendered it, so the branch that decides whether there is a Save at all rested on reading. Export it and drive both flags through it: an SSO-managed user and a service user each get the read-only title and a Close with no Save; an ordinary user gets the assigning title and a Save. Checked against a version gated on `isRoleAssignmentDisabled` alone, which fails the service-user case. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
addresses review findings f44, f27 The read-only half of the Admin Users entry, citing the PR that ships it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The predicate was written out twice, in the dialog and in the Role column that opens it, each with a comment pointing at the other. The reason string was derived separately again, from isService alone, so a third cause joining readOnly would have disabled the select under the SSO copy. whyRoleReadOnly returns the cause; both sites take readOnly from whether there is one. Mirrors whyEnabledDisabled/whyAdminDisabled next door.
The service-user copy is only reachable since this layer disabled the select for them; nothing pinned it. Both read-only cases now assert their cause. The stubs replaced containers/Notifications and utils/GraphQL wholesale with one export each, so the next test in this file to touch useQueryS would fail with no hint the mock caused it. Spread the actual module, as the specs that stub react-router-dom do.
The Role column's read-only signal is the tooltip MUI seeds as a title, which is mouse-only, so the change is not end to end. State what it does.
ffde1c0 to
dac681d
Compare
Description
In Admin → Users, the roles dialog and the Role column offered an edit that
cannot happen. Both gated on
isRoleAssignmentDisabledalone, so a serviceuser with that flag unset got a dialog headed "Assign roles to …", an assignable
RoleSelect, and a live Save — a Save the registry refuses. The Role column'stooltip invited the click on the same basis.
Both now derive one
readOnlyfrom the pair. The registry couples these flags,but nothing here depends on that holding: refusing a service user is correct on
its own terms.
Why this is a real fix and not a claim about an unreachable state. It is worth
stating explicitly, because it was challenged and survived: before this change,
the dialog title,
RoleSelect.nonAssignableand the Save action all gated onisRoleAssignmentDisabledalone. A Save therefore was offered for any userwith
isService && !isRoleAssignmentDisabled. That combination is what the fixcloses, and the failure it produces is the worst kind — the Save submits unchanged
values and reports success, so the admin is told a change landed that did not.
Review findings addressed
dialog's was not, and the dialog is where the refused Save lived.
EditRoleswas unexported and never rendered by a test. It is exported for testing now, and
both flags are driven through it.
Recorded:
column did change too; both are in this PR.
above.
Verification
18 tests. The three new ones render
EditRolesdirectly; they were checkedagainst a version gated on
isRoleAssignmentDisabledalone, which fails theservice-user case.
Position in the stack
PR 6 of 9, based on
stack/5217-5-admin-disabled-switch-reason.Part of the split of #5217 asked for in
f27. PR 5
edits the same file; the two sets of hunks are disjoint and share no symbol, so
either order is correct and neither depends on the other's behaviour. They are
stacked rather than combined so that the accessibility fix and the permission fix
can be reviewed, and reverted, separately.
TODO
🤖 Generated with Claude Code
Greptile Summary
This PR makes service-user role management consistently read-only across the Admin Users role column and dialog.
Confidence Score: 5/5
The PR appears safe to merge with no actionable regressions identified.
The role column and dialog now share the same read-only condition, and the affected service-user, SSO-managed-user, and ordinary-user branches have focused render coverage.
Important Files Changed
Reviews (1): Last reviewed commit: "docs(changelog): entry for the service-u..." | Re-trigger Greptile