docs: add RDD and work plan for issue #283 multi GitHub App installations#287
docs: add RDD and work plan for issue #283 multi GitHub App installations#287
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 12 minutes and 55 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRDDテンプレートと、単一組織での複数 GitHub App インストール対応に関する設計文書および段階的作業計画を追加。DBスキーマ案、アプリ挙動、Webhook/Octokit解決、マイグレーション/バックフィル手順、UI変更、およびPR分割ワークフローを記述。 Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI/Client
participant App as Server/App
participant DB as Database
participant GH as GitHub (Octokit / Webhooks)
UI->>App: ユーザーがインストールを選択(github_app モード)
App->>DB: github_app_links / repository_installation_memberships 検証 (installation_id)
DB-->>App: インストール有効/候補一覧
App->>GH: Octokit client (installation_id) で API 呼び出し
GH-->>App: レスポンス(リポジトリ情報等)
GH->>App: installation_repositories / installation webhook(インストール更新)
App->>DB: 対応する `github_app_links` / membership を installation_id で更新
App->>DB: バックフィル時は dual-read/dual-write フェーズ(新列と旧ロジックを併存)
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
docs/rdd/issue-283-multiple-github-accounts.md (1)
569-596: Dual-read / dual-write 期間の fallback 定義が適切です特に評価できる点:
Fallback の適用条件を厳格に制限(lines 578-585):
- Active installation が 1 件の org のみに限定
- 2 件以上の場合は自動解決せず skip で安全側に倒す
Scheduled crawl の collision 対応(lines 587-596):
- Skip 数を log/metric に出力し、migration 作業の可視性を確保
- Job 全体を error にせず、段階的な migration を可能にする
Transitional legacy data の正規化(line 595-596):
method='github_app'なのに active installation が 0 件の org をmethod='token'へ正規化明確化推奨:
Line 595-596 の正規化と、Stage 4(lines 622-625)の正規化が同じ処理を指しているか、それとも異なるタイミングで実行されるかを明示することを推奨します。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/rdd/issue-283-multiple-github-accounts.md`:
- Around line 324-329: 現在の自動reassignmentロジックが「orgに membership_initialized_at IS
NULL の active link
が1件でもあれば全てのreassignmentをブロック」しているため過度に保守的になっています。修正は、reassignment判定で候補となるinstallation群をフィルタリングして、membership_initialized_at
IS NOT NULL のものだけを「ソース」/「受け手」候補として評価し、membership_initialized_at が NULL
のリンクは単に候補から除外する(つまり未初期化リンクへのreassignmentのみを禁止し、初期化済みリンクからのreassignmentは許可する)ように変更してください(参照する識別子:
membership_initialized_at, github_installation_id, canonical
installation/assignment required の判定処理)。
- Around line 382-404: The RDD asks for concrete implementation details for
automatic repair and schema/events: implement detection and fill logic for
membership_initialized_at IS NULL in the periodic crawl by adding a
detector/patch flow in crawl.server.ts that queries repositories/memberships,
sets membership_initialized_at after safe upsert and emits repair events; create
the github_app_link_events audit table (fields: organization_id,
installation_id, event_type, source, status, details_json, created_at) before
deploying cross-store changes and ensure all places that change
github_app_links.deleted_at or repositories.github_installation_id write an
event; implement orphan detection logic that finds cases like
github_app_links.deleted_at IS NOT NULL but repositories.github_installation_id
still points to that installation or canonical reassignment pointing to deleted
installs and add repair handlers to nullify/install correct canonical
assignments and memberships; and ensure idempotency in membership
upsert/soft-delete/canonical reassignment/link soft-delete by treating existing
deleted_at as success and making operations no-ops when already in target state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d619348e-7ac9-43aa-b1a2-9027e681afc8
📒 Files selected for processing (2)
docs/rdd/README.mddocs/rdd/issue-283-multiple-github-accounts.md
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/rdd/issue-283-work-plan.md`:
- Around line 348-357: The fenced code block containing the ASCII PR tree (the
block that begins with "PR 1 (schema)" and the subsequent indented lines) lacks
a language tag and triggers markdownlint MD040; update that fence to include a
language specifier (e.g., add ```text or ```text-flow) so the block becomes
```text ... ``` to silence the lint warning and avoid CI noise while keeping the
content identical.
- Around line 240-252: PR 6 の合否判定が矛盾しているので、Runbook の検証条件を一つに統一して「github_app 運用
org では repositories.github_installation_id IS NULL が 0
件であること」に修正してください;具体的にはチェックリストの「✅ `repositories.github_installation_id IS
NULL`...」と「token method org のみ NULL 許容」を削除または置換し、完了条件を「github_app 運用 org に対して
NULL=0」の単一判定に揃えた文言に更新して PR 7 進行条件として明記してください(参照シンボル:
`repositories.github_installation_id IS NULL`, "token method org", PR 6, PR 7)。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 01283281-ec45-4d18-b145-70529d629c16
📒 Files selected for processing (1)
docs/rdd/issue-283-work-plan.md
…nment CodeRabbit が指摘した過度に保守的なガードを緩和。未初期化 link への自動 reassignment は引き続き禁止するが、初期化済み link を候補とする reassignment は安全に許可するよう設計を変更。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CodeRabbit 指摘: - PR 6 Runbook の合否判定を「github_app 運用 org に対して NULL=0 件」の単一条件に統一 - 進行順 ASCII ツリーの code fence に text 言語タグ追加 (markdownlint MD040) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/rdd/issue-283-multiple-github-accounts.md`:
- Around line 230-235: The migration doc for github_app_links omits the initial
value for the new membership_initialized_at column; update the migration steps
to include membership_initialized_at in the list of copied/initialized fields
(alongside organization_id, installation_id, github_account_id, github_org,
app_repository_selection, deleted_at, created_at, updated_at) and state it
should be initialized to NULL by default so both the shared DB migration and
downstream handlers (e.g., app/routes/api.github.setup.ts and
installation.created webhook) have a clear expectation.
- Around line 401-403: Add a new "## スキーマ変更" sub-section that defines the
github_app_link_events table schema: list each column (id, organization_id,
installation_id, event_type, source, status, details_json, created_at) with
explicit SQL types, nullability, default values, and which column is the primary
key (e.g., id); specify indexes (e.g., on organization_id, installation_id,
created_at) and any unique constraints; document retention/archival policy and
deletion rules (TTL, partitioning) and expected row size/throughput assumptions;
include example DDL statement and notes about backfill/migration strategy and
idempotency handling so subsequent PRs follow the same implementation plan.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2fe85a9a-9d28-4968-9529-13fa63e7d85d
📒 Files selected for processing (2)
docs/rdd/issue-283-multiple-github-accounts.mddocs/rdd/issue-283-work-plan.md
✅ Files skipped from review due to trivial changes (1)
- docs/rdd/issue-283-work-plan.md
…itialized_at to migration CodeRabbit 指摘: - github_app_links migration の初期化フィールドに membership_initialized_at を追加 - github_app_link_events table のスキーマ定義 (columns / indexes / retention / 例 DDL) を新規追加 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
docs/rdd/ディレクトリの命名規則・ライフサイクルを README で定義含まれるもの
docs/rdd/issue-283-multiple-github-accounts.md— RDD(設計判断 / スキーマ変更 / 移行方針 / 受け入れ条件 24 項目)docs/rdd/issue-283-work-plan.md— Stacked PR 7 段階の作業計画docs/rdd/README.md— RDD ディレクトリの index と運用ルールレビュー観点
UNIQUE github_account_id廃止、cross-store 整合性 tenant first/shared second、canonical reassignment + membership 永続化、未初期化 link ガード)に違和感がないか実装は本 PR マージ後、Graphite を使った stacked PR で進める予定です。
🤖 Generated with Claude Code
Summary by CodeRabbit
リリースノート