Skip to content

fix: 無音の打ち切りを潰し、internal/usecase を入れる(Phase 2 立て直し Part 1) - #59

Merged
kukv merged 11 commits into
mainfrom
worktree-eventual-singing-gem
Sep 7, 2026
Merged

fix: 無音の打ち切りを潰し、internal/usecase を入れる(Phase 2 立て直し Part 1)#59
kukv merged 11 commits into
mainfrom
worktree-eventual-singing-gem

Conversation

@kukv

@kukv kukv commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Phase 2 立て直し Part 1(設計書の作業順 2 / 5 / 3 / 4)。実装計画は
docs/superpowers/plans/2026-09-07-phase2-remediation-part1.md

何を直したか

無音の打ち切り(作業順 2)

  • reviewThreads を Go 側のループでページングする。GitHub は connection を 100 で
    打ち切り、gh api --paginate は最上位より下の GraphQL カーソルを追えないので、
    101 本目以降のスレッドはエラーも出さずに消えていた
  • labels(first: 10) を 100 に上げた。据え置く connection(スレッド内の
    comments、Work の search、REST の per_page)には、なぜ据え置くのかを
    コメントで残した
  • gh.Work の配列長を section の enum から引くようにし、diff.go の裸の定数に
    名前を付けた

実物の testdata(作業順 5)

  • internal/gh/cli のパーステストが、手書き JSON ではなく gh の実出力の
    録りものを読む。手書きだと「GitHub が実際には返さない形」でも通ってしまう
  • work.json@me 検索なので全リポジトリをなめる。公開リポジトリのノードだけ
    絞り、エイリアスごとに 5 件で打ち切り、公開 PR の本文経由で私有リポジトリ名と
    インフラ構成に触れていた 2 件を落とした。録り方は testdata/README.md にある

internal/usecase(作業順 4)

  • PR / Issue の種別振り分け(GetItem / AddComment / SetState / EditLabels /
    EditAssignees)と、レビューの呼び出し順序(PostLineComment / SubmitReview)が
    ビューから下りた。ビューは「何をしたいか」を言い、それが何回の API 呼び出しに
    なるかは知らない
  • detail が宣言する interface は 6 / 2 / 1 メソッド(規約の上限は宣言あたり 6)
  • cmd/octoscopecli.New → usecase.New → app.New の 3 行

規約(作業順 3 の後始末)

  • 規約を実装より先に入れたときの暫定注記(TRANSIENT(Part1 ...))を削除した。
    Part 2 に持ち越す 2 件は意図的に残してある

検証

  • make check: 781 テスト / lint 0 件
  • make release-check: goreleaser 設定 OK、Windows / macOS / Linux のクロスコンパイル成功
  • golden は 1 バイトも動いていない(表示を変える変更を含まないため)
  • 新しいテストはすべて、守っている行を壊して赤くなることを確認してから入れた

確認をお願いしたいこと

実機での動作確認は未実施です。.claude/rules/tui.md の「テストが通っただけで
完了にしない」の分が残っています。以下を --lang en / --lang ja、80 桁と 160 桁で:

  • Work: j / k / enter → 詳細
  • 詳細: o / c / xy / l / a / v / d
  • diff: j / k / cctrl+s / v / X
  • Repos: tabjenter → 詳細 → o

Part 2 に持ち越すもの

  • detail / diff の bool を enum に畳む、Update の case 分割、コード中の
    spec N / Task N 参照 26 箇所の削除、画面をまたぐシナリオテスト
  • 既知の未解決 2 件: 詳細画面の c が開かないことがある(再現せず)、
    --repo を渡しても Work タブが出る

🤖 Generated with Claude Code

kukv and others added 10 commits September 7, 2026 03:22
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…sections

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>
.claude/rules/go-style.md keeps a comment only for an external fact, for why
odd-looking code is right, or as a doc comment on an exported identifier.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…l order into it

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…e out how every recording was taken

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

This comment has been minimized.

.claude/rules/go-style.md keeps a comment for an external fact, for why
odd-looking code is right, or as a doc comment on an exported identifier.
The design rationale this branch had written into internal/usecase and the
views' interfaces is none of those; it lives in the design and the rules.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Code Metrics Report

Coverage Test Execution Time
88.2% 37s

Code coverage of files in pull request scope (84.5%, patch 75.3%)

Files Coverage Patch Coverage
cmd/octoscope/main.go 0.0% 0.0%
internal/gh/cli/cli.go 70.6% -
internal/gh/cli/diff.go 97.0% 100.0%
internal/gh/cli/review.go 94.8% 88.2%
internal/gh/gh.go 100.0% 100.0%
internal/tui/detail/detail.go 91.1% 100.0%
internal/tui/detail/render.go 95.6% 100.0%
internal/tui/diff/comment.go 94.8% 100.0%
internal/tui/diff/diff.go 79.3% -
internal/tui/review/review.go 84.7% 100.0%
internal/usecase/review.go 81.2% 70.0%
internal/usecase/usecase.go 64.7% 54.6%

Reported by octocov

@kukv

kukv commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

テストコメント

@kukv kukv added the Kind: Refactoring 内部的なリファクタリング(APIの破壊的変更を伴わない範囲) label Sep 7, 2026
@kukv kukv self-assigned this Sep 7, 2026
Comment thread internal/gh/gh.go
for i := range sections {
sections[i] = WorkSection(i)
}
return sections

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

テストレビューコメント

@kukv
kukv merged commit 94dc57e into main Sep 7, 2026
3 checks passed
@kukv
kukv deleted the worktree-eventual-singing-gem branch September 7, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kind: Refactoring 内部的なリファクタリング(APIの破壊的変更を伴わない範囲)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant