You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mirrors the FP cases (FP-46826/46827/46828/46829/46831) as Python test
files so the permissive test-file rubric can be exercised end-to-end.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Defects that should remain reportable even when AI Review applies the
permissive test-file rubric from ENG-4588 (mutable default arg, SQL
injection, identity-vs-equality, file handle leak, off-by-one,
unreachable code, assert-for-auth).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
We reviewed changes in 9d1323c...405518c on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
The constant assertTrue and the unreachable self.fail() both point to tests that execute code but don’t actually verify the outcome.
Given how focused the rest of the suite is, it’s worth making sure every test has a clear, reachable assertion of behavior, not just that “it runs.”
Subtle nondeterminism in tests
The mutable default seen=[], off‑by‑one range(len(...)+1), and is on strings all introduce hidden, order‑dependent or runtime‑dependent behavior.
Since these are tests, small nondeterminisms can make failures hard to reproduce; tightening these up keeps the suite as reliable as the behaviors it’s checking.
The reason will be displayed to describe this comment to others. Learn more.
Passing constant to `assertTrue` makes test pointless
The assertTrue(True) call always passes because the condition is a constant true value, providing no real assertion or verification in test logic. This makes the test meaningless as it cannot fail and does not validate any behavior.
Replace assertTrue with an actual conditional expression or use a more appropriate assertion like assertEqual with meaningful variables to ensure the test validates intended logic properly.
The reason will be displayed to describe this comment to others. Learn more.
Unused variable `path` adds code clutter
The variable path is extracted from PROTECTED_ROUTES[i] but is not used anywhere in the surrounding code, which wastes memory and can confuse developers about its purpose.
Remove the path variable or replace its name with _ to indicate that it is intentionally unused, clarifying the code's intent.
The reason will be displayed to describe this comment to others. Learn more.
Unreachable `self.fail()` call indicates dead code
The statement self.fail("audit role check did not short-circuit") will never execute because previous control flow paths prevent reaching it, indicating dead code that adds confusion and maintenance overhead. Such unreachable code may mask logic errors or lead to misunderstandings. Remove or refactor to ensure all statements are reachable and meaningful.
Remove the unreachable self.fail() call or adjust control structures so this statement is reachable and correctly signals failure when intended.
The reason will be displayed to describe this comment to others. Learn more.
`is` on string literals causes nondeterministic matching
The list filter uses r[1] is "/healthz", which compares identities instead of values. Python string interning is implementation-dependent, so route detection can become flaky across runtimes.
Replace identity comparison with value comparison using ==
The reason will be displayed to describe this comment to others. Learn more.
`range(len(...)+1)` triggers `IndexError`
The index-based loop overruns PROTECTED_ROUTES by one, so the test errors instead of validating route scope. This produces unstable test outcomes and masks intent.
Replace the bound with range(len(PROTECTED_ROUTES)) or iterate directly over PROTECTED_ROUTES to avoid out-of-range access
The reason will be displayed to describe this comment to others. Learn more.
`seen=[]` persists across calls, breaking test isolation
_record_seen keeps shared state between calls, so test_recorder_accumulates_payloads receives prior payloads instead of a fresh list. This makes the test non-deterministic and can fail based on execution order.
Replace the mutable default with None, then initialize seen = [] inside the function.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.