Skip to content

deploy: 03071803#1147

Merged
jujunjun110 merged 53 commits intomainfrom
develop
Mar 7, 2026
Merged

deploy: 03071803#1147
jujunjun110 merged 53 commits intomainfrom
develop

Conversation

@jujunjun110
Copy link
Contributor

No description provided.

jujunjun110 and others added 30 commits January 14, 2026 23:26
複数の政党・個人議員が利用できるSaaSモデルへの転換に向けた
マルチテナント化の概要設計をまとめた。

主な設計方針:
- RLS(Row Level Security)による行レベル分離を採用
- テナント単位でのデータ分離(政党・個人議員ごと)
- グローバル管理者を設けない設計(政治的中立性の担保)
- users.roleを廃止し、テナントロールに一本化

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- viewerロールの記載を削除(3ロール体制に統一)
- globalRoleをAuthenticatedUser型から削除(users.role廃止方針に整合)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- tenantId/politicalOrganizationIdの型をstringからbigintに修正(DBスキーマと整合)
- Prismaコード例のロジックエラーを修正(currentTenant.id → input.politicalOrganizationId)
- TenantContextの設計をConstructor Injectionパターンに準拠するよう改善
  - tenantId/organizationIdはUsecaseのexecute()パラメータとして渡す
  - Presentation層でURLからコンテキストを解決する方式に変更

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- user_preferencesテーブルで最後にアクセスしたコンテキストを記憶
- ログイン後のリダイレクトフロー(getDefaultRedirectPath)を定義
- セクション番号の修正(5.4 → 5.5)
- 実装タスク一覧にUserPreferences関連タスクを追加

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- TENANT_ROLES定数配列を定義し、型を導出
- isTenantRole()型ガード関数を追加(ランタイム検証用)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- RLS有効化前にトランザクション内でポリシー動作を検証する手順を追加
- テストユーザーのJWTクレーム設定による検証方法を明記
- 自テナントデータ取得・他テナント非表示の検証例を追加
- 全対象テーブルのRLS有効化SQLを明記
- 手順番号の修正(5→6: メンテナンスモード終了)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 9.2にキャッシュ戦略セクションを追加
- unstable_cacheでテナントID・政治団体IDをキャッシュキーに含める例
- revalidateTagによるテナントスコープのキャッシュ無効化例
- RLSとキャッシュの関係(キャッシュ汚染防止とセーフティネット)
- セクション番号の修正(9.3→9.4, 9.4→9.5)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 「最後にアクセスしたテナント/政治団体を記憶」機能は初期リリースでは不要
- ログイン後のリダイレクトフローをシンプル化
  - 単一テナント・単一政治団体 → ダッシュボードへ直行
  - 単一テナント・複数政治団体 → 政治団体選択画面
  - 複数テナント → テナント選択画面
- 実装タスク一覧から関連タスクを削除

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
docs: マルチテナント化概要設計
マルチテナント化概要設計に基づき、フェーズ1(準備フェーズ)の
詳細な実装手順書を作成。コーディングAI向けの具体的な実装ガイド。

含まれる内容:
- Prismaスキーマ変更(Tenant, UserTenantMembership)
- ドメインモデル・リポジトリの設計
- 既存データマイグレーションスクリプト
- NOT NULL制約追加手順
- 実装チェックリスト
…PtX2

Create Phase 1 detailed design specification
- Tenant, UserTenantMembership モデルをPrismaスキーマに追加
- TenantRole enum (owner/admin/editor) を追加
- PoliticalOrganization, Counterpart, Donor に tenantId (nullable) を追加
- テナント関連のドメインモデル・リポジトリを auth コンテキストに追加
- 既存データをテナントにマイグレーションするSQLを追加
- シードデータをマルチテナント対応に更新
- BigInt シリアライズエラーを修正 (prisma-political-organization.repository.ts)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
mapToMembership / mapToMembershipWithTenant メソッドを追加し、
重複していたマッピングロジックを共通化

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…schema

