Skip to content

[M2.2b2] Persist users and bounded identity credentials - #42

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.2b2-identity-schema
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.2b2-identity-schema

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

Task

M2.2b2, part of #21. Depends on #41; base feat/m2.2b1-transactional-audit.

What changed and why

Add PostgreSQL users, browser sessions and single-use identity credentials. citext enforces case-insensitive email uniqueness; foreign keys bind credentials to their user. Database constraints prevent unknown account states/purposes, active unverified accounts, negative security versions, plaintext-shaped credential hashes and lifetimes beyond the specification. Indexes support credential lookup, revocation and expiry cleanup.

No account endpoint is exposed yet. The next PR adds repositories and command behavior on this schema.

Validation

  • Eleven integration tests pass against PostgreSQL 17, including five identity schema tests.
  • Identity tests independently cover duplicate emails, invalid account transitions, invalid token hashes/purposes/lifetimes, competing token consumers over separate connections, persistence after reconnect, session lifetime limits and credential cascades.
  • Migration application is repeated to verify the test migration runner remains idempotent.
  • Prisma client regenerated; workspace lint and type checks pass.

Security considerations

Only token hashes are stored. Session and identity credentials carry the user's security version so later commands can invalidate stale credentials on password or privilege changes. Runtime database mutations arrive in the following PR and will use the transaction/audit mechanism from #41. The migration adds tables without altering existing fleet or audit records.

Checklist

  • M2.2b2 acceptance met and checked in PLAN; M2.2 remains open
  • Lint, types and integration tests pass
  • Invalid-input and concurrency cases covered on real PostgreSQL
  • No new shell invocation or plaintext credential persistence
  • No runtime command introduced; audit will be enforced by command handlers
  • Data model follows SPEC 4 and identity limits from SPEC 8.1

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2b1-transactional-audit branch from f467fd5 to b791e52 Compare November 5, 2026 12:10
Base automatically changed from feat/m2.2b1-transactional-audit to main November 5, 2026 12:11
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2b2-identity-schema branch from 035182a to 2090cbd Compare November 5, 2026 12:11
@samuelmbabhazi
samuelmbabhazi merged commit 6cc9b5b into main Nov 5, 2026
9 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.2b2-identity-schema branch November 5, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant