Server admin 4: fluxer-api community, roles and the sudo header #670

Closed
opened 2026-11-15 19:01:08 +00:00 by charles · 0 comments
Owner

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

Closes: —
Depends on: 1, 3

Files:

  • Create: crates/fluxer-api/src/roles.rs
  • Modify: crates/fluxer-api/src/{guilds.rs,client.rs,lib.rs}, README
  • Test: crates/fluxer-api/tests/{guild_admin.rs,roles.rs,sudo.rs}

Interfaces:

  • Consumes: Task 1 and 3 types.

  • Produces: update_guild(guild, &GuildUpdateRequest) -> Guild (PATCH /guilds/{id}), delete_guild(guild, &GuildDeleteRequest) (POST /guilds/{id}/delete), transfer_ownership(guild, &TransferOwnershipRequest) -> Guild, create_role, update_role, delete_role, update_role_positions(guild, &[RolePosition]) (PATCH /guilds/{id}/roles, 204).

  • The sudo header: ApiClient can be given a SudoToken (an opaque, non-Debug-printing newtype) that it sends as X-Fluxer-Sudo-Mode-JWT on the methods marked sudo-capable (the three above), and each of those returns the token the answer carried, if any (Sudo<T> { value: T, token: Option<SudoToken> }). The header name is api/middleware/SudoModeMiddleware.ts's. Neither the token nor a verification field is ever written to a log line or an error's Display.

  • Step 1: Write failing tests (wiremock): update_guild_patch_body_and_answer, delete_guild_is_post_delete, transfer_ownership_body, role_crud_paths_and_bodies, role_positions_204, sudo_required_maps_to_typed_error, sudo_header_sent_when_token_set_and_only_on_sudo_methods, sudo_token_read_from_answer, token_and_password_absent_from_debug_and_errors, missing_permissions_and_resource_locked_typed.

  • Step 2–5: FAIL → implement → PASS → commit feat(api): community settings, roles, sudo header.

Task 4 of the Server administration plan (`docs/superpowers/plans/2026-11-15-serveradmin.md`, section "### Task 4:"). The plan on the `serveradmin` branch is the source of truth; this copy is for reading. **Closes:** — **Depends on:** 1, 3 **Files:** - Create: `crates/fluxer-api/src/roles.rs` - Modify: `crates/fluxer-api/src/{guilds.rs,client.rs,lib.rs}`, README - Test: `crates/fluxer-api/tests/{guild_admin.rs,roles.rs,sudo.rs}` **Interfaces:** - Consumes: Task 1 and 3 types. - Produces: `update_guild(guild, &GuildUpdateRequest) -> Guild` (`PATCH /guilds/{id}`), `delete_guild(guild, &GuildDeleteRequest)` (`POST /guilds/{id}/delete`), `transfer_ownership(guild, &TransferOwnershipRequest) -> Guild`, `create_role`, `update_role`, `delete_role`, `update_role_positions(guild, &[RolePosition])` (`PATCH /guilds/{id}/roles`, 204). - The sudo header: `ApiClient` can be given a `SudoToken` (an opaque, non-`Debug`-printing newtype) that it sends as `X-Fluxer-Sudo-Mode-JWT` on the methods marked sudo-capable (the three above), and each of those returns the token the answer carried, if any (`Sudo<T> { value: T, token: Option<SudoToken> }`). The header name is `api/middleware/SudoModeMiddleware.ts`'s. Neither the token nor a verification field is ever written to a log line or an error's `Display`. - [ ] **Step 1: Write failing tests** (wiremock): `update_guild_patch_body_and_answer`, `delete_guild_is_post_delete`, `transfer_ownership_body`, `role_crud_paths_and_bodies`, `role_positions_204`, `sudo_required_maps_to_typed_error`, `sudo_header_sent_when_token_set_and_only_on_sudo_methods`, `sudo_token_read_from_answer`, `token_and_password_absent_from_debug_and_errors`, `missing_permissions_and_resource_locked_typed`. - [ ] **Step 2–5:** FAIL → implement → PASS → commit `feat(api): community settings, roles, sudo header`.
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#670
No description provided.