Skip to content

fix(tools): report pr_overlap output errors without traceback - #26707

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Ducengarth:fix/pr-overlap-out-oserror
Nov 24, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Ducengarth:fix/pr-overlap-out-oserror

Conversation

@Ducengarth

Copy link
Copy Markdown
Contributor

What

Report filesystem failures from --out with the existing pr_overlap CLI diagnostic. An existing file passed as the output directory now produces a one-line error and status 1. The handler is in write_reports, leaving the branch-mode changes in #21678 free to merge independently.

Tested

WSL Ubuntu 24.04, Python 3.12.3 and Git 2.43.0. Ran all test_pr_overlap*.py modules separately, as CTest does. The branch passed 239 tests and main passed 238. Both skipped three workflow cases because jq was unavailable. The error-reporting module also passed 17 tests on Windows 11 (Python 3.14.5, Git 2.56.1) and skipped one symlink case. The new regression reproduced FileExistsError with the upstream script and passed with the branch and with the combined tree from a clean trial merge with #21678 (ca8762f3d0). Conventions and git diff --check passed. The branch overlap checker found no confirmed conflicts across 2,503 open PRs and left four comparisons unresolved because their heads already conflict with main. Comparing trial merge trees with and without this change confirmed identical conflict paths and unchanged conflict markers for #19961, #20964, #24016 and #26109. In each case the only added difference was the write_reports patch.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Creating the --out directory or writing a report could raise an uncaught
OSError. Handle those filesystem errors in write_reports and exit with
the same pr_overlap diagnostic used by the CLI for other errors.

Cover the failure with a test that points --out at an existing file and
mocks the GitHub and Git operations.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>

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

Review: fix(tools): report pr_overlap output errors without traceback

Approve.

What I checked

  • write_reports now turns an OSError from mkdir or write_text into SystemExit("pr_overlap: ..."). Its only caller is main() (tools/pr_overlap.py:1128). A SystemExit with a message exits with status 1, so the pr-overlap.yml step (--out "$out") still fails on a write error, just without the traceback. No failure is hidden.
  • from None drops the chained traceback but keeps the OSError text, which names the path.

What I ran

Windows 11, Python 3.14, PR head 0eb1170:

python3 tools/tests/test_pr_overlap_errors.py
python3 tools/tests/test_pr_overlap_encoding.py
python3 tools/check_conventions.py
  • Both test files: OK. The encoding test calls write_reports directly.
  • With main's pr_overlap.py, the new test_output_path_that_is_a_file_reports_an_error_without_traceback errors, so it covers the change.
  • check_conventions.py: All conventions checks passed.

AI-assisted: yes (Claude Code).

@oneandonlydean
oneandonlydean merged commit c0bad9b into boykopovar:main Nov 24, 2026
14 checks passed
@github-actions

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 19961 tools/pr_overlap.py
PR 20964 tools/pr_overlap.py
PR 24016 tools/pr_overlap.py
PR 26109 tools/pr_overlap.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants