Skip to content

tests/test_release_workflow.py makes a served-digest read fail with a URLError that has no HTTP status, and another time out, so release.yml's except cannot lose either member with the suite green (closes opensoft/openRepoTools#286) - #9

Merged
brettheap merged 4 commits into
mainfrom
pick/286-code-lane2
Nov 9, 2026

Conversation

@brettheap

@brettheap brettheap commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openRepoTools-2
Claim: opensoft/openRepoTools#286 (comment)

release.yml's served-digest check reads the index's JSON up to 20 times and retries a read that
fails with a URLError, a TimeoutError or a ConnectionError. No case made a read fail with a URLError
that has no HTTP status, or time out, so the except could be narrowed with the suite green.
FakeIndex now answers REFUSED (a redirect to a port nobody listens on) and TIMED_OUT (it takes the
request and says nothing), and a new served-check case for each, in each upload job, requires the
step to read again and pass. With the matching member removed from the except in both upload jobs,
the older cases still pass and the new ones fail. Only tests/test_release_workflow.py changes, and
release.yml is as it was.

The picks, from lane openRepoTools-2's branches in opensoft/openRepoTools, each made with git cherry-pick -x and followed by its source commit:

  • tests/test_release_workflow.py makes a served-digest read fail with a URLError that has no HTTP status and requires the check to read again, so release.yml's except cannot be narrowed past URLError with the suite green
    (cherry picked from commit 35b18b2ff14c41585d83d9f605d4efd11ed719a5)
  • tests/test_release_workflow.py makes a served-digest read time out and requires the check to read again, so release.yml's except cannot drop TimeoutError with the suite green
    (cherry picked from commit ae3e8e0cfc43362be0a325acb33ddab1ff09c009)

Closes opensoft/openRepoTools#286.

Lane: openRepoTools-2
Co-Authored-By: Claude Sonnet 5.5 [email protected]
Co-Authored-By: Claude Opus 5.5 [email protected]

🤖 Generated with Claude Code

Summary by Sourcery

Ensure release workflow tests prevent narrowing served-digest retry handling for refused connections and timed-out reads.

Enhancements:

  • Expand release workflow coverage to verify served-digest checks retry after refused connections and read timeouts in both upload jobs.

Tests:

  • Add fake-index scenarios and assertions for URLError failures without HTTP status and timed-out reads, including cross-version timeout handling.

Brett Heap and others added 2 commits November 7, 2026 18:18
… URLError that has no HTTP status and requires the check to read again, so release.yml's except cannot be narrowed past URLError with the suite green (#286)

After each upload the job reads the index's JSON up to 20 times, 15 seconds apart, and retries a read that fails with `except (urllib.error.URLError, TimeoutError, ConnectionError)`. No case made a read fail with a URLError that has no status: SERVED_CASES answered with a status (200, 403, 404 or 503) or with DROPPED, a connection closed with no response, which raises http.client.RemoteDisconnected and so exercised only the ConnectionError member. Lane openRepoTools-2's re-check of #284 narrowed that except to (HTTPError, TimeoutError, ConnectionError) at release.yml:1223 and :1723, and the suite stayed green.

FakeIndex now answers REFUSED, a 302 to a port nobody listens on (a socket it binds and never listens on, so nobody else takes the port and the connection is refused). urllib follows the redirect, and its connection fails with `URLError(ConnectionRefusedError)` and no `code`. The new SERVED_CASES case, a-refused-connection-then-served, has the index answer REFUSED and then SERVED in each upload job: the step reads twice, sleeps once and passes. The test also requires the step's output to carry `<urlopen error`, so the case cannot slip back to a ConnectionError and stop testing the URLError member.

With the except narrowed in both upload jobs, the 22 older served-check cases still pass and the 2 new ones fail: the first refused read raises the URLError uncaught, and the step exits 1 with a traceback.

A read that times out is not added. The step's urlopen waits its real 30 second timeout, which the fake clock does not shorten, and no case can make one without waiting it out.

Only tests/test_release_workflow.py changes, and release.yml is as it was. -k test_release_workflow: 501 passed.

A branch for the code leg, not a pull request: it is cherry-picked into openRepoTools-code after v1.1.0 is tagged.

Part of #286.

Lane: openRepoTools-2
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit 35b18b2ff14c41585d83d9f605d4efd11ed719a5)
…d requires the check to read again, so release.yml's except cannot drop TimeoutError with the suite green (#286)

After each upload the job reads the index's JSON up to 20 times, 15 seconds apart, and retries a read that fails with `except (urllib.error.URLError, TimeoutError, ConnectionError)`. No case made a read time out: the step's `urlopen(timeout=30)` waits a real 30 seconds, which the fake clock does not shorten, so no case held the `TimeoutError` member. A read the index takes and never answers raises a bare `TimeoutError` out of `getresponse()`, not wrapped in a `URLError`, so no other member of the except catches it.

FakeIndex now answers TIMED_OUT (the status 0): it takes the request, says nothing, and holds the connection until the client closes it (HELD_FOR, 10 seconds at most). The CLOCK `sitecustomize` gains one thing, where a case sets FAKE_READ_TIMEOUT: the timeout of the step's FIRST connection is cut from the 30 seconds the step asks for to READ_TIMEOUT, 0.5 seconds. It only ever cuts a timeout, and a later read keeps the step's own. The step's own `urlopen` then times out through a real socket after half a second, and release.yml is as it was.

The new SERVED_CASES case, a-timed-out-read-then-served, has the index answer TIMED_OUT and then SERVED in each upload job: the step reads twice, sleeps once and passes. The test also requires the step's output to carry `did not answer yet (timed out)`, so the case cannot slip into a dropped connection, which the step passes through its ConnectionError member and which never reaches TimeoutError. With the clamp off, the step does exactly that: it exits 0 after the 10 second hold and prints `(Remote end closed connection without response)`.

With `TimeoutError` removed from the except at release.yml:1223 and :1723, the 24 other served-check cases still pass and the 2 new ones fail: the first read raises `TimeoutError: timed out` out of `getresponse()`, uncaught, and the step exits 1 with a traceback. Each new case takes under a second. Run outside pytest on Python 3.10, 3.11, 3.12, 3.13 and 3.14, the step passes as written and fails the same way with the member removed. Before Python 3.10 a timed-out read raises `socket.timeout`, which is not `TimeoutError`, so the case skips there, as run_heredoc skips below 3.11 for tomllib; the upload jobs run on the runner's 3.12.

Only tests/test_release_workflow.py changes, and release.yml is as it was. -k test_release_workflow: 503 passed.

On the same branch as 35b18b2, still no pull request.

Part of #286.

Lane: openRepoTools-2
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit ae3e8e0cfc43362be0a325acb33ddab1ff09c009)
@sourcery-ai

sourcery-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Tests

Extend the fake index and clock to produce refused and timed-out reads, then assert both served-digest checks retry and pass with the expected diagnostics.

  • tests/test_release_workflow.py L3197-3228, L3238-3251, L3260-3271 (+10 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Nov 8, 2026

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

brettheap and others added 2 commits November 9, 2026 13:09
The in-place merge of runbook v9: the stack grows by this clean merge, with no force-push.

Lane: openRepoTools-2
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The in-place merge of runbook v9: the stack grows by this clean merge, with no force-push.

Lane: openRepoTools-2
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

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.

No test makes a served-digest read fail with a URLError that has no HTTP status, so release.yml's except can be narrowed with the suite green

1 participant