Skip to content

feat(adapter): migrate pr_comment to platform adapter pattern (#245)#271

Merged
bakeb7j0 merged 1 commit into
mainfrom
feature/245-pr-comment-adapter
Apr 26, 2026
Merged

feat(adapter): migrate pr_comment to platform adapter pattern (#245)#271
bakeb7j0 merged 1 commit into
mainfrom
feature/245-pr-comment-adapter

Conversation

@bakeb7j0
Copy link
Copy Markdown
Contributor

Summary

Story 1.8 of the platform adapter retrofit: migrates handlers/pr_comment.ts from inline platform branching + direct execSync calls to the GitHub/GitLab adapter pattern. Handler shrinks from 182 lines to 51 lines (51% under the 80-line ceiling) and pr_comment.ts is removed from the migration allowlist (27 → 26 entries). Gate-greps now enforce the no-platform-branching invariant on this handler.

Changes

  • New lib/adapters/pr-comment-github.tsgh pr comment <num> --body <body> [--repo <slug>], parses #issuecomment-<id> from stdout
  • New lib/adapters/pr-comment-gitlab.tsglab mr note <num> --message <body> [-R <slug>], parses #note_<id>
  • New colocated tests lib/adapters/pr-comment-{github,gitlab}.test.ts — 6 subprocess-boundary tests each (12 total)
  • Refactored handlers/pr_comment.ts — pure adapter dispatcher, no execSync, no detectPlatform branching; spreads result.data into envelope to preserve top-level data.number / data.comment_id / data.url integration-test assertions
  • lib/adapters/types.ts — concrete PrCommentArgs / PrCommentResponse interfaces (replaced unknown)
  • lib/adapters/{github,gitlab}.ts — wired prComment adapter, dropped stub
  • lib/adapters/types.test.ts — added 'prComment' to MIGRATED_METHODS (now 6 entries)
  • scripts/ci/migration-allowlist.txt — removed pr_comment.ts (27 → 26)
  • tests/pr_comment.test.ts — single assertion update in execSync invocation matches gh CLI shape test (gitCalls filter matches unquoted git remote get-url, mirroring PR feat(adapter): migrate pr_status to platform adapter pattern (#244) #270 / pr_status precedent)

Linked Issues

Closes #245

Test Plan

  • Full ./scripts/ci/validate.sh — GREEN, 1573/0 across 96 files
  • Targeted: bun test tests/pr_comment.test.ts lib/adapters/pr-comment-github.test.ts lib/adapters/pr-comment-gitlab.test.ts — 30/30 pass (124 expect() calls)
  • Gate-greps: 47 non-allowlisted handlers checked, all OK (was 46 — pr_comment now enforced)
  • Migration allowlist: 26 entries (was 27)

Lifts GitHub + GitLab branches from handlers/pr_comment.ts into
lib/adapters/pr-comment-{github,gitlab}.ts. Handler shrinks to ~50-line
dispatcher. Refines PrCommentArgs / PrCommentResponse from unknown to
concrete shapes. Wires prComment into both assemblers, adds to
MIGRATED_METHODS, removes pr_comment.ts from migration-allowlist.

Closes #245
@bakeb7j0 bakeb7j0 added this pull request to the merge queue Apr 26, 2026
Merged via the queue into main with commit f16075e Apr 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Story 1.8: Migrate pr_comment

2 participants