refactor: fold the detail and diff views' flags into a mode and a phase - #60
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…r line Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…rst frame Task 5 will fold diff's parallel bools into mode/phase enums; these golden cells give it 24 more byte-for-byte checks (compose/submit/discard/loading x en/ja x 160/120/80) alongside the existing 8, all reached via Update. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Ten parallel bools and three error strings made 1024 nominal states out of the eight this view has, and Update, handleKey and View each assumed a different subset. They are now one mode (which overlay is on screen), one phase (that mode's round trip) and one errText. The wheel no longer scrolls the body while a mode's own fetch is in flight: the view draws a spinner then, not the body. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Opening the composer over a failed close clears the body's error rather than draw it inside the composer, and it does not come back on esc. Say where that error goes on the field itself, and let the two messages that open an overlay name the mode they open instead of leaning on the key handler having set it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Five parallel bools and three error strings named far more states than the four overlays this view has, and Update, handleKey, View and the mouse each assumed a different subset of them. loading stays a bool of its own: the diff and the review context arrive separately, and c, v and X are gated on the context, so an overlay can be open while the files are still on their way. One error string costs less here than in the detail view -- modeView draws no errText at all, because what the diff itself has to say goes to reviewErr and declined -- so the three keys that open an overlay clearing it is the whole of what keeps a failed submission out of the next composer. Say that where the popup is cancelled, and pin it on all three keys. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The three scenarios all started with 2 -- the Repos tab -- so nothing walked the board the root actually opens on, and the one path a user takes first (pick a card, press enter) was only ever covered by injecting work.OpenDetailMsg directly. The board's own d opens the diff too, so reaching the diff is no evidence enter worked: without the guard the scenario passes with the board's enter returning nil. The number is no evidence either -- the card carries it. The state line is what only the detail view draws. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
mouse.go listed m.gutter among the geometry it shares with render.go, but it never calls it -- the gutter is the drawing's alone, which bd40d96 already said on the other side. detail's mode said "the eight this view actually has" without anything to count. There are eleven: modeView idle or loading, modeCompose and modeConfirm idle or working, modePick loading, idle or working, modeSubmit loading or idle. The bools it replaced were ten, so 2^10, not 2^n. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Code Metrics Report
Code coverage of files in pull request scope (91.1%, patch 86.9%)
Reported by octocov |
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.
Phase 2 立て直しの Part 2(設計書 §6 の作業順 9 / 6 / 7 / 8)。
docs/superpowers/specs/2026-09-06-phase2-remediation-design.mddocs/superpowers/plans/2026-09-07-phase2-remediation-part2.md何をしたか
internal/tui/app/scenario_test.goに、キー入力だけで画面をまたぐシナリオテスト 3 本detail30 /diff24)。以降の等価性検証のためdetailの bool 10 個 + エラー文字列 4 本、diffの bool 5 個 + エラー文字列 3 本をmode/phaseの enum +errText1 本に畳んだdetail/diff/appのUpdateの各 case を名前つき method に分割(141→41 / 123→35 / 82→45 行).claude/rulesの暫定注記(TRANSIENT)を削除、設計書 §6 に実際の作業順を追記リファクタリングは表示を変えていない。 追録した 54 本を含む golden 80 本が、作業順 6 と 7 を通して 1 バイトも変わっていない。
設計書からの逸脱(実装計画の Decisions に記載)
diffのloadingは畳まない。c/v/Xはレビューコンテキストの到着でゲートされており、差分の取得中でもオーバーレイは開けるreview.Modelのsendingに任せ、phaseに写さない(真実の出所を 2 つにしない)pickerが持っていた 4 本目のエラー文字列も 1 本に畳んだ意図的な挙動変更 2 件(どちらもテストで固定)
c(コメント入力)が、close 失敗で出ていたエラーも消すようになった。 エラー文字列 1 本化(設計書 §4.4 の要求)の帰結。消さずに入力欄を開くと、close の失敗が入力欄の中に描かれてより悪い完了条件(設計書 §8)
make checkitemSource6 /candidateSource2 /reviewOpener1internal/tuiに bool の mode フラグが無いinternal/gh/cliのパーステストが実物の testdata を使うTRANSIENTは本 PR で削除条件 1 は残っている。
gh認証と tty が要るため、マージ前に手元で次を通す:差分から見て特に見るべき箇所:
v/l/aを押した直後の 1 フレーム(Viewの分岐順を変えた唯一の箇所)esc→c、同じくX(エラーが持ち越されないこと)c(エラーが消えること=意図的変更 2)--lang jaでピッカー / 確認 / 提出ポップアップ / フッターの折返し(全角の桁ずれ)繰り越した指摘
diffのsubmitCancelledだけがerrTextを残し、開く側(c/v/X)が消す流儀になっている。他の退出経路は出るときに消すpickErrorMsgにrefが無いための微差(前の detail インスタンスからの遅延メッセージが要る作為的な経路。既存由来)mode/phaseにString()が無く、テストの失敗メッセージが数値で出るdiff/golden_test.goのsubmittingModelのコメントがpendingCount()の実挙動と食い違う(既存由来)TestClosingFromTheReposTabShowsTheNewStateの前提ガード(#12)が弱い。Repos 一覧も番号を描くため。本体のアサーションは有効🤖 Generated with Claude Code