feat: フェーズ1マルチテナント化のスキーマ・ドメインモデル追加
webapp/admin両方でMiddlewareを使用したメンテナンスモードの設計を記載。
環境変数MAINTENANCE_MODEによる制御でDBアクセスをゼロにする方式。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- webapp/adminそれぞれでmaintenance-html.tsを作成
- webappはエンドユーザー向けデザイン、adminはシンプルなデザイン
- TenantProvider/OrganizationProviderでserializedValueを実際に使用するよう修正
- サーバー側はbigint、クライアント側はstringに変換する設計を明確化
- TenantMembershipWithTenant型の参照先(フェーズ1)をドキュメント内で明示

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Edge Runtimeは環境変数を動的に読み取らないため、
変更後は再デプロイが必要であることを明記。
動的切り替えが必要な場合はVercel Edge Configを推奨。
メンテナンス画面に予定時間などのメッセージを表示できるようにする。
認証情報のキャッシュはリクエスト間で共有すると危険なため、
React.cache(リクエストスコープ)を意図的に使用している旨を追記

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- loadOrganizationsByTenantId Loaderを追加(unstable_cache使用)
- getDefaultRedirectPath, SelectOrganizationPageでLoaderを使用するよう変更
- 実装チェックリストにLoaderを追加

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…-yqFUX

Plan maintenance mode with environment variables
- webapp/admin両方でNext.js Middlewareを使用してメンテナンスモードを実装
- MAINTENANCE_MODE環境変数で有効/無効を制御
- MAINTENANCE_MESSAGE環境変数で追加メッセージを表示可能
- 503 Service Unavailableステータスコードを返却
- 静的アセット(_next/static, favicon.ico等)は通過を許可
- webappはブランドカラーを使用したデザイン
- adminはシンプルなデザイン

設計ドキュメント: docs/20260115_1219_メンテナンスモード設計.md

Co-Authored-By: jun.ito@team-mir.ai <jujunjun110@gmail.com>
- middleware.tsはproxy.tsと競合するため削除
- メンテナンスモードのロジックをproxy.tsに統合
- webapp/admin両方でproxy関数の先頭でメンテナンスモードをチェック

Co-Authored-By: jun.ito@team-mir.ai <jujunjun110@gmail.com>
…-mode

feat: メンテナンスモード機能を実装
- 「必須」「任意」でセクション分け
- 過剰なコメントを削除してシンプルに
- メンテナンスモード関連の環境変数を追加
- adminから不要なDIRECT_URLを削除

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
docs: フェーズ2マルチテナント化の詳細設計手順書を追加
src/libに単一ファイルのみ存在していたため、より適切な場所として
src/client/templates配下に移動し、コード構成のシンプルさを維持する。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
devin-ai-integration bot and others added 23 commits January 15, 2026 04:37
Co-Authored-By: jun.ito@team-mir.ai <jujunjun110@gmail.com>
…ml-to-templates

refactor: maintenance-htmlをsrc/client/templatesに移動
Supabase CLIの更新により、ANON_KEYとSERVICE_ROLE_KEYが
固定値から動的生成に変更されたため、CI workflowを修正。

変更内容:
- ハードコードされたSupabaseキーを削除
- supabase start後にsupabase status --output jsonから
  動的にキーを取得するステップを追加
- 取得したキーをGITHUB_OUTPUTとGITHUB_ENVに設定
- admin buildとe2eテストで動的キーを使用するように変更

Co-Authored-By: jun.ito@team-mir.ai <jujunjun110@gmail.com>
…e-dynamic-keys

fix(ci): Supabase CLIの動的キー生成に対応
findAll()のソート順をdisplayName ascからdescに変更し、
ルートにアクセスした際のリダイレクト先組織を調整

https://claude.ai/code/session_01RPZibL75itZziC7gJZbuUV
…rect-CUmaY

Reverse political organizations sort order to descending
Fix typos in ExplanationSection Japanese text
chore(deps): update dependency @next/third-parties to v16.1.6
…17.x-lockfile

chore(deps): update dependency dependency-cruiser to v17.3.8
chore(deps): update pnpm to v10.30.3
chore(deps): update dependency zod to v4.3.6
@vercel
Copy link
Contributor

vercel bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marumie-admin (staging) Ready Ready Preview, Comment Mar 7, 2026 9:03am
marumie-webapp (staging) Ready Ready Preview, Comment Mar 7, 2026 9:03am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 7, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • develop
  • ^epic.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 34a4a4d8-2af3-4bdf-9311-31c14f40fe34

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jujunjun110 jujunjun110 merged commit 499a91e into main Mar 7, 2026
12 checks passed
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.

2 participants