feat: ADR-0011 PR-E5 — token 自動 refresh + E2E + docs#34
Merged
Conversation
ADR-0011 PR-E5 (最終): buildMcpServers が expiry 近接 token を transparent に refresh し、E2E テストで PR-E1〜E4 の統合シナリオを通す。docs を整備して ADR-0011 を Accepted に確定。 ai-engine: - buildMcpServers: REFRESH_BUFFER_MS (5 min) 以内に expire する token は refreshAccessToken を呼んで store に書き戻す。失敗時は expired ? null : token で fall back (refresh_token 失効 → MCP 401 → UI 再認証経路へ)。 loadUsableToken ヘルパで 1 server 分の取得を切り出し - build-mcp-servers.test.ts: refresh path 5 ケース追加 (expiry 直前 + refresh 成功 / rotate 無し refresh / refresh 4xx 失敗 → null / refreshToken 無し expired → null / 期限十分先で refresh しない) - 新規 oauth-e2e.test.ts: orchestrator → loopback callback → token store → buildMcpServers → header 注入の 1 シナリオ + 透過 refresh の 1 シナリオ docs: - README に「外部 MCP (Atlassian) の OAuth セットアップ」section 追加 - docs/adr/0011-tally-managed-oauth-flow.md: status を Accepted (PR-E5 merge をもって 確定) に、PR 分割実績テーブル更新 (E1-E2-E3a-E3b-E4-E5)、完了後の確定事項セクション追加 codex セカンドオピニオン対応: - Major #1: refresh 後の expiresAt は HTTP ラウンドトリップ後の Date.now() を起点に計算 - Major #2: refresh の write race を comment 化 (MVP 単一ユーザー前提なので last-write-wins 許容、将来 multi-tenant 化時に mutex 追加が必要) - Minor #3: README の redirect URI を「Tally 起動後に表示される実ポートを Atlassian console に登録」と明記 (port=0 静的登録は Atlassian が拒否するため) - Minor #4: ADR status を 'Accepted (PR-E5 merge をもって確定)' に hedge テスト: ai-engine 242 pass (+7 PR-E5 新規)、core 94 / storage 97 / frontend 282 すべて pass typecheck clean / biome lint clean
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughADR-0011 の Tally 管理 OAuth フローの実装をドキュメント化・完成させるPRです。OAuth token refresh 機能を ChangesOAuth Token Refresh 実装
Sequence DiagramsequenceDiagram
actor User as ユーザー
participant UI as Tally UI
participant OAuthOrch as OAuthFlowOrchestrator
participant AtlassianOAuth as Atlassian OAuth Provider
participant Store as FileSystemOAuthStore
participant MCP as buildMcpServers
User->>UI: 🔓 認証ボタンをクリック
UI->>OAuthOrch: authorize() 呼び出し
OAuthOrch-->>UI: authorizationUrl 返却
UI->>AtlassianOAuth: authorize URL に遷移
User->>AtlassianOAuth: 認可承認
AtlassianOAuth-->>UI: redirect (code + state)
UI->>OAuthOrch: callback fetch (code/state)
OAuthOrch->>AtlassianOAuth: token endpoint (code 交換)
AtlassianOAuth-->>OAuthOrch: access_token, refresh_token
OAuthOrch->>Store: token 書き込み
Store-->>OAuthOrch: 完了
Note over UI,Store: 通常の MCP 呼び出し時
UI->>MCP: buildMcpServers() 呼び出し
MCP->>Store: loadUsableToken() で token 読込
alt Token 内 refresh buffer
MCP->>AtlassianOAuth: refreshAccessToken (refresh_token)
AtlassianOAuth-->>MCP: 新 access_token
MCP->>Store: 更新 token 書き込み
else Token 有効期限切れ / refresh 失敗
MCP-->>MCP: null (header 省略)
end
MCP-->>UI: MCP config (Authorization: Bearer token)
UI->>User: ツール呼び出し完了 / 再認証促進
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ADR-0011 完了 PR: buildMcpServers が expiry 近接 token を transparent に refresh し、PR-E1 〜 PR-E4 の統合シナリオを E2E テストで通す。docs を整備して ADR-0011 を Accepted に確定。
expiresAt - now ≤ 5 min+refreshTokenあり →refreshAccessTokenを発火 → store 書き戻し → 新 access_token を header に注入ADR-0011 ロードマップ完了
主な変更点
buildMcpServers透過 refresh新ヘルパ
loadUsableTokenで 1 server 分の取得を切り出し、以下の制御フロー:refreshAccessTokenを発火provider が refresh 時に新 refresh_token を返さない (rotate 無し) 場合は旧 refresh_token を保持 (RFC 6749 §6 互換)。
E2E テスト (
oauth-e2e.test.ts)docs
README.md: 「外部 MCP (Atlassian) の OAuth セットアップ」section 追加。redirect URI は Tally が表示する実ポートを Atlassian developer console に登録する旨を明記 (port=0 静的登録は不可、RFC 8252 対応待ち)docs/adr/0011-tally-managed-oauth-flow.md:Accepted (PR-E5 merge をもって確定)にcodex セカンドオピニオン対応
Date.now()を再取得して expiresAt を計算 (古いnowを使うと数秒早く期限切れに見える)Accepted (PR-E5 merge をもって確定)と hedgeTest plan
Summary by CodeRabbit
リリースノート
新機能
ドキュメント