Skip to content

docs: add RDD and work plan for issue #283 multi GitHub App installations#287

Merged
coji merged 6 commits intomainfrom
feat/issue-283-multiple-github-accounts
Apr 7, 2026
Merged

docs: add RDD and work plan for issue #283 multi GitHub App installations#287
coji merged 6 commits intomainfrom
feat/issue-283-multiple-github-accounts

Conversation

@coji
Copy link
Copy Markdown
Owner

@coji coji commented Apr 7, 2026

Summary

含まれるもの

  • 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 と運用ルール

レビュー観点

  • RDD の設計判断(UNIQUE github_account_id 廃止、cross-store 整合性 tenant first/shared second、canonical reassignment + membership 永続化、未初期化 link ガード)に違和感がないか
  • 作業計画の PR 分割粒度が妥当か
  • PR 6→7 のデプロイ順序(backfill 完了検証 → strict 切替)の運用が現実的か

実装は本 PR マージ後、Graphite を使った stacked PR で進める予定です。

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • ドキュメント
    • 設計決定文書(RDD)の標準テンプレートと運用ガイドラインを追加(目的、命名規則、最小構成、ライフサイクル)。
    • 複数GitHub Appインストレーション対応の詳細設計を追加(識別/割当ルール、動作変更、移行戦略、UI/バックエンド影響)。
    • 本件の実行計画(段階的PR構成、マージ順序、検証手順、リスク管理)を追加。

coji and others added 2 commits April 7, 2026 15:40
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

Warning

Rate limit exceeded

@coji has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 12 minutes and 55 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4bed6724-0663-46ba-983d-fc8c783f9bee

📥 Commits

Reviewing files that changed from the base of the PR and between 5c1afef and 51fc908.

📒 Files selected for processing (1)
  • docs/rdd/issue-283-multiple-github-accounts.md
📝 Walkthrough

Walkthrough

RDDテンプレートと、単一組織での複数 GitHub App インストール対応に関する設計文書および段階的作業計画を追加。DBスキーマ案、アプリ挙動、Webhook/Octokit解決、マイグレーション/バックフィル手順、UI変更、およびPR分割ワークフローを記述。

Changes

Cohort / File(s) Summary
RDD フレームワーク
docs/rdd/README.md
Requirements Definition Document の目的、命名規則、必須セクション、ライフサイクル(作成・更新・完結)を定義するテンプレートを追加。
Issue #283 — 設計ドキュメント
docs/rdd/issue-283-multiple-github-accounts.md
複数 GitHub App インストール対応の詳細設計。github_app_links をインストールスコープ化(組織×installation キー化)、repositories.github_installation_id 追加、repository_installation_memberships 新設、インストール単位のサスペンド/再割当ルール、Octokit 解決/クエリ/Webhook/バックフィル/マイグレーションの挙動仕様を記載。
Issue #283 — 作業計画
docs/rdd/issue-283-work-plan.md
Stacked PR による段階的実装ワークフロー(PR 列挙、マージ順序、受入条件マッピング、デプロイ順序、バックフィル手順、検証・運用手順)を定義。

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 フェーズ(新列と旧ロジックを併存)
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

"🐰
文書の葉に跳ねて書くよ、
インストールは並び、ルールは整い、
マイグレーションの道しるべを刻み、
実装への足取り軽やかに、
さあ跳躍だ、ぴょんぴょん! 🥕"

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main changes: adding RDD and work plan documentation for issue #283 about multi GitHub App installations support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-283-multiple-github-accounts

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.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
docs/rdd/issue-283-multiple-github-accounts.md (1)

569-596: Dual-read / dual-write 期間の fallback 定義が適切です

特に評価できる点:

  1. Fallback の適用条件を厳格に制限(lines 578-585):

    • Active installation が 1 件の org のみに限定
    • 2 件以上の場合は自動解決せず skip で安全側に倒す
  2. Scheduled crawl の collision 対応(lines 587-596):

    • Skip 数を log/metric に出力し、migration 作業の可視性を確保
    • Job 全体を error にせず、段階的な migration を可能にする
  3. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6ccc827 and e5c5641.

📒 Files selected for processing (2)
  • docs/rdd/README.md
  • docs/rdd/issue-283-multiple-github-accounts.md

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e5c5641 and 2fa0f7c.

📒 Files selected for processing (1)
  • docs/rdd/issue-283-work-plan.md

coji and others added 2 commits April 7, 2026 16:32
…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>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2fa0f7c and 5c1afef.

📒 Files selected for processing (2)
  • docs/rdd/issue-283-multiple-github-accounts.md
  • docs/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>
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