Skip to content

fix: add sender.id to GitHub webhook payload types#533

Merged
ColeMurray merged 2 commits intomainfrom
pre-step-3/github-sender-id-type
Apr 22, 2026
Merged

fix: add sender.id to GitHub webhook payload types#533
ColeMurray merged 2 commits intomainfrom
pre-step-3/github-sender-id-type

Conversation

@ColeMurray
Copy link
Copy Markdown
Owner

@ColeMurray ColeMurray commented Apr 22, 2026

Summary

  • Adds id: number to sender on all 4 webhook payload types: PullRequestOpenedPayload, ReviewRequestedPayload, IssueCommentPayload, ReviewCommentPayload
  • GitHub webhooks include sender.id (numeric user ID) alongside sender.login — the type definitions were missing it
  • Type-only change, no runtime behavior change

Pre-step 3 of the unified user model migration (pre-steps doc). The main migration will forward sender.id as actorProviderUserId for consistent identity linking with the web OAuth path (which already uses the numeric GitHub user ID).

Test plan

  • npm run typecheck -w @open-inspect/github-bot passes
  • npm test -w @open-inspect/github-bot — all 100 tests pass

Summary by CodeRabbit

  • Chores
    • Updated internal webhook payloads to include sender numeric identifiers alongside existing login names.
    • Aligned test fixtures and loop-prevention tests with the updated payload shape to ensure consistent behavior.

GitHub webhook payloads include sender.id (numeric user ID) alongside
sender.login. The type definitions only modeled login. Adding id to
all four payload types so the main migration can forward it as the
actorProviderUserId for consistent identity linking with the web
OAuth path.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1277a714-80a5-4e4b-b7a6-6811054afbd9

📥 Commits

Reviewing files that changed from the base of the PR and between 3b9f1e6 and b542c09.

📒 Files selected for processing (1)
  • packages/github-bot/test/handlers.test.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/github-bot/test/handlers.test.ts

📝 Walkthrough

Walkthrough

Updated the sender field type definition across four webhook payload interfaces in the GitHub bot types file, extending each from { login: string } to { login: string; id: number } to include a numeric user identifier.

Changes

Cohort / File(s) Summary
Webhook Payload Type Updates
packages/github-bot/src/types.ts
Extended the sender field in PullRequestOpenedPayload, ReviewRequestedPayload, IssueCommentPayload, and ReviewCommentPayload interfaces to include id: number alongside login: string.
Test Fixture Updates
packages/github-bot/test/handlers.test.ts
Updated webhook test payloads to include numeric sender.id in PR open, review requested, issue comment, and review comment fixtures (including bot sender overrides).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • open-inspect

Poem

🐰 I hopped through types to add an id so true,
The sender now has numbers along with name and cue,
Tests updated, fixtures aligned in stride,
A tiny change — I dance and glide! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding the sender.id field to GitHub webhook payload types, which is exactly what the changeset accomplishes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pre-step-3/github-sender-id-type

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Terraform Validation Results

Step Status
Format
Init
Validate

Note: Terraform plan was skipped because secrets are not configured. This is expected for external contributors. See docs/GETTING_STARTED.md for setup instructions.

Pushed by: @ColeMurray, Action: pull_request

Copy link
Copy Markdown
Contributor

@open-inspect open-inspect Bot left a comment

Choose a reason for hiding this comment

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

Summary

This PR #533 (fix: add sender.id to GitHub webhook payload types) by @ColeMurray updates the four narrowed GitHub webhook payload interfaces in packages/github-bot/src/types.ts to include sender.id, matching the webhook schema without changing runtime behavior. I reviewed the single changed file (1 file changed, +4/-4) and did not find correctness, security, performance, or maintainability issues in the diff.

Critical Issues

None.

Suggestions

None.

Nitpicks

None.

Positive Feedback

  • The change is tightly scoped to the type surface and stays aligned with the stated migration step.
  • Adding the numeric GitHub user ID now reduces the chance of propagating incomplete webhook typings into later identity-linking work.
  • Keeping this as a type-only update avoids unnecessary runtime churn.

