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>
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.
A few patterns (asserting on a constant True, unreachable self.fail(), unused locals) show places where the test structure doesn’t quite line up with the behavior it’s trying to exercise.
Since these files are about reproducing specific patterns, it’s worth keeping the examples “real” enough that they’d catch an actual regression.
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>
The reason will be displayed to describe this comment to others. Learn more.
`is` used for string comparison causes incorrect behavior
The expression r[1] is "/healthz" uses the is operator, which checks for object identity rather than string content equality. This may fail when strings have identical content but reside at different memory locations. Use == to compare string values for content equivalence.
Replace is with == in the condition to correctly compare strings and avoid logical errors.
The reason will be displayed to describe this comment to others. Learn more.
Constant `True` passed to `assertTrue` makes test meaningless
Passing a constant value like True to assertTrue causes the test to always pass regardless of actual code correctness, defeating the purpose of having a test. This results in meaningless tests that cannot catch failures or bugs.
Replace constant True with a valid conditional expression to verify real logic, or use more appropriate assertions like assertEqual when checking equality between values.
The reason will be displayed to describe this comment to others. Learn more.
Unused `path` variable adds unnecessary clutter
The variable path is extracted from PROTECTED_ROUTES[i] but is not used anywhere, which wastes memory and reduces code clarity. It may cause confusion as developers might expect it to be relevant to the logic.
Remove the unused path variable or rename it to _ if it's intentionally ignored to clarify this intent.
The reason will be displayed to describe this comment to others. Learn more.
Unreachable `self.fail()` call after control exit
The statement self.fail("audit role check did not short-circuit") is unreachable due to preceding control flow that prevents execution from reaching it. This means any intended error signaling or testing failure triggered by this call will never happen.
Remove or reposition the self.fail() statement to an executable part of the code to ensure the failure condition is properly caught and reported.
The reason will be displayed to describe this comment to others. Learn more.
Mutable default `seen` list causes shared state issues
Defining the default seen argument as a mutable list causes all calls to _record_seen without an explicit seen argument to share the same list object, accumulating values unexpectedly across calls. This can lead to bugs that are hard to trace as state persists beyond a single invocation.
Replace the mutable default seen=[] with seen=None and inside the function initialize it to an empty list to ensure each call uses a fresh list instance.
The reason will be displayed to describe this comment to others. Learn more.
`len(PROTECTED_ROUTES)+1` causes `IndexError` on final iteration
len(PROTECTED_ROUTES) + 1 guarantees one invalid index. The test can fail with IndexError, masking the intended assertion and creating flaky CI outcomes.
Replace loop bounds with range(min(3, len(PROTECTED_ROUTES))) or iterate a slice like PROTECTED_ROUTES[:3]
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.
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.