widget: state と純関数クラスタを 4 モジュールに分割する (#109 R-3) - #112
Merged
Conversation
Owner
Author
🔍 レビュー依頼(→ Codex)
|
Owner
Author
📋 レビュー結果(by Codex)判定: ✅ merge 可(must 0 件) 🔴 mustなし 🟡 shouldなし ⚪ nitなし レビュアーの確認事項(転記)
作者側の追加証跡: 実ブラウザ E2E(投稿 → 201 → reload 復元 → pin 再描画、旧ビルド envelope のクロスバージョン復元含む)は PR 本文のとおり green。 |
kosako
marked this pull request as ready for review
July 11, 2026 09:33
kosako
force-pushed
the
refactor/inbox-view
branch
from
July 11, 2026 11:08
9eb42c5 to
de34fd3
Compare
widget/src/index.js (1729 行) から挙動を変えずにコードを一字一句そのまま 移動して 4 モジュールを新設する (verbatim move): - state.js: DEFAULTS と state (オブジェクト参照共有。state への再代入は 無く全参照がプロパティ読み書きのため挙動不変) - screenshot.js: captureScreenshot / buildScreenshotSvg / screenshotOverlayFor / collectReadableStyles / visibleBackground / snapshotClassAttr / serializeAsXhtml / renderScreenshotOverlay / byteLength / base64Encode - persistence.js: FEEDBACK_STORAGE_VERSION / loadStoredReviewer / saveReviewer / loadPersistedFeedback / persistFeedbackList / clearPersistedFeedback / feedbackStorageEnvelope / serializeFeedbackForStorage / normalizePersistedFeedback / isMatchingFeedbackEnvelope - payload.js: PAYLOAD_SCHEMA_VERSION / buildPayload / generateFeedbackId (呼び出し元が buildPayload のみであることを grep で確認) restorePersistedFeedback は index.js 残留関数 (removeCommittedMarkers / restoreFeedbackMarkers) を呼ぶ orchestrator のため index.js に残す。 Slack 直送系 (postSlackWebhook ほか) は #97 で削除予定のため移動しない。 safeFilePart は R-1 スライスと競合させないため触らない。 新モジュールは全て「葉」(index.js への逆依存なし) で、dist の差分は モジュール境界コメント・IIFE ラッパ・並び順・import 行のみ。全 1912 行の 関数本体テキストがバイト一致することを機械照合で確認済み。 node 環境で動く純関数に単体テストを追加: - test/widget-persistence.test.js: serialize/normalize の round-trip と envelope 一致判定 - test/widget-screenshot.test.js: byteLength / base64Encode Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LRdDjwxbAAaTMwwnzipkau
R-1 で shared へ移設済みの safeFilePart を widget 側でも import に切替え、 バイト同一の重複定義(監査 L-31)を解消する。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LRdDjwxbAAaTMwwnzipkau
kosako
force-pushed
the
refactor/widget-split
branch
from
July 11, 2026 11:10
d0eb132 to
242f041
Compare
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.
概要
#109 のスライス R-3(R-2 の上に stack。R-1/R-2 merge 後に main へ retarget)。挙動を一切変えない widget コアの分割。index.js は 1729 → 1311 行。
widget/src/state.js—DEFAULTSとstateを移動。state への再代入はゼロ・全 180 箇所がプロパティ読み書き(実測)なので、オブジェクト参照共有で挙動不変widget/src/screenshot.js— screenshot SVG 生成系 10 関数(export は captureScreenshot / byteLength / base64Encode のみ、他はモジュール私有)widget/src/persistence.js— localStorage 永続化系 9 関数 + FEEDBACK_STORAGE_VERSIONwidget/src/payload.js— buildPayload / generateFeedbackId(呼び出し元 1 箇所を実測確認して私有)+ PAYLOAD_SCHEMA_VERSIONsafeFilePartを shared 参照に切替(R-1 で移設済み。監査 L-31 のバイト同一重複を解消)検証
npm run checkgreen(全 124 テスト: 既存 113 + 新規 11。既存期待値の変更なし)実装: Claude / レビュー: Codex(相互レビュー契約)
🤖 Generated with Claude Code
https://claude.ai/code/session_01LRdDjwxbAAaTMwwnzipkau