Skip to content

fix(autopilot): sticky コメントのマーカー統一で重複投稿を防ぐ (#809)#810

Merged
takaokouji merged 1 commit into
developfrom
topic/autopilot-809
Jun 28, 2026
Merged

fix(autopilot): sticky コメントのマーカー統一で重複投稿を防ぐ (#809)#810
takaokouji merged 1 commit into
developfrom
topic/autopilot-809

Conversation

@smalruby3-editor-bot

Copy link
Copy Markdown

Summary

PR #761(甲子園 Epic)で autopilot status sticky が 2 つ投稿された不具合を修正する。
原因は sticky コメントの識別マーカーが 2 種類に分裂していたこと:

daemon が既存 sticky を自分のマーカーでしか検索しないため、別マーカーの既存 sticky を
見つけられず新規投稿し、重複していた。

Changes Made

  • マーカーをコントラクト仕様 autopilot-sticky-status に統一(実装を spec に合わせる)。
    renderSticky は正準マーカーのみを出力する。
  • 旧マーカー autopilot:sticky は legacy として検出対象に残し、両マーカーにマッチさせて
    既存 sticky を in-place 更新する(STICKY_MARKERS / isStickyComment / selectStickyCommentIds)。
  • upsertStickyComment を、両マーカーで検出 → 複数あれば先頭を PATCH・残りを DELETE して
    1 つに集約する実装に変更(重複を作らない・既存を吸収)。
  • コメント本文取得を listIssueComments@base64 経由で改行安全)に切り出した。

Test Coverage

  • isStickyComment / selectStickyCommentIds両マーカーにマッチする unit test を追加。
  • STICKY_MARKER が正準マーカーであること、renderSticky が legacy を出力しないことを検証。
  • 既存テスト(daemon の sticky マーカー検証)を新マーカーに更新。
  • node --test: 75 passed / 0 failed。

Related Issues

Closes #809

🤖 Generated with Claude Code

daemon の sticky upsert は正準マーカー autopilot-sticky-status と旧マーカー

autopilot:sticky の両方にマッチし、既存 sticky を in-place 更新する。複数検出

時は先頭を残して残りを削除し 1 つに集約する。検出は純粋関数 isStickyComment /

selectStickyCommentIds に切り出し unit test を追加。renderSticky はコントラクト

仕様の正準マーカーを出力するよう統一した。

Closes #809

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@smalruby3-editor-bot smalruby3-editor-bot Bot added the 🤖 autopilot autopilot(AI)が管理する PR/Issue(AI処理対象) label Jun 28, 2026
@smalruby3-editor-bot

smalruby3-editor-bot Bot commented Jun 28, 2026

Copy link
Copy Markdown
Author

🤖 autopilot status

field value
Status Review
AI Status
HITL No
Size small

Linked issue #809. Maintained by autopilot (single writer); do not edit.

@smalruby3-editor-bot

Copy link
Copy Markdown
Author

🤖 autopilot 敵対的レビュー結果

別レビュアー視点で差分を検証しました。自動修正が必要な明白な問題はなし。人間レビューへ渡します。

確認した観点と結果

観点 結果
正確性 listIssueComments の base64 パースは空ボディ (id のみの行) でもクラッシュしない。selectStickyCommentIds は入力順(= GitHub の作成日時昇順)を保持し、upsertStickyComment最古を残して PATCH・残りを DELETE するため重複が 1 つに収束する。
セキュリティ gh()execFileSync('gh', args[])(シェル非経由)で引数配列、body-f body=... で 1 引数として渡すため injection なし。jq フィルタは静的文字列。
マーカー統一 ✅ 正準 autopilot-sticky-status に統一。旧 autopilot:sticky は legacy として吸収対象に残置。リポジトリ内に未更新の旧マーカー参照は無し(contract は marker 文字列リテラルを規定しておらず同期不要)。
テスト ✅ 検出系の純粋関数(isStickyComment / selectStickyCommentIds / マーカー定数 / renderSticky)を網羅。75 passed / 0 failed。

軽微な指摘(非ブロッカー・対応不要)

  • upsertStickyComment の集約ループ(PATCH 先頭 + DELETE 残り)に直接の unit test が無い。 ただし判定ロジックは純粋関数 selectStickyCommentIds に切り出し済みでテスト済み、daemon.test.js 側は本関数をモックしている。project.js は module レベルの gh を直接呼ぶ構造で注入テストには refactor が要るため、レビュー段階での強制修正は見送り。
  • legacy sticky が人手投稿だった場合 daemon が DELETE するが、これは Issue fix(autopilot): sticky コメントのマーカー不一致で重複投稿される #809 が意図する「1 つに集約」の挙動であり想定内。

LGTM。

@smalruby3-editor-bot smalruby3-editor-bot Bot added the 🙋 HITL 人間の対応待ち(レビュー/判断/マージ) label Jun 28, 2026
@smalruby3-editor-bot smalruby3-editor-bot Bot marked this pull request as ready for review June 28, 2026 23:05
@takaokouji takaokouji removed the 🙋 HITL 人間の対応待ち(レビュー/判断/マージ) label Jun 28, 2026
@smalruby3-editor-bot smalruby3-editor-bot Bot marked this pull request as draft June 28, 2026 23:18
@takaokouji takaokouji marked this pull request as ready for review June 28, 2026 23:24
@smalruby3-editor-bot smalruby3-editor-bot Bot marked this pull request as draft June 28, 2026 23:28
@takaokouji takaokouji marked this pull request as ready for review June 28, 2026 23:59
@takaokouji takaokouji merged commit 1775c39 into develop Jun 28, 2026
2 checks passed
@takaokouji takaokouji deleted the topic/autopilot-809 branch June 28, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 autopilot autopilot(AI)が管理する PR/Issue(AI処理対象)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(autopilot): sticky コメントのマーカー不一致で重複投稿される

1 participant