refactor(store): hosted 購入 hook の純粋な応答 parser と phase 対応表を leaf に抽出 (R15b) - #622
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
…R15b) 第 6 回レビュー Phase 6 の R15b (F14)。hooks/useHostedStorePurchase.ts (1,022 行) から 応答の解釈と phase → 表示状態の対応 (12 宣言・byte 単位で同一) を browser-safe な lib/x402/hostedPurchasePhases.ts に移す。session/product の scope・署名済み request の ref・ 古い完了の保護・effect と timer は hook に残す (money-path の制御フローは不変)。 hook の公開 export と path は同じ。旧コードで固定した parser の表 (63) と hook の公開 API 経由の pin (67) を追加した。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HeizmagJBgL5peL5mQpxkc
cipherwebllc
force-pushed
the
fix/r6-r15b-purchase-parsers
branch
from
September 24, 2026 15:11
9498528 to
8a6f937
Compare
cipherwebllc
added a commit
that referenced
this pull request
Sep 24, 2026
「unresolved old payment scopes the relay checkout hold and notice」は、fixture の時刻が実時刻で 発行される一方 vi.waitFor が fake 時計を進め、遅延 import の完了前に通知が描画されると recovery のタイマーが未設置のまま期限判定に進む競合で、CI と並列負荷で時々落ちていた (#622 の CI・R14 レビューで 7 回中 2 回)。時計を setup 前に固定し、vi.dynamicImportSettled() を 待ってから期限の 1ms 前と期限へ明示的に進める。元の assert はすべて残し、期限ちょうどに 状態を 1 回読むことを追加で固定した。隣の「expiry read holds payment until %s completes」も 同じ原因で単独実行だと必ず落ちていた (先の test が module を読み込むおかげで通っていた) ため 同じ形に直した。単独 25/25・併走 10/10・負荷下の file 全体 368/368。 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HeizmagJBgL5peL5mQpxkc
cipherwebllc
added a commit
that referenced
this pull request
Sep 24, 2026
…正) (#640) 「unresolved old payment scopes the relay checkout hold and notice」は、fixture の時刻が実時刻で 発行される一方 vi.waitFor が fake 時計を進め、遅延 import の完了前に通知が描画されると recovery のタイマーが未設置のまま期限判定に進む競合で、CI と並列負荷で時々落ちていた (#622 の CI・R14 レビューで 7 回中 2 回)。時計を setup 前に固定し、vi.dynamicImportSettled() を 待ってから期限の 1ms 前と期限へ明示的に進める。元の assert はすべて残し、期限ちょうどに 状態を 1 回読むことを追加で固定した。隣の「expiry read holds payment until %s completes」も 同じ原因で単独実行だと必ず落ちていた (先の test が module を読み込むおかげで通っていた) ため 同じ形に直した。単独 25/25・併走 10/10・負荷下の file 全体 368/368。 Claude-Session: https://claude.ai/code/session_01HeizmagJBgL5peL5mQpxkc Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.
概要
第 6 回レビュー Phase 6 (完全リファクタ) の R15b です (指摘 F14)。挙動を変えない抽出だけです。
Creator Store の購入 hook
hooks/useHostedStorePurchase.ts(1,022 → 878 行) から、純粋な応答 parser と phase の対応表 (12 宣言・152 行) を、React に依存しないlib/x402/hostedPurchasePhases.ts(171 行) に移します。exportの付与だけ)。hook の diff は import と型の再 export の追加と、移した宣言の削除だけです。hostedPurchaseWire.tsには触れていません (refactor(x402): ストア wire の定数と共通 validator を storeWire に集約し client 手数料を開示定数から導出 (R1・掟 15) #610 と重ならない)。公開文言・通信は変わりません。
固定と検証 (base = main に rebase 済み)
ok判定の削除 等) をすべて検出しました。既存の不具合 (本 PR では変えない・B-R15d・掟 12/15)
商品を切り替えても、切り替え前の通信結果を捨てません (wallet の切替は捨てる)。前の商品の遅い 200 settled が届くと、quote のない provisioning で止まります。表示される「支払い済み」自体は事実で、支払っていない商品の provisioning が出ることは、商品 ID による作り直しで防がれています。本番で到達する条件はほぼありません (送信中に商品の props が変わるのは、出品者の編集を取り込む再読み込みのときだけ)。
🤖 Generated with Claude Code
https://claude.ai/code/session_01HeizmagJBgL5peL5mQpxkc