fix: align id_token claims, surface mutation errors, drop dead user() (MAPPS-380) #440
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mapps-380-review-cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Three small, independent cleanups surfaced by a codebase and cross-app review, grouped into one PR (MAPPS-380).
Why
mokosh_roleandmokosh_active_tenant, but post-cutover bunyip-as-OP never emits either (it usesbunyip_roleand omits the active-tenant claim), so both always deserialized to None. The reads were dead weight and the surrounding comments misdescribed where role/tenant come from;/api/v1/auth/meis the source of truth for both (PMS-158).let _ =, so failures were silent: revoke-invitation, grant/revoke portal access, and mark-notification-read. A user whose action failed got no feedback.AuthContext::user()was a panic-only helper (.expect("User not authenticated")) with zero call sites.Changes
src/modules/oidc/tokens.rs: removed therole(mokosh_role) andactive_tenant_id(mokosh_active_tenant) fields fromIdTokenClaimsand documented on the struct why role/active-tenant are not read from the id_token. Thetenant_id(mokosh_tenant_id) read is unchanged.src/hooks/auth.rsandsrc/pages/auth_callback.rs: role now seedsUserRole::default()(Technician) and active-tenant seeds the home tenant, both reconciled by the post-login/rehydrate/api/v1/auth/mefetch; updated the adjacent comments and theAuthContext.active_tenant_iddoc that referenced the removed claim.src/pages/team.rs: the revoke-invitationDELETEnow matches theResultand sets the page error signal onErr(matching the invite-send path).src/pages/contacts.rs: the grant and revoke portal-accessPUTs now surface failures via an error toast instead of proceeding silently.src/components/layout.rs: the fire-and-forget mark-notification-readPOSTnow logs onErrviatracing::warn!.src/hooks/auth.rs: removed the dead panic-onlyAuthContext::user()helper.Tests
just pre-commitin the CI-matchingrust-builder-glibcimage:cargo fmt --all --checkpassed,cargo clippy --all-targets -- -D warningspassed,cargo check --target wasm32-unknown-unknownpassed,cargo test --lib= 223 passed / 0 failed. Overall exit 0.