Skip to content

tests/test_release_workflow.py runs the stamp writer and the steps after it through the wheel check, so a step that rewrites the stamp is refused by the wheel check and not only counted by the step-order pin (closes opensoft/openRepoTools#288) - #11

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

Conversation

@brettheap

@brettheap brettheap commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

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

No test ran the stamp step followed by another step, so a step inserted after the stamp writer that
rewrote the stamp was caught only by the step-order pin's count, although the wheel check refuses
such a stamp in production. The first pick runs the build's steps from the stamp writer through the
wheel check, in order and each as GitHub runs it, and requires the wheel check to refuse a step that
rewrites any of the writer's five values. The second has the chain extract HEAD's own stamp as the
build's git archive does, keeps the inserted step's command line to 99 columns, and corrects two
comments. 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 runs the steps from the stamp writer through the wheel check in order, so a step inserted after the writer that rewrites the stamp is refused by the wheel check and not only counted by the step-order pin
    (cherry picked from commit d7fa5c85bbf2d837c2653ad192f1beb3dc3307ee)
  • tests/test_release_workflow.py has the stamp-to-wheel-check chain extract HEAD's own stamp as the build's git archive does, keeps the inserted step's command line to 99 columns, and corrects two comments, on the heredocs run under -I and on the build steps the list covers
    (cherry picked from commit 655f7e7b08ffe9efa0e8fb6d8f38462810006881)

Closes opensoft/openRepoTools#288.

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

🤖 Generated with Claude Code

Summary by Sourcery

Run the release stamp and wheel-validation steps together to ensure post-stamp changes are rejected as they are in production.

Enhancements:

  • Extend release workflow tests to execute the build steps from stamp writing through wheel validation in order.
  • Verify that rewriting any stamped release value after stamp generation is rejected by the wheel check.

Tests:

  • Add coverage for the stamp-to-wheel-check workflow chain, including packaging the resulting stamp and validating each stamped field.

Brett Heap and others added 2 commits November 7, 2026 18:18
…hrough the wheel check in order, so a step inserted after the writer that rewrites the stamp is refused by the wheel check and not only counted by the step-order pin (#288)

Lane openRepoTools-2's mutant N5, an unnamed step after the stamp writer that rewrote both TAGs (release.yml:762), was caught by `STEP_ORDER` alone: test_release_upload_each_job_runs_exactly_its_steps_in_order[build] failed on the build job's step count. No test ran the stamp step followed by another step, because each stamp case ran it alone. In production the wheel check refuses such a stamp.

`run_from_the_stamp_writer_to_the_wheel_check` runs the build's steps from the stamp writer through the wheel check, as the workflow has them and in its order, each as GitHub runs it. The two extractions are copies of the committed stamp, `python3` is this interpreter, and the build's backend is faked by `CHAIN_BUILD`, which packages each extraction's own `src/openrepotools/_release.py` into a copy of the release's wheel. So the stamp that any step leaves in a tree is the stamp the wheel check reads. A step in that span that is not a `run:` step fails the case, since the suite cannot run it.

Two tests use it. The first runs the steps as the workflow has them: each exits 0, and the wheel check passes the stamp and runs to its last line. The second has five cases, one for each of the writer's five values. A step the test inserts right after the writer rewrites that value in both extractions, so the build's `cmp` passes the two wheels, and the wheel check refuses, with an `::error::` line naming the value. N5 rewrote TAG, and the writer sets five.

With N5 applied to release.yml, as lane 2 gave it and with the step unnamed, the first test fails on its own: the wheel check exits 1 with "the stamp says 'TAG = "v9.9.9"' where the release's says 'TAG = "v1.1.0"'". The five rewrite cases hold the check and pass. A step that changes nothing is still caught only by `STEP_ORDER`'s count, and that pin's comment now says the rewriting case is also run.

Only tests/test_release_workflow.py changes, and release.yml is as it was. -k test_release_workflow: 505 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 #288.

Lane: openRepoTools-2
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
(cherry picked from commit d7fa5c85bbf2d837c2653ad192f1beb3dc3307ee)
…ract HEAD's own stamp as the build's git archive does, keeps the inserted step's command line to 99 columns, and corrects two comments, on the heredocs run under -I and on the build steps the list covers (#288)

Lane openRepoTools-3's comment on #288 asked for two comment fixes in the same change, and lane openRepoTools-2's review of the commit (RV-A) found them not made (SHOULD), and two NITs in the new code. This commit makes all four. Only tests/test_release_workflow.py changes: release.yml is as it was, and no test is added, removed or loosened.

- The BUILD_STEPS comment said contracts/workflows.md's build steps 2 to 13, and the list ends at step 14, the record (`:198-201` at a42946e). It now says 2 to 14.
- The header's sentence on the heredocs run under `-I` (`:95-101` at a42946e) left out the 3.9 leg's compile step, which the file runs under `-I` through `AS_ANOTHER_PYTHON` (`:3931` at a42946e). It now names that step, and says that the first two are the ones that read the release's values.
- The chain's two extractions (`:2549`, NIT) were copies of the WORK TREE's `src/openrepotools/_release.py`, where the build's `git archive` extracts the commit. So a work tree with an uncommitted change to that file failed the as-written test on its own, because the wheel check compares the stamp with HEAD's blob. Each copy is now `head_blob("src/openrepotools/_release.py")`.
- `REWRITES_THE_STAMP`'s first line was 123 characters long, where the file keeps to 99 (`:2497`, NIT). It is now two lines, joined by a backslash that bash reads as a line continuation. The step it runs is the same.

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

Part of #288.

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

sourcery-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Tests

Run the build workflow from stamp writing through wheel validation, and verify that rewriting any of the five stamped values causes the wheel check to refuse the packaged stamp.

  • tests/test_release_workflow.py L2576-2737

Update the workflow test documentation and step-order comment to describe the expanded stamp-to-wheel coverage and the build-step range it covers.

  • tests/test_release_workflow.py L99-105 (+3 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]>
@brettheap brettheap closed this Nov 9, 2026
@brettheap brettheap reopened this Nov 9, 2026
@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.

A step inserted after the stamp writer is caught by the step-order pin's count alone, because no test runs the stamp step followed by another step

1 participant