Skip to content

feat(apidocs): Add a per-team API report card - #131135

Merged
akhilp117 merged 3 commits into
masterfrom
akhilpindiprolu/eng-9043-build-a-per-team-api-report-card-v0
Nov 18, 2026
Merged

akhilp117 merged 3 commits into
masterfrom
akhilpindiprolu/eng-9043-build-a-per-team-api-report-card-v0

Conversation

@akhilp117

@akhilp117 akhilp117 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Linear issue

Stacked on #131117 (the shared scan and owner lookup) so that one needs review firstt.

This adds make api-report-card, which shows each team its existing API lint findings, so every piece of API debt has a visible owner. It scans src/ with collect_findings and finds each finding's team with owner_for. It doesn't need a baseline or any exceptions.

What it prints

  • A header with the total, the owner map's date (the file's modification time, since the map has no date inside it) and how many findings are unowned, so a stale map is easy to spot
  • A table with one row per team, sorted by findings, with a column per rule and the number of files. unowned is always its own row, last, even when it's 0
  • The rule columns are S025-S028 always (S027 has 0 findings but is still checked), plus any other API rule that has findings. So S034 and S021-S023 show up on their own once they report structured output. Until then the header lists them as having no structured findings, so nobody reads them as clean

Options (through ARGS)

  • ARGS="--team issues-feed": that team's findings, one per line (file:line rule key in Class.method), sorted by file and line
  • ARGS="--format markdown": the same table as markdown, for docs and PR comments

On master today: 293 findings in 78 files across 18 teams, plus 24 unowned findings in 7 files under src/sentry/core/endpoints/

Not in v0: the legacy vs new split and statuses (they depend on how exceptions get stored), trends over time, and running in CI (which needs a decision on where the owner map comes from)

@akhilp117
akhilp117 requested review from a team as code owners November 13, 2026 21:18
@linear-code

linear-code Bot commented Nov 13, 2026

Copy link
Copy Markdown

ENG-9043

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 13, 2026
@akhilp117 akhilp117 self-assigned this Nov 16, 2026
@akhilp117
akhilp117 changed the base branch from akhilpindiprolu/eng-8866-add-api-findings-scan to akhilpindiprolu/eng-8866-put-every-existing-api-flake-error November 16, 2026 19:49
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9043-build-a-per-team-api-report-card-v0 branch 2 times, most recently from 2f4dd66 to 33040d8 Compare November 16, 2026 20:55

@DominikB2014 DominikB2014 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.

lgtm, i'm not sure if we need so many tests, particularly for the format output as i imagine we'll iterate on that, but i suppose it's fine to keep

@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-8866-put-every-existing-api-flake-error branch from 6403615 to a8383f4 Compare November 18, 2026 03:51
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9043-build-a-per-team-api-report-card-v0 branch from 33040d8 to 63ac012 Compare November 18, 2026 03:54
@sentry

sentry Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
0 0 0 0 1006 0 ✅ Unchanged

⚙️ sentry-frontend Snapshot Settings

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 63ac012. Configure here.

Comment thread tools/api_guidelines/report_card.py Resolved
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-8866-put-every-existing-api-flake-error branch from dbba651 to e3b773c Compare November 18, 2026 04:34
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9043-build-a-per-team-api-report-card-v0 branch from 63ac012 to da903bf Compare November 18, 2026 04:34
Base automatically changed from akhilpindiprolu/eng-8866-put-every-existing-api-flake-error to master November 18, 2026 04:48
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9043-build-a-per-team-api-report-card-v0 branch from 147e306 to c9f8fcd Compare November 18, 2026 04:49
@akhilp117
akhilp117 merged commit db64fe1 into master Nov 18, 2026
77 checks passed
@akhilp117
akhilp117 deleted the akhilpindiprolu/eng-9043-build-a-per-team-api-report-card-v0 branch November 18, 2026 05:00
akhilp117 added a commit that referenced this pull request Nov 18, 2026
…mpare (#131407)

[Linear issue](https://linear.app/getsentry/issue/ENG-9065)

The report card now reads `exceptions.json` instead of scanning `src/`
every time, so it's instant and doesn't need the owner map or Redis
(this PR is stacked on #131135)

- Counts and owners come straight from each entry, so the report card
shows exactly what's recorded in the file
- `--compare older.json` shows what's new, fixed, or changed count since
an older `exceptiuons.json`, grouped by team
- `exceptions.json` now has a `generated` date at the top, so the report
card can say when the file is from and what it's comparing against
- Moved the entry helpers (`diff_entries`, `merge_entries`,
`describe_entry`) into `entries.py` so the generator and the report card
share them
BYK added a commit that referenced this pull request Nov 20, 2026
Refs #131073

Our OpenAPI docs drift from what endpoints actually return, and nothing
catches it. This compares the responses tests get from **public**
operations with the schema drf-spectacular generates from the code:

- **S036**: the status isn't in the operation's `responses`
- **S037**: the JSON body doesn't match that status's schema

304, 429 and 5xx are exempt: a 304 only answers a conditional request,
the rate limiter can return a 429 from any endpoint, and a 5xx is a bug
rather than part of the contract. S035 is taken by
#130924.

This stands alone and doesn't touch the API guidelines work in
#131117 → #131088 →
#131135 → #131407. Findings use the same
signature (endpoint file, `EndpointClass.method`, `status:<code>`,
owner) and entry shape as that stack's `exceptions.json`, which is where
the baseline goes once the stack lands.

The pytest plugin is opt-in, with two modes. Report mode records
findings and annotates endpoints whose findings aren't baselined. Strict
mode also fails the test that got one. The schema is generated while
xdist workers start, so it always matches the code and doesn't need
node.

A new baseline tool adds a run's findings to a baseline file. It only
touches the endpoint methods that run called, and keeps reviewed
statuses.

Backend CI runs in report mode, so nothing blocks merges. CI moves to
strict mode together with the baseline.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3A3bcd89ea85721d16b9af505e -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/local%3Aweb%3A3bcd89ea85721d16b9af505e)
[[Sentry]](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A3bcd89ea85721d16b9af505e/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>
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