Skip to content

DO NOT MERGE -- verify separate findings for separate bugs - #104

Closed
exactml wants to merge 1 commit into
masterfrom
test/verify-separate-findings
Closed

exactml wants to merge 1 commit into
masterfrom
test/verify-separate-findings

Conversation

@exactml

@exactml exactml commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Throwaway verification PR. Three unrelated bugs in three separate files -- checking whether marginal returns 3 distinct findings, not fewer/merged. Will close without merging.

…endently

Three unrelated, classic bugs in three separate files: a mutable
default argument, an off-by-one slice, and an unclosed file handle.
Checking whether marginal returns three distinct findings, not one
merged/missed one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 marginal review

PR #104: DO NOT MERGE -- verify separate findings for separate bugs · open · 2d1ad43f6114b0119ee426be3d6433ef356fbfe9 → 37d281ac2f7273ff366e650de04cf3acbc8870c0 · 3 files changed

Changed files (3)
  • scratch_bug_mutable_default.py
  • scratch_bug_off_by_one.py
  • scratch_bug_resource_leak.py

"""DO NOT MERGE -- throwaway file, part of a verification test."""


def append_item(item, items=[]): # noqa: B006

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · 95% confidence

Using a mutable default argument (items=[]) means the same list is shared across all calls that don't pass items explicitly, causing items to accumulate unexpectedly between calls. Should use items=None and initialize items = [] if items is None else items inside the function.

Comment thread scratch_bug_off_by_one.py


def get_last_n(items: list, n: int) -> list:
"""Return the last `n` items of `items`."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · 90% confidence

Off-by-one error: items[len(items) - n - 1:] returns n+1 items instead of n, and will behave incorrectly for n=0 (returns last element instead of empty list). The correct slice should be items[len(items) - n:] or simply items[-n:].


def read_file_contents(path: str) -> str:
"""Read and return the contents of the file at `path`."""
f = open(path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · 90% confidence

The file opened with open(path) is never closed, causing a resource leak. Should use a with open(path) as f: context manager to ensure the file handle is properly closed even if an exception occurs during read.

@exactml

exactml commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Verification complete -- 3/3 separate bugs caught as 3 distinct findings (95%, 90%, 90% confidence), all correctly diagnosed. Closing without merging, deleting the branch.

@exactml exactml closed this Sep 20, 2026
@exactml
exactml deleted the test/verify-separate-findings branch September 20, 2026 12:31
@exactml exactml added the test label Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant