Skip to content

Fix member join registration under RLS - #55

Merged
yufoxda merged 2 commits into
developfrom
fix/join-registration
Jul 15, 2026
Merged

Fix member join registration under RLS#55
yufoxda merged 2 commits into
developfrom
fix/join-registration

Conversation

@yufoxda

@yufoxda yufoxda commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

概要

入部届を送信しても登録されない不具合を修正します。

  • RLS の SELECT policy を満たすよう、サーバー生成 member ID をトランザクション内だけ current member として設定
  • member 作成と user 紐付けを競合安全な単一トランザクションに変更
  • 開発時も DB の最新 memberId を読み込み、登録後の状態を正しく反映
  • 下流 DB エラーを 401 に誤変換しないよう認証エラー境界を修正
  • 入部画面の stale cache、二重遷移、409 競合時の取り残しを修正
  • 内部 500 エラー詳細をクライアントへ公開しないよう修正
  • RLS 実SQLを使う統合テストと GitHub Actions CI を追加

原因

未登録ユーザーでは app.current_member_id が空です。members の INSERT policy は通過しても、INSERT ... RETURNING に SELECT policy が適用され、作成行を参照できずトランザクション全体がロールバックしていました。

検証

  • member: 3 tests passed / TypeScript passed
  • community: 12 passed, 1 live test skipped / TypeScript passed
  • frontend: 7 passed / TypeScript passed / Next.js production build passed
  • git diff --check passed

既知の別課題

share/drizzle/meta/_journal.json が 0003 の欠落したSQLを参照し、0006/0007 を登録していません。本番DBの適用履歴を確認せず修復すると二重適用の危険があるため、本PRでは変更しません。

@yufoxda
yufoxda merged commit 626a59f into develop Jul 15, 2026
2 checks passed
@yufoxda
yufoxda deleted the fix/join-registration branch July 15, 2026 22:41
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