Skip to content

feat(db): add operator account lifecycle storage - #148

Open
n30nex wants to merge 1 commit into
MeshCore-Beacon:devfrom
n30nex:codex/beacon-account-storage
Open

n30nex wants to merge 1 commit into
MeshCore-Beacon:devfrom
n30nex:codex/beacon-account-storage

Conversation

@n30nex

@n30nex n30nex commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

What this PR does

Add the account-storage foundation for #60: an additive accounts table, active-name uniqueness, generated sqlc queries/mocks and a narrow AccountStore implementation. It is independent of pending authentication/API work and exposes no endpoint.

Names are trimmed, case-sensitive and limited to 128 Unicode characters without control characters. Deactivation preserves the row and timestamp; a later account can reuse the inactive name. Duplicate active names, absent IDs and repeated deactivation have distinct errors. A row-locking query makes concurrent deactivation return one success and one already-inactive outcome. The migration is retryable and creates no account data.

Type of change

  • New feature
  • Tests

Checklist

  • Build, format, vet and full Go tests pass
  • Pure validation/mapping tests added
  • Migration SQL and regenerated sqlc/mocks included
  • Swagger regeneration produces no change for this storage-only PR
  • No new dependency
  • CONTRIBUTING.md read

Testing notes

Native Pi 5/PostgreSQL 16 tests apply the migration twice and cover empty lists, Unicode/trimmed names, validation, case sensitivity, missing IDs, deactivation timestamp preservation, name reuse and deterministic lists. Eight concurrent creates yield one winner; repeated concurrent deactivation rounds yield one success each. Tests create and remove their own schema in the isolated test database. Full local/native checks and focused local race checks pass.

CI and CodeQL pass. The combined preview applied 034 with an empty accounts table, a valid partial unique index, and an unchanged schema dump for all pre-existing objects. The exact preceding binary also started and served its existing private test endpoints with the additive schema present; rollback retains the table and migration record. Account HTTP operations are the dependent draft #149.

AI-assisted implementation/testing under the contributor's standing authorization; submitted for review without claiming a new specific human diff review.

@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 88aeae1fe4da; validation and Pi evidence are in the PR description.

Please check migration 034, active-name uniqueness, soft deactivation and preserved records. This is storage for account API #149, and these records are not login principals. Issue #60 remains open for the full admin scope.

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