Skip to content

feat(apidocs): Read the report card from exceptions.json and add --compare - #131407

Merged
akhilp117 merged 2 commits into
masterfrom
akhilpindiprolu/eng-9065-read-the-report-card-from
Nov 18, 2026
Merged

akhilp117 merged 2 commits into
masterfrom
akhilpindiprolu/eng-9065-read-the-report-card-from

Conversation

@akhilp117

@akhilp117 akhilp117 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Linear issue

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

@akhilp117
akhilp117 requested review from a team as code owners November 17, 2026 00:12
@linear-code

linear-code Bot commented Nov 17, 2026

Copy link
Copy Markdown

ENG-9065

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 17, 2026
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9065-read-the-report-card-from branch from 046d814 to a12f01b Compare November 17, 2026 00:34

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

Stale Bugbot comment from a previous run.

Comment thread tools/api_guidelines/report_card.py Resolved
@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
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9065-read-the-report-card-from branch from a12f01b to 6e1eba7 Compare November 18, 2026 03:55

@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 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

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 6e1eba7. Configure here.

Comment thread Makefile Resolved
Comment thread Makefile Resolved
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9065-read-the-report-card-from branch 2 times, most recently from 51eb0a8 to dd79ed5 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
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9065-read-the-report-card-from branch from dd79ed5 to a65c5d9 Compare November 18, 2026 04:39
@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 force-pushed the akhilpindiprolu/eng-9065-read-the-report-card-from branch from a65c5d9 to 94af43e Compare November 18, 2026 04:49
@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

Base automatically changed from akhilpindiprolu/eng-9043-build-a-per-team-api-report-card-v0 to master November 18, 2026 05:00
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9065-read-the-report-card-from branch from 94af43e to c380a3a Compare November 18, 2026 05:01
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9065-read-the-report-card-from branch 2 times, most recently from 5179580 to eeccb23 Compare November 18, 2026 05:30
@akhilp117
akhilp117 force-pushed the akhilpindiprolu/eng-9065-read-the-report-card-from branch from eeccb23 to 4e4b438 Compare November 18, 2026 05:45
@akhilp117 akhilp117 self-assigned this Nov 18, 2026

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

The changes make sense to me. One case to consider, i think this pr would make the owners frozen right? if a owner changes on an api, we aren't running django on the diff so we can't get the latest owner?

@akhilp117

Copy link
Copy Markdown
Contributor Author

The changes make sense to me. One case to consider, i think this pr would make the owners frozen right? if a owner changes on an api, we aren't running django on the diff so we can't get the latest owner?

we discussed this async, in this PR owners are frozen at whatever exceptions.json had when make api-baseline last ran, since the report card reads owner off each entry. the fix is in the CI ticket (this issue): every run does a full refresh, make api-owner-map && make api-baseline && make api-report-card for about 20s. so owners are never more than one run stale, and I'm dropping the changed-files-only path. if anyone wants an up-to-date card locally before then, they run those same 3 commands

@akhilp117
akhilp117 merged commit e2578fc into master Nov 18, 2026
77 checks passed
@akhilp117
akhilp117 deleted the akhilpindiprolu/eng-9065-read-the-report-card-from branch November 18, 2026 21:02
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