Skip to content

fix(db): normalize conversation membership - #168

Merged
KIDA-MNESIA merged 1 commit into
yetone:mainfrom
KIDA-MNESIA:codex/ar-h3-normalize-conversation-members
Sep 2, 2026
Merged

fix(db): normalize conversation membership#168
KIDA-MNESIA merged 1 commit into
yetone:mainfrom
KIDA-MNESIA:codex/ar-h3-normalize-conversation-members

Conversation

@KIDA-MNESIA

Copy link
Copy Markdown
Collaborator

Summary

  • fix AR-H3 by making tenant-constrained conversation_members rows the sole authorization and routing source while retaining conversations.members only as a rebuildable API projection
  • serialize invite, leave, kick, onboarding, and conversation creation with participant and conversation locks; commit membership, audit message, sequence, and realtime outbox changes in one PostgreSQL transaction
  • migrate production membership queries away from JSONB containment, add a source guard plus two-client race coverage, and record the design in ADR 0004

Migration and compatibility

  • add immutable migration 0002 with exact checksum validation, composite tenant foreign keys, deterministic backfill, and required promotion indexes
  • fail closed on unknown or cross-tenant member ids while stripping legacy external:* email author markers that were never authorization principals
  • keep an expand-phase trigger that translates writes from the previous application revision into normalized rows; a later contract migration can reject projection writes and remove the old JSONB index after the rollback window closes

Tests

  • npm run lint (466 files)
  • npm run typecheck
  • npm run server:typecheck
  • npm run build
  • npm test (1066 passed, 4 platform-gated skips)
  • npm run test:integration (284 passed, 5 credential-gated Resend skips)
  • focused agenda, normalization, email, membership, and runtime suites (49 passed)
  • fresh PostgreSQL v2 migration smoke (63 tables, exact v1/v2 checksums, composite FKs, required indexes)
  • npm run guard:big-brain
  • npm run guard:llm-tracked
  • npm run guard:engine-registry

@KIDA-MNESIA
KIDA-MNESIA marked this pull request as ready for review September 2, 2026 19:21
@KIDA-MNESIA
KIDA-MNESIA merged commit bb961a3 into yetone:main Sep 2, 2026
7 checks passed
@KIDA-MNESIA
KIDA-MNESIA deleted the codex/ar-h3-normalize-conversation-members branch September 2, 2026 19:22
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