Server admin 19: fluxer-core identity check; delete community; transfer ownership #686

Closed
opened 2026-11-15 19:01:23 +00:00 by charles · 1 comment
Owner

Task 19 of the Server administration plan (docs/superpowers/plans/2026-11-15-serveradmin.md, section "### Task 19:"). The plan on the serveradmin branch is the source of truth; this copy is for reading.

Closes: —
Depends on: 11

Files:

  • Modify: crates/fluxer-core/src/admin/{sudo.rs,guild.rs}
  • Test: crates/fluxer-core/tests/admin_sudo.rs

Interfaces:

  • Produces: the sudo machine of spec §3.9 and §6.2 (feat/platform/transport/RestTransport.ts, feat/auth/state/SudoPrompt.tsx, feat/auth/components/modals/SudoVerificationModal.tsx): an ApiResult failing with SUDO_MODE_REQUIRED for a sudo-capable request opens SudoPrompt { request, methods } where methods comes from the account (Password when the user has no 2FA, Totp when they have an authenticator; neither → the original's "no supported methods" text); SudoAction::Submit(answer) re-sends the kept request with the answer attached and nothing kept; an INVALID_FORM_BODY naming a verification field shows that field's error and asks again, twice at most, then the action fails; Cancel fails it quietly; CoreEvent::SudoToken { valid_until } is remembered so the model can say whether a prompt is expected; logout clears everything. sudo::model(app) -> Option<SudoModel { title, method, error, submitting }> with the original's strings.

  • DeleteGuild → Confirm::DeleteGuild (the original's plain confirm, "I changed my mind"; feat/guild/components/modals/GuildDeleteModal.tsx) → DeleteGuild through sudo → GUILD_DELETE removes the guild (the existing reducer selects the DMs); guarded by the unsaved-changes flash. MemberAction::OpenTransfer / Transfer (feat/guild/components/modals/TransferOwnershipModal.tsx) → TransferOwnership through sudo → the answer and GUILD_UPDATE change owner_id; the settings re-gate. The Moderation form's mfa_level save goes through the same machine (Task 11's UpdateGuild is sudo-capable).

  • Step 1: Write failing tests: sudo_required_opens_prompt_with_the_request, method_by_account_2fa, no_method_text, submit_replays_request_with_answer, secret_not_in_state_after_submit (the whole App debug-printed and searched), wrong_password_reprompts_twice_then_fails, cancel_fails_quietly, token_event_remembered_and_cleared_on_logout, non_sudo_request_never_prompts, delete_guild_confirm_then_sudo_then_event, delete_guild_flashes_when_form_dirty, transfer_updates_owner_and_regates_settings, mfa_level_save_goes_through_sudo.

  • Step 2–5: FAIL → implement → PASS → commit feat(core): identity check, delete community, transfer ownership.

Task 19 of the Server administration plan (`docs/superpowers/plans/2026-11-15-serveradmin.md`, section "### Task 19:"). The plan on the `serveradmin` branch is the source of truth; this copy is for reading. **Closes:** — **Depends on:** 11 **Files:** - Modify: `crates/fluxer-core/src/admin/{sudo.rs,guild.rs}` - Test: `crates/fluxer-core/tests/admin_sudo.rs` **Interfaces:** - Produces: the sudo machine of spec §3.9 and §6.2 (`feat/platform/transport/RestTransport.ts`, `feat/auth/state/SudoPrompt.tsx`, `feat/auth/components/modals/SudoVerificationModal.tsx`): an `ApiResult` failing with `SUDO_MODE_REQUIRED` for a sudo-capable request opens `SudoPrompt { request, methods }` where `methods` comes from the account (`Password` when the user has no 2FA, `Totp` when they have an authenticator; neither → the original's "no supported methods" text); `SudoAction::Submit(answer)` re-sends the kept request with the answer attached and nothing kept; an `INVALID_FORM_BODY` naming a verification field shows that field's error and asks again, twice at most, then the action fails; `Cancel` fails it quietly; `CoreEvent::SudoToken { valid_until }` is remembered so the model can say whether a prompt is expected; logout clears everything. `sudo::model(app) -> Option<SudoModel { title, method, error, submitting }>` with the original's strings. - `DeleteGuild` → `Confirm::DeleteGuild` (the original's plain confirm, "I changed my mind"; `feat/guild/components/modals/GuildDeleteModal.tsx`) → `DeleteGuild` through sudo → `GUILD_DELETE` removes the guild (the existing reducer selects the DMs); guarded by the unsaved-changes flash. `MemberAction::OpenTransfer` / `Transfer` (`feat/guild/components/modals/TransferOwnershipModal.tsx`) → `TransferOwnership` through sudo → the answer and `GUILD_UPDATE` change `owner_id`; the settings re-gate. The Moderation form's `mfa_level` save goes through the same machine (Task 11's `UpdateGuild` is sudo-capable). - [ ] **Step 1: Write failing tests**: `sudo_required_opens_prompt_with_the_request`, `method_by_account_2fa`, `no_method_text`, `submit_replays_request_with_answer`, `secret_not_in_state_after_submit` (the whole `App` debug-printed and searched), `wrong_password_reprompts_twice_then_fails`, `cancel_fails_quietly`, `token_event_remembered_and_cleared_on_logout`, `non_sudo_request_never_prompts`, `delete_guild_confirm_then_sudo_then_event`, `delete_guild_flashes_when_form_dirty`, `transfer_updates_owner_and_regates_settings`, `mfa_level_save_goes_through_sudo`. - [ ] **Step 2–5:** FAIL → implement → PASS → commit `feat(core): identity check, delete community, transfer ownership`.
Author
Owner

From the review of Task 22 (PR #741): admin.sudo.token_valid_until can be stale (the runtime drops the token on SUDO_MODE_REQUIRED without telling the store). It must not be used to skip a prompt.

From the review of Task 22 (PR #741): admin.sudo.token_valid_until can be stale (the runtime drops the token on SUDO_MODE_REQUIRED without telling the store). It must not be used to skip a prompt.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#686
No description provided.