Skip to content

feat(seer): Stub inbound upsert_pr_metrics_summary RPC#116673

Draft
vaind wants to merge 2 commits into
masterfrom
ivandlugos/core-201-stub-inbound-seer-rpc-handlers-register_pr_attribution
Draft

feat(seer): Stub inbound upsert_pr_metrics_summary RPC#116673
vaind wants to merge 2 commits into
masterfrom
ivandlugos/core-201-stub-inbound-seer-rpc-handlers-register_pr_attribution

Conversation

@vaind
Copy link
Copy Markdown
Contributor

@vaind vaind commented Jun 2, 2026

Adds an inbound handler to the seer-rpc surface (next to send_seer_webhook) so the Seer side has a real, signed endpoint to integrate against before the PR-metrics storage and full logic land. Part of the PR Merge Live Metrics project (M0).

What this adds

  • upsert_pr_metrics_summary(organization_id, repository_id, pr_number, event_id, verdict, counters, refined_attribution_signals?) — Seer's judge-summary callback at PR close/merge, registered under a new "PR Merge Live Metrics" section in seer_method_registry.

Behavior

This is intentionally a validate-and-acknowledge stub. The handler:

  • validates the required payload fields are present/non-empty;
  • resolves the repository scoped to the organization via the canonical repository_service.get_repository(...) (IDOR-safe — returns "Repository not found" on mismatch or missing);
  • logs structured context and returns {"success": True} (graceful {"success": False, "error": ...} on validation failure, matching the send_seer_webhook contract).

Actual persistence is left as an in-code TODO. The PullRequest field extensions and the new PullRequestAttribution / PullRequestMetrics tables land separately in CORE-200 (in progress); the full write follows in M1/M3 (CW-1436).

Note on the dropped register_pr_attribution

An earlier revision of this PR also stubbed register_pr_attribution (a push channel for Seer to report PRs it created). That was dropped: Seer already emits the existing seer.pr_created event (SentryAppEventType.SEER_PR_CREATED) on PR creation, carrying the PR id/number/url, repo, and run_id — so Sentry already learns about Seer-created PRs over the existing webhook channel and a dedicated push RPC is redundant. The inbound seer-rpc surface for this project is therefore upsert_pr_metrics_summary only.

🚧 Draft — holding until the model migration (CORE-200) lands, then the TODO becomes a real write.

Refs CORE-201

…summary RPCs

Add two accept-and-acknowledge handlers to the seer-rpc surface so the Seer
side has a real, signed endpoint to integrate against before the PR-metrics
storage and full logic land. Both validate the org-scoped repository (via
repository_service.get_repository) and the required payload fields, log
structured context, and return {"success": True}; the actual persistence is
left as in-code TODOs because the PullRequest extensions and the new
PullRequestAttribution / PullRequestMetrics tables land separately in CORE-200,
with the full handler logic following in M1/M2/M3.

PRs are identified externally by organization_id + repository_id + pr_number;
repository_id already pins the provider, so no separate provider field.

Refs CORE-201
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 2, 2026

CORE-201

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 2, 2026
… covers PR creation

register_pr_attribution turned out to be unnecessary. Seer already emits the
existing seer.pr_created event (SentryAppEventType.SEER_PR_CREATED) when a run
creates a PR, and its payload carries the PR id/number/url, repo, and run_id —
everything the push RPC was meant to deliver. Sentry therefore already learns
about Seer-created PRs over the existing webhook channel, so a dedicated push
handler is redundant.

The inbound seer-rpc surface for PR-metrics reduces to upsert_pr_metrics_summary,
the judge-verdict callback, which has no alternative source.

Refs CORE-201
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vaind vaind changed the title feat(seer): Stub inbound register_pr_attribution & upsert_pr_metrics_summary RPCs feat(seer): Stub inbound upsert_pr_metrics_summary RPC Jun 2, 2026
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.

1 participant