Skip to content

ref(pr-metrics): Scope sender and SHA fields to payload types that need them#119000

Merged
giovanni-guidini merged 2 commits into
masterfrom
gio/feat/pr-metrics-scoped-payloads
Jul 3, 2026
Merged

ref(pr-metrics): Scope sender and SHA fields to payload types that need them#119000
giovanni-guidini merged 2 commits into
masterfrom
gio/feat/pr-metrics-scoped-payloads

Conversation

@giovanni-guidini

Copy link
Copy Markdown
Contributor

Reduces the size of PullRequestActivity rows by removing fields from the stored JSON payload that specific event types don't need. sender_login, sender_type, head_sha, and base_sha are moved out of the base payload class and into only the individual payload types that actually use them.

Refs CORE-265

…ed them

Remove sender_login, sender_type, head_sha, and base_sha from
BaseActivityPayload and push them down to only the payload types that
actually carry those fields. AutoMergeEnabled/Disabled, Enqueued, and
Dequeued payloads never used sender or SHA context; CheckSuite/CheckRun
payloads don't expose sender or head SHA either.

Update _build_activity_payload to use a sender_kw dict (without SHA
fields) and pass head_sha/base_sha only to OpenedPayload. Remove
sender_login/sender_type/head_sha from CheckSuiteCompletedPayload and
CheckRunCompletedPayload construction. Drop now-unused sender variables
in handle_check_suite and handle_check_run.

Update tests to no longer assert head_sha or sender_type on check suite
and check run activity rows.

Co-Authored-By: Claude Sonnet 4 <noreply@example.com>
@linear-code

linear-code Bot commented Jul 3, 2026

Copy link
Copy Markdown

CORE-265

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 3, 2026
@giovanni-guidini giovanni-guidini marked this pull request as ready for review July 3, 2026 11:34
@giovanni-guidini giovanni-guidini requested a review from vaind July 3, 2026 11:34

@vaind vaind left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a good candidate for Mixin but i'm fine with the current state too

Copy link
Copy Markdown
Contributor Author

Oh great idea, actually. Let's do that.

…der identity

Replace the repeated sender_login/sender_type field pair across twelve payload
classes with a SenderMixin dataclass. Payload types that don't record sender
context (CheckSuite, CheckRun, AutoMerge, Enqueued, Dequeued) are unchanged.

Co-Authored-By: Claude Sonnet 4 <noreply@example.com>
@giovanni-guidini giovanni-guidini merged commit 9882577 into master Jul 3, 2026
67 checks passed
@giovanni-guidini giovanni-guidini deleted the gio/feat/pr-metrics-scoped-payloads branch July 3, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants