Server admin 35: Acceptance (#703) #791

Closed
charles wants to merge 0 commits from serveradmin-35-acceptance into serveradmin
Owner

Stacked on: serveradmin-34-parity-screenshots

What was built

  • apps/fluxer/tests/serveradmin_acceptance.rs: the whole client end to end on the devserver, driven by the actions of the core's menus, settings screens, modals, confirms and the identity-check modal; it asserts the store, the bodies the devserver accepted (and the sudo token each carried), the --record log, and the runtime's sudo token holder. Nine tests, split by area (one runtime each, ~6 s in all) so each stays within the scenario's scripted other-client timeline (90 s):
    • channels_as_owner: Edit channel from the channel menu (name, topic, slowmode: only the changed fields) → close while dirty flashes and stays → override for Helpers + VIEW_CHANNEL denied to @everyone (whole array) → Sync with category → drag #general below #announcements and into Quiet corner (one-element bodies, order kept after CHANNEL_UPDATE_BULK) → the scripted other client reorders (store follows) → duplicate and delete a channel.
    • roles_as_owner: create, rename, colour, MANAGE_MESSAGES, drag above Helpers, save (role PATCH, then positions without @everyone) → duplicate → delete.
    • members_as_owner: Roles ▸ tick/untick (#640), nickname, 10-minute timeout with reason, remove timeout, kick, ban 1 day / 1 hour (bodies asserted).
    • bans_and_invites_as_owner: ban details, revoke; invite revoke; pause and enable (features differ by exactly INVITES_DISABLED).
    • overview_as_owner: name, idle timeout, hide join messages, flexible names (one PATCH, only changed fields, features differ by exactly one name).
    • members_page_as_owner: indexing_first, page 2, role filter, search.
    • identity_check_as_owner: transfer ownership with the scenario password; delete a second community 4 minutes later with no prompt (held token sent, body {}); after the token's expiry a prompt, a wrong password first ("Invalid password."), then the right one.
    • logout_drops_the_sudo_token (from the review of Task 22): a token held by the real Runtime is gone right after UserAction::Logout; after logging in again a delete is asked again and sends no token.
    • moderator_sees_the_hierarchy: no Overview/Moderation/Invites tabs, Admins and Moderators locked, MANAGE_GUILD disabled with "You cannot grant a permission you don't have", no rows for grace (above), a forced ToggleRole of Admins refused MISSING_PERMISSIONS, reverted, with the original's text.
    • Every test checks that its recording holds no typed password, code or sudo token and that every password / mfa_code field is <redacted>.
  • docs/acceptance/serveradmin.md: spec §2 item by item (what is automated, where), Charles's live checklist against Electron on a throwaway community, open question and follow-up issues, known gaps (§13, §14), sub-project 10 (§16).

How it was tested

  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally (Linux). The acceptance suite was run 8 times in a row, green after the two races below were fixed.
  • Not run: FLUXER_DESKTOP_TESTS and FLUXER_LIVEKIT_TESTS tests (none of this task needs them); nothing against the live server or Electron.

Deviations from the plan

  • Outside the Files list: fixtures/scenarios/serveradmin_acceptance.toml plus fixtures/serveradmin/{throwaway,scratch}_guild.json (READY guilds shaped as dailyuse/lounge_guild.json): the serveradmin scenario has only one community the user owns, so "transfer, then delete a second community" (twice: within and after 4.5 minutes) needed two more. Other scenarios are untouched.
  • Outside the Files list: apps/fluxer/src/runtime.rs gains Runtime::with_sudo_tokens(SudoTokens) (doc-hidden, for tests): the runtime's token holder on a clock the test moves, so the expiry is not waited for in real time and a logout through the real Runtime can be seen to drop the token.
  • The plan's single run is split into nine tests by area (reason above); "#random" is #announcements (the scenario has no #random); the moderator's "test hook" is the ToggleRole action sent directly, as a stale menu would.
  • Never uses admin.sudo.token_valid_until to skip the prompt: "no second prompt" is shown by the delete completing without any Submit and by the held token on the accepted request; the tests only sync on the store's own state and on the runtime's holder.
  • Found while writing it: #788 (the tmpVisit invite fixture expired on 2026-11-16, so the Invites tab lists 2 of 3); the test does not depend on the count.

Closes #703

🤖 Generated with Claude Code

https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K

Stacked on: serveradmin-34-parity-screenshots ## What was built - `apps/fluxer/tests/serveradmin_acceptance.rs`: the whole client end to end on the devserver, driven by the actions of the core's menus, settings screens, modals, confirms and the identity-check modal; it asserts the store, the bodies the devserver accepted (and the sudo token each carried), the `--record` log, and the runtime's sudo token holder. Nine tests, split by area (one runtime each, ~6 s in all) so each stays within the scenario's scripted other-client timeline (90 s): - `channels_as_owner`: Edit channel from the channel menu (name, topic, slowmode: only the changed fields) → close while dirty flashes and stays → override for Helpers + VIEW_CHANNEL denied to @everyone (whole array) → Sync with category → drag #general below #announcements and into Quiet corner (one-element bodies, order kept after CHANNEL_UPDATE_BULK) → the scripted other client reorders (store follows) → duplicate and delete a channel. - `roles_as_owner`: create, rename, colour, MANAGE_MESSAGES, drag above Helpers, save (role PATCH, then positions without @everyone) → duplicate → delete. - `members_as_owner`: Roles ▸ tick/untick (#640), nickname, 10-minute timeout with reason, remove timeout, kick, ban 1 day / 1 hour (bodies asserted). - `bans_and_invites_as_owner`: ban details, revoke; invite revoke; pause and enable (features differ by exactly INVITES_DISABLED). - `overview_as_owner`: name, idle timeout, hide join messages, flexible names (one PATCH, only changed fields, features differ by exactly one name). - `members_page_as_owner`: `indexing_first`, page 2, role filter, search. - `identity_check_as_owner`: transfer ownership with the scenario password; delete a second community 4 minutes later with no prompt (held token sent, body `{}`); after the token's expiry a prompt, a wrong password first ("Invalid password."), then the right one. - `logout_drops_the_sudo_token` (from the review of Task 22): a token held by the real Runtime is gone right after `UserAction::Logout`; after logging in again a delete is asked again and sends no token. - `moderator_sees_the_hierarchy`: no Overview/Moderation/Invites tabs, Admins and Moderators locked, MANAGE_GUILD disabled with "You cannot grant a permission you don't have", no rows for grace (above), a forced ToggleRole of Admins refused MISSING_PERMISSIONS, reverted, with the original's text. - Every test checks that its recording holds no typed password, code or sudo token and that every `password` / `mfa_code` field is `<redacted>`. - `docs/acceptance/serveradmin.md`: spec §2 item by item (what is automated, where), Charles's live checklist against Electron on a throwaway community, open question and follow-up issues, known gaps (§13, §14), sub-project 10 (§16). ## How it was tested - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally (Linux). The acceptance suite was run 8 times in a row, green after the two races below were fixed. - Not run: `FLUXER_DESKTOP_TESTS` and `FLUXER_LIVEKIT_TESTS` tests (none of this task needs them); nothing against the live server or Electron. ## Deviations from the plan - Outside the Files list: `fixtures/scenarios/serveradmin_acceptance.toml` plus `fixtures/serveradmin/{throwaway,scratch}_guild.json` (READY guilds shaped as `dailyuse/lounge_guild.json`): the serveradmin scenario has only one community the user owns, so "transfer, then delete a second community" (twice: within and after 4.5 minutes) needed two more. Other scenarios are untouched. - Outside the Files list: `apps/fluxer/src/runtime.rs` gains `Runtime::with_sudo_tokens(SudoTokens)` (doc-hidden, for tests): the runtime's token holder on a clock the test moves, so the expiry is not waited for in real time and a logout through the real Runtime can be seen to drop the token. - The plan's single run is split into nine tests by area (reason above); "#random" is #announcements (the scenario has no #random); the moderator's "test hook" is the ToggleRole action sent directly, as a stale menu would. - Never uses `admin.sudo.token_valid_until` to skip the prompt: "no second prompt" is shown by the delete completing without any Submit and by the held token on the accepted request; the tests only sync on the store's own state and on the runtime's holder. - Found while writing it: #788 (the `tmpVisit` invite fixture expired on 2026-11-16, so the Invites tab lists 2 of 3); the test does not depend on the count. Closes #703 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
`serveradmin.toml` plus "Throwaway" and "Scratch", empty communities owned by the user, so
that the acceptance run can transfer Forked and then delete a community twice (within the
sudo token's 4.5 minutes, and after them).

Fixtures shaped like the server: each guild file is a READY guild as
`fixtures/dailyuse/lounge_guild.json` and `dailyuse/big_guild.json` (`properties` a
GuildResponse, packages/schema/src/domains/guild/GuildResponseSchemas.ts; roles a
GuildRoleResponse, GuildRoleSchemas.ts; members `{user: {id}}` with the READY member fields,
GuildMemberSchemas.ts; channels as ChannelResponse), checked by the devserver against the
client's READY types when the scenario loads.

Refs #703

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
apps/fluxer/tests/serveradmin_acceptance.rs runs the whole client against the devserver's
serveradmin, serveradmin_acceptance and serveradmin_moderator scenarios, driven by the
actions of the menus and settings screens, and checks the store, the bodies the devserver
accepted, the sudo token each carried and the --record output (no password, code or token).

`Runtime::with_sudo_tokens` (doc-hidden, for tests) hands the runtime a SudoTokens on a
clock the test moves, so the 4.5-minute expiry is tested without waiting, and so that a
logout through the real runtime is seen to drop the token (review of Server admin 22).

Refs #703

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
What the automated suite covers for each item of spec §2, Charles's live checklist against
an Electron client on a throwaway community, the open question and follow-up issues, the
known gaps of spec §13 and §14, and what sub-project 10 takes (spec §16).

Refs #703

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Author
Owner

Independent review: Task 35 (acceptance)

Reviewed git diff 5645094..origin/serveradmin-35-acceptance (ac21d1f0) cold.

Plan steps. I checked every step against serveradmin_acceptance.rs:

  • Channels: the PATCH carries exactly {name, topic, rate_limit_per_user}. Closing while dirty flashes and the screen stays. The overrides PATCH carries the whole array, only that key, and READY's overrides carried along. "Sync with category" works. The drag after #announcements and into Quiet corner sends a one-element body (id, parent_id, preceding_sibling_id), and the order holds after CHANNEL_UPDATE_BULK. The other client's reorder is followed. Duplicate and delete work.
  • Roles: the POST sends {"name":"New role"}. The role PATCH comes before the positions PATCH, and @everyone is left out. Duplicate and delete work through the confirm.
  • Members: role tick and untick, nickname, a 10-minute timeout with a reason, its removal, kick, and a 1-day ban with 3600 s deleted. The bodies are asserted.
  • Bans and invites: details, revoke, invite revoke, pause and enable. The features list differs by exactly one name.
  • Overview: the PATCH keys are exactly {afk_timeout, features, name, system_channel_flags}, with one feature added.
  • Members page: indexing_first, page 2 at offset 25, role filter, search.
  • Identity check: transfer with the password replays the request plus password. The delete at +240 s sends the held token with no prompt. After +270 s comes a prompt, a wrong password ("Invalid password.", attempts == 1), then success with no token sent.
  • Logout: the token is dropped, and the next session is asked again.
  • Moderator: no Overview, Moderation or Invites tabs. Roles at or above the user are locked. MANAGE_GUILD is disabled with "You cannot grant a permission you don't have". No moderation rows for a member above (only "Roles ▸", as in the original's GuildMemberContextMenu, where it is gated only on MANAGE_ROLES). The forced ToggleRole is refused, reverts, and shows the original's text.
  • The recording check runs on every test.
  • The doc covers §2 items 1–12, the live checklist, questions and follow-ups, §13, §14 and §16.

Interfaces. Task 35 has none. Runtime::with_sudo_tokens is a #[doc(hidden)] builder in a registration file (runtime.rs). It defaults to SudoTokens::default(), so production behaviour is unchanged.

Invariants. No core or UI changes and no secrets in fixtures. The new guild fixtures have the same shape as serveradmin_ready.json and dailyuse/big_guild.json. The scenario's [dailyuse].guilds list keeps "Big".

Parity spot-checks (fluxer-soundboard):

  • "Verify it's you" matches SudoVerificationModal.tsx:76.
  • "You cannot grant a permission you don't have" and "New role" match GuildRolesTab.tsx:100,73.
  • permissions.missing_permissions matches ErrorI18nMessages.ts:594.
  • The ban body {delete_message_seconds, reason, ban_duration_seconds} matches GuildCommands.ts banMemberRequest.
  • The one-element move with preceding_sibling_id matches channelMovePayload.

Findings

  • minor: assert_recording_is_clean searches the recording text for the wrong password and the sudo tokens, and checks that top-level password/mfa_code fields are redacted. It never searches the text for the accepted password (DEMO_PASSWORD), so a leak of it in a nested or renamed field would not be caught. Suggest adding !text.contains(DEMO_PASSWORD).
  • minor: in moderator_sees_the_hierarchy, the check that Admins is shown unticked and disabled sits inside if let MenuItemKind::Submenu, so it would pass silently if "Roles ▸" stopped being a submenu.
  • minor: no MFA-code path is exercised end to end, so "no code in the recording" is covered only by the redaction check on the field. Spec §2 item 11's 2FA variant is left to the live checklist, which is acceptable.

Gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree reported "all steps passed". The serveradmin_acceptance suite passed 9 of 9 in 5.46 s.

Verdict: APPROVED (0 blocking, 3 minor).

## Independent review: Task 35 (acceptance) Reviewed `git diff 5645094..origin/serveradmin-35-acceptance` (ac21d1f0) cold. **Plan steps.** I checked every step against `serveradmin_acceptance.rs`: - Channels: the PATCH carries exactly `{name, topic, rate_limit_per_user}`. Closing while dirty flashes and the screen stays. The overrides PATCH carries the whole array, only that key, and READY's overrides carried along. "Sync with category" works. The drag after #announcements and into Quiet corner sends a one-element body (`id`, `parent_id`, `preceding_sibling_id`), and the order holds after `CHANNEL_UPDATE_BULK`. The other client's reorder is followed. Duplicate and delete work. - Roles: the POST sends `{"name":"New role"}`. The role PATCH comes before the positions PATCH, and @everyone is left out. Duplicate and delete work through the confirm. - Members: role tick and untick, nickname, a 10-minute timeout with a reason, its removal, kick, and a 1-day ban with 3600 s deleted. The bodies are asserted. - Bans and invites: details, revoke, invite revoke, pause and enable. The features list differs by exactly one name. - Overview: the PATCH keys are exactly `{afk_timeout, features, name, system_channel_flags}`, with one feature added. - Members page: `indexing_first`, page 2 at offset 25, role filter, search. - Identity check: transfer with the password replays the request plus `password`. The delete at +240 s sends the held token with no prompt. After +270 s comes a prompt, a wrong password ("Invalid password.", attempts == 1), then success with no token sent. - Logout: the token is dropped, and the next session is asked again. - Moderator: no Overview, Moderation or Invites tabs. Roles at or above the user are locked. MANAGE_GUILD is disabled with "You cannot grant a permission you don't have". No moderation rows for a member above (only "Roles ▸", as in the original's `GuildMemberContextMenu`, where it is gated only on MANAGE_ROLES). The forced ToggleRole is refused, reverts, and shows the original's text. - The recording check runs on every test. - The doc covers §2 items 1–12, the live checklist, questions and follow-ups, §13, §14 and §16. **Interfaces.** Task 35 has none. `Runtime::with_sudo_tokens` is a `#[doc(hidden)]` builder in a registration file (`runtime.rs`). It defaults to `SudoTokens::default()`, so production behaviour is unchanged. **Invariants.** No core or UI changes and no secrets in fixtures. The new guild fixtures have the same shape as `serveradmin_ready.json` and `dailyuse/big_guild.json`. The scenario's `[dailyuse].guilds` list keeps "Big". **Parity spot-checks** (fluxer-soundboard): - "Verify it's you" matches `SudoVerificationModal.tsx:76`. - "You cannot grant a permission you don't have" and "New role" match `GuildRolesTab.tsx:100,73`. - `permissions.missing_permissions` matches `ErrorI18nMessages.ts:594`. - The ban body `{delete_message_seconds, reason, ban_duration_seconds}` matches `GuildCommands.ts banMemberRequest`. - The one-element move with `preceding_sibling_id` matches `channelMovePayload`. **Findings** - minor: `assert_recording_is_clean` searches the recording text for the wrong password and the sudo tokens, and checks that top-level `password`/`mfa_code` fields are redacted. It never searches the text for the accepted password (`DEMO_PASSWORD`), so a leak of it in a nested or renamed field would not be caught. Suggest adding `!text.contains(DEMO_PASSWORD)`. - minor: in `moderator_sees_the_hierarchy`, the check that Admins is shown unticked and disabled sits inside `if let MenuItemKind::Submenu`, so it would pass silently if "Roles ▸" stopped being a submenu. - minor: no MFA-code path is exercised end to end, so "no code in the recording" is covered only by the redaction check on the field. Spec §2 item 11's 2FA variant is left to the live checklist, which is acceptable. **Gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree reported "all steps passed". The serveradmin_acceptance suite passed 9 of 9 in 5.46 s. **Verdict: APPROVED** (0 blocking, 3 minor).
Author
Owner

Merged into serveradmin by hand (the merge API returns 405); the commits are in the branch.

Merged into `serveradmin` by hand (the merge API returns 405); the commits are in the branch.
charles closed this pull request 2026-11-17 21:52:14 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.