Skip to content

feat(commands): shared PR-comment command-handler preamble helper - #3831

Closed
jimcody1995 wants to merge 1 commit into
JSONbored:mainfrom
jimcody1995:feat/classify-pr-command-request-2161
Closed

feat(commands): shared PR-comment command-handler preamble helper#3831
jimcody1995 wants to merge 1 commit into
JSONbored:mainfrom
jimcody1995:feat/classify-pr-command-request-2161

Conversation

@jimcody1995

Copy link
Copy Markdown
Contributor

Summary

  • Add pure classifyPrCommandRequest(payload, installationId) for PR-thread @gittensory command webhooks.
  • Return a discriminated ok/skip union with stable skip reasons matching maybeProcessGateOverrideCommand: unsupported_comment_action, bot_author, missing_repo_pr_installation_or_actor.
  • Add exhaustive unit tests; no handler wiring in this slice (per issue scope).

Fixes #2161

Scope

Validation

  • git diff --check
  • npx vitest run test/unit/classify-pr-command-request.test.ts — 4 passed

Conflict avoidance

New files only (src/github/classify-pr-command-request.ts, test/unit/classify-pr-command-request.test.ts). Zero file overlap with open PRs #3826, #3829, #3823 — should merge cleanly after those land without rebase.

Made with Cursor

Extract the shared PR-comment webhook guards (created action, non-bot
author, repo/PR/installation/actor present) into a testable classifier
mirroring classifyPlanCommandRequest, without wiring handlers yet.

Fixes JSONbored#2161

Co-authored-by: Cursor <cursoragent@cursor.com>
@jimcody1995
jimcody1995 requested a review from JSONbored as a code owner July 6, 2026 13:37
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.41%. Comparing base (ca6a6d7) to head (7fba183).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3831   +/-   ##
=======================================
  Coverage   93.41%   93.41%           
=======================================
  Files         326      327    +1     
  Lines       32855    32867   +12     
  Branches    12035    12042    +7     
=======================================
+ Hits        30691    30703   +12     
  Misses       1530     1530           
  Partials      634      634           
Files with missing lines Coverage Δ
src/github/classify-pr-command-request.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 6, 2026
@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Caution

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

🛑 Gittensory review result - reject/close recommended

Review updated: 2026-07-06 13:46:36 UTC

2 files · 1 AI reviewer · 1 blocker · readiness 100/100 · CI green · clean

🛑 Suggested Action - Reject/Close

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.

Review summary
This adds a small, pure classifier `classifyPrCommandRequest` plus an exhaustive unit test suite (4 tests, 3 skip-reason branches + ok branch) for PR-thread @​gittensory command webhooks, explicitly not wiring it into any handler per the stated issue scope. The logic is straightforward and the tests actually exercise the real branches (action check, bot-author via user.type/sender.type/[bot] suffix regex, and the combined missing-repo/PR/installation/actor guard), matching the described skip reasons used by `maybeProcessGateOverrideCommand`. No defects found; the main open question is that this new module has zero callers yet, so its correctness can't be confirmed against real handler wiring until a follow-up PR integrates it.

Nits — 5 non-blocking
  • src/github/classify-pr-command-request.ts is unused dead code in this PR (no handler wires it up yet) — fine per the stated 'no wiring in this slice' scope, but worth flagging so it isn't merged and forgotten.
  • The bot-detection logic (comment.user.type === 'Bot' || sender.type === 'Bot' || /\[bot\]$/i.test(actor)) duplicates what presumably already exists in maybeProcessGateOverrideCommand — consider extracting a shared isBotActor() helper to avoid the two implementations drifting apart.
  • The ok:true issue.title/body types are `string | null | undefined` but the code passes through payload.issue.title/body as-is with no normalization — worth confirming GitHubWebhookPayload's issue shape actually allows null so this compiles as intended (CI passed, so likely fine, just worth a comment noting the pass-through is intentional).
  • The regex `/\[bot\]$/i` will also match a human login someone crafted to literally end in `[bot]` in mixed-case form, which is already GitHub's own bot-login convention, so this is effectively equivalent to GitHub's own suffix check — no actual issue, just note for future readers unfamiliar with the convention.
  • Add a short doc note or TODO pointing to the future PR/issue that will wire classifyPrCommandRequest into the actual comment-command handler, so reviewers of this PR and future ones can trace the integration.

Why this is blocked

  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewer
Linked issue ✅ Linked #2161
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 132 registered-repo PR(s), 90 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jimcody1995; Gittensor profile; 132 PR(s), 0 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: jimcody1995
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript, JavaScript
  • Official Gittensor activity: 132 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Gittensory is closing this pull request on the maintainer's behalf (Linked issue overlaps another open PR; duplicate of another open PR). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(commands): shared PR-comment command-handler preamble helper (bot/action/missing-target skip recording)

1 participant