Repository navigation
Conversation
|
@cursor review |
53c8335 to
9b329a1
Compare
72f2fd5 to
3fcafb3
Compare
There was a problem hiding this comment.
The full-scan path is solid. The count cross-check against flake8 is a good guard, and the tests pass locally (36 passed). --files mode has two problems I'd fix before the CI job starts relying on this file:
-
Renames silently orphan entries and drop reviewed statuses. In
main,kept_entrieskeeps every old entry whose path isn't inrescan_paths, even when that file no longer exists. I reproduced it: generate a baseline, rename the endpoint file, then run--files <new path>, which is what a defaultgit diff --name-onlygives you. The file then has both the old-path entry and a newdebt-breakingentry for the new path. Anyacceptedstatus or reason on the old entry is gone without a warning, and the summary says0 fixed. The PR description calls out--no-renamesas the workaround, but a convention that fails silently will get missed. A simple fix: in--filesmode, also treat any kept entry whoseargs.root / entry["path"]no longer exists as removed, so it shows up under "fixed". Even better, warn when a removed and an added entry share the same(rule, scope, key), so someone can carry the status over by hand. Please add a test for the rename case. -
Bad
--filesinput is ignored, or it crashes. Paths that don't start withsrc/or end in.pyare dropped silently. A typo likesentry/api/endpoints/foo.pyprintsRescanned 0 filesand exits 0, so a CI or pre-commit caller can't tell that nothing happened. An absolute path inside a--rootcheckout also raises an uncaughtValueErrorfromnormalize_path, because it resolves against the current checkout, not--root. Print every skipped path to stderr. Consider returning 1 when none of the given paths were usable, and normalize againstargs.root(or catch theValueErrorand report it as a bad path).
One non-blocking note: entries are dict[str, object] everywhere. That's why you need assert isinstance(count, int) and str(...) casts. It also gives you two separate ideas of identity: BaselineSignature for findings and the tuple from _entry_signature for entries, plus matching _sort_key and _entry_sort_key. An ExceptionEntry TypedDict, plus building entry identity through BaselineSignature, would remove the casts. It would also keep the two from drifting apart if signature normalization changes. Those asserts also disappear under python -O, so they can't be the only thing guarding the write.
The failing migration drift and openapi-diff checks look unrelated, since this PR touches no migrations or API code.
DominikB2014
left a comment
There was a problem hiding this comment.
I would double check we've accounted for all edge cases like file renames, deletions, moving, etc.
Addressed in 64036150457 (renamed/deleted files and bad --files paths). Follow-up review below.
There was a problem hiding this comment.
Follow-up on 64036150457: both earlier blockers are fixed.
- Renamed or deleted files:
--filesnow drops entries for files that no longer exist in--rootand reports them as fixed. You get a "Possibly moved" warning when a new entry matches on rule, scope and key, and a "Removed N entries" warning when the gone file wasn't listed. With the new tests (renamed listed, renamed unlisted), a plaingit diff --name-onlyis safe now, so--no-renamesisn't needed. - Bad
--filesinput: each unusable path (outsidesrc/, not.py, outside--root, or missing with no entries, like a typo) is printed to stderr. The run exits 1 without writing when none are usable. Absolute paths outside the root no longer crash.
tests/tools/api_guidelines passes (62 tests) at this commit. The ExceptionEntry TypedDict suggestion is fine to leave for a follow-up.
The failing getsentry / backend checks come from the branch being behind master: missing sentry_protos billing modules and SalesConfig.soft_caps. They're not caused by this diff and should clear after a rebase.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6403615. Configure here.
yeah thanks for bringing this up, I'd originally handled renames by having devs pass |
6403615 to
a8383f4
Compare
|
This PR is too large for Bugbot to review. It changes 46,776 lines and 3,737,259 characters. Split the change into smaller pull requests to get a review. |
…ceptions baseline
…only baselined rules there

This PR introduces
make api-baseline, a new make command that writes every S025-S028 finding toapi_exceptions/exceptions.json. The report card and the upcoming CI job will read from this file. The scan and owner lookup it uses are in #131117. Each entry is one finding (an error founds by flake) signature (rule, path, scope, key) with its count, owner, status, reason and when it was first seenHere's a list of the arguments that can be passed in:
--filesonly rescans the files you pass and keeps everything else as is. Existing entries keep their status, reason and first_seen. It prints what's new, fixed, or changed--rootscans another checkout (i.e, an older commit) with the current rules (used for demoing)--forceis needed to regenerate the whole file since that resets statusesRenames, deletions, and bad paths with --files:
git diff --name-onlyworks and--no-renamesisn't needed anymore