Skip to content

feat(admin): add protected account lifecycle endpoints - #149

Draft
n30nex wants to merge 5 commits into
MeshCore-Beacon:devfrom
n30nex:codex/beacon-account-api
Draft

n30nex wants to merge 5 commits into
MeshCore-Beacon:devfrom
n30nex:codex/beacon-account-api

Conversation

@n30nex

@n30nex n30nex commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Add authenticated account create/list/get/soft-deactivate routes for #60. Names are validated before storage, POST accepts one bounded JSON object containing only the name, and errors use Beacon's existing envelope without database details. All account routes remain inside BearerAuth with no-store responses; existing public reads and config inspection remain available as before.

Dependent draft: requires #146, #147 and storage PR #148. The branch reuses those prerequisites; this commit is the HTTP-only review delta. Rebase to accepted prerequisites before leaving draft.

Create returns 201, get/list return 200 and deactivation returns an empty 204. Duplicate active names and repeated deactivation return 409; missing accounts return 404. The record remains readable after deactivation and its name can be reused by a new account. These are operator records, not logins, sessions or token issuance. Runtime configuration writes remain separate #60 work.

Type of change

  • New feature
  • Tests
  • API documentation

Checklist

  • Build, format, vet and full Go tests pass
  • Request/error/auth tests added
  • Swagger regenerated with all operations, responses and security requirements
  • Storage migration/sqlc changes are the separate feat(db): add operator account lifecycle storage #148 prerequisite
  • No new dependency
  • CONTRIBUTING.md read

Testing notes

Local full checks and focused race checks pass. HTTP tests cover validated/trimmed names, malformed/extra/trailing JSON, body-size and media-type limits, missing/invalid IDs, error classification, error-detail suppression, empty/inactive lists, rejected anonymous access and top-level router wiring. Real PostgreSQL tests in #148 exercise concurrent create/deactivate and name reuse; native and exact-binary runtime evidence accompanies the combined preview.

Native candidate/combined full tests, CI and CodeQL pass. A temporary private instance of the exact combined binary passed create/read/list/deactivate/repeat/name-reuse and auth checks using an ephemeral key, without live MQTT. Its two test records, container and key file were removed; the key was absent from logs. The Canadaverse preview includes both candidates, with public admin access disabled and zero live account rows. Public account GET/POST/DELETE denial, ordinary API reads, WebSockets, both feeds and matching corresponding source pass. Existing schema objects were unchanged by the additive table migration.

AI-assisted implementation/testing under the contributor's standing authorization; no separate human review of this final diff is claimed.

@n30nex

n30nex commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

@MrAlders0n please review this change with your Claude agent as part of the September 13 Beacon review batch. The current candidate is 901ee773432f; validation and Pi evidence are in the PR description.

Early review is requested on the HTTP-only delta linked in the description. Keep this draft until #146, #147 and #148 are accepted and the branch is rebased. Please check auth, validation/status handling, duplicate active names and soft-deactivation behavior. Issue #60 remains open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant