Repository navigation
U5b 取得の手順と排他・トークンの更新(#3604 #3864) - #4038
Draft
takemi-ohama wants to merge 7 commits into
Draft
takemi-ohama wants to merge 7 commits into
takemi-ohama wants to merge 7 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP7z4QjHh8vkcxvdbGUP
fetch_path・fetch_lock_path・fetch_lock・read_windows・write_fetch・due・FetchGate を足し、usages が 取得の記録を読み、forget が取得の記録を消すようにした。契約に relay-usage-fetch・relay-account-store と 上限の値 4 つを足した。fetch_usage・_refresh・_read_auth・_refresh_lock は起動の前の確かめ(U2・U3)の部品を 使うため、この PR には入れていない。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP7z4QjHh8vkcxvdbGUP
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
経路の判定で removing を見た結果を捨てて読み直すと、間に別の端末が残りを片付けて 同じ名前で登録し直したとき、打ち直しの削除が新しい登録をログアウトして外していた。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
最初の確認で登録も残りも見えず、排他の下の見直しで登録だけが見えたときは、 待つ間にほかの端末の account add が登録したものとして store_in_use で止まり、 打ち直しを案内する。OAuth の削除へ回すのは残りが見えたときだけ(r4-1)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
takemi-ohama
commented
Nov 22, 2026
takemi-ohama
commented
Nov 22, 2026
takemi-ohama
commented
Nov 22, 2026
takemi-ohama
commented
Nov 22, 2026
takemi-ohama
commented
Nov 22, 2026
takemi-ohama
commented
Nov 22, 2026
Contributor
Author
cross-review の記録(PR #4038)終わり方: ラウンドの上限で止まった。ラウンド 4・指摘 6(直した 5・見送った 1・未解決 0) ラウンドと修正
指摘
|
This branch has not been deployed
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.
概要
実装の単位 U5b「取得の手順と排他・トークンの更新」(実装計画の Task 9)。
満たす受け入れ条件: 決定 4(取得)・決定 4・I16(トークンの更新)
この PR は U5b の前半である。 取得の手順の本体(
fetch_usage・_refresh・_read_auth・_refresh_lock)は、詳細設計書の「取得の手順と排他」のとおり起動の前の確かめと同期の部品(U2 のcheck_local・Local・mark_relogin、U3 のpin_dir・apply_pending・replace_auth・write_pending・in_use・refresh_lock)を使う。それらはスプリントブランチにまだ無く、実装計画の依存の表(U5b は U4・U5a の後)と食い違うため、入れていない。続け方は supervisor の判断を待つ。accounts.py:fetch_path・fetch_lock_path・fetch_lock・fetch_wait・read_windows・write_fetch・due・FetchGate。usagesが取得の記録の窓とspend_limit_reachedを読み、forgetが取得の記録を消すcli_account.py:account add・account removeが、同じ名前の取得の排他を待って取ってから世代を変え、forgetをその中で打つlocations.jsonのrelay-account-store、ndf-files.jsonのrelay-usage-fetch、limits.jsonのrelay.usage-fetch・relay.usage-http・relay.oauth-refresh・relay.token-margin実装の中で決めたこと
forgetの 4 つ目の引数は U4 の前例どおりdrop(消す世代)のまま。 取得の記録もdropの世代のファイルだけを消し、ほかの世代のファイルが残らなければ.usage-fetch/<名前>/を消す。取得の排他の錠(.fetch-locks/<名前>.lock)は消さないaccounts.fetch_wait()(relay.usage-http× 2 +relay.oauth-refresh+claude-accounts.lock× 4 = 143 秒)。取れなければAccountLockTimeout(store_in_use)で使用率の取得が終わらない。少し待ってから打ち直すと止まり、何も変えない。形の違う名前は排他を取らずに通し、名前の検査は今の操作に任せるwrite_fetchはatを前の値のまま残す。atを書くのはfetch_usage(後半)だけrelay.usage-fetch・relay.token-marginは今のコードからまだ読まない(fetch_usageと U9 の_queue_fetchが読む)。単位の範囲として足したlimits.jsonの 2 つの summary は設計の文の「宛先」を「API」に替えた。ndf checkの禁止語(「宛先」は「マージ先」の意味で廃止)に当たるためtests/domains/relay/test_relay_usage_fetch.pyに置いた(test_relay_parts.pyは 811 行で、足すと 1,000 行の上限に近づく。U4 の前例と同じ並び)。CLI の排他のテストはtest_relay_cli.pyに足したgit diff --shortstat origin/sprint/3604-3864-relay-accounts...HEAD -- . ':(exclude)**/uv.lock' ':(exclude)plugins/ndf/docs/contracts/env.md'): 9 files changed, 414 insertions(+), 23 deletions(-)テスト
テストは CI で走らせる(
.ndf/project.jsonのtest.ci.only)。先に push したテストだけのコミット: f6ee587関連: #3604 #3864
🤖 Generated with Claude Code
https://claude.ai/code/session_01KYHP7z4QjHh8vkcxvdbGUP