Questions

None.

Verdict

Approve: Ready to merge, no blocking issues.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/github-bot/src/types.ts (1)

44-108: Optional: consider extracting a shared Sender (and Repository) type.

The sender: { login: string; id: number } shape is now duplicated across all four payload interfaces, as is repository: { owner: { login: string }; name: string; private: boolean }. Extracting a shared alias would make future additions (e.g., forwarding more sender.* fields in the upcoming unified user model migration referenced in the PR) a single-line change rather than four.

♻️ Example extraction
+interface WebhookSender {
+  login: string;
+  id: number;
+}
+
+interface WebhookRepository {
+  owner: { login: string };
+  name: string;
+  private: boolean;
+}
+
 export interface PullRequestOpenedPayload {
   action: "opened";
   pull_request: { /* ... */ };
-  repository: { owner: { login: string }; name: string; private: boolean };
-  sender: { login: string; id: number };
+  repository: WebhookRepository;
+  sender: WebhookSender;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/github-bot/src/types.ts` around lines 44 - 108, Extract a shared
Sender and Repository type and use them in the four payload interfaces to
eliminate duplication: define e.g. type Sender = { login: string; id: number }
and type Repository = { owner: { login: string }; name: string; private: boolean
} (or export interfaces) and replace the inline shapes in
PullRequestOpenedPayload, ReviewRequestedPayload, IssueCommentPayload, and
ReviewCommentPayload with the new Sender and Repository types so future
additions require changing only those two definitions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/github-bot/src/types.ts`:
- Line 56: The test fixtures fail typecheck because the sender shape in types.ts
now requires sender: { login: string; id: number }; update all sender objects in
packages/github-bot/test/handlers.test.ts to include an id numeric field
alongside login (e.g., add id: 1 or another unique number per fixture) so they
conform to the Sender type; search for each occurrence of the sender literal in
that test file and add the id property to the object literals to resolve the
type error.

---

Nitpick comments:
In `@packages/github-bot/src/types.ts`:
- Around line 44-108: Extract a shared Sender and Repository type and use them
in the four payload interfaces to eliminate duplication: define e.g. type Sender
= { login: string; id: number } and type Repository = { owner: { login: string
}; name: string; private: boolean } (or export interfaces) and replace the
inline shapes in PullRequestOpenedPayload, ReviewRequestedPayload,
IssueCommentPayload, and ReviewCommentPayload with the new Sender and Repository
types so future additions require changing only those two definitions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 52a52421-8e58-49d1-a25b-85f5d5cadc13

📥 Commits

Reviewing files that changed from the base of the PR and between 03a0596 and 3b9f1e6.

📒 Files selected for processing (1)
  • packages/github-bot/src/types.ts

Comment thread packages/github-bot/src/types.ts
Update all six sender objects in handlers.test.ts to include the
id field, matching the updated payload types.
@github-actions
Copy link
Copy Markdown

Terraform Validation Results

Step Status
Format
Init
Validate

Note: Terraform plan was skipped because secrets are not configured. This is expected for external contributors. See docs/GETTING_STARTED.md for setup instructions.

Pushed by: @ColeMurray, Action: pull_request

@ColeMurray
Copy link
Copy Markdown
Owner Author

Re: the nitpick on extracting shared WebhookSender / WebhookRepository types — I see the duplication, but I'd prefer to keep these inline for now. The types are intentionally narrow per-payload (the JSDoc calls this out) — today the shapes happen to be identical, but they don't need to stay that way as we extend individual payloads. For a 2-field type across 4 interfaces, the duplication cost is low and the decoupling benefit is worth it. If we end up adding more shared fields (e.g. avatar_url, node_id), that would be a better time to extract.

@ColeMurray ColeMurray merged commit 6307481 into main Apr 22, 2026
18 checks passed
@ColeMurray ColeMurray deleted the pre-step-3/github-sender-id-type branch April 22, 2026 06:20
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.

1 participant