Skip to content

release.yml: the environment check reads the deployment limit's list, level with image.yml - #110

Open
brettheap wants to merge 1 commit into
mainfrom
release-envcheck-exact-limit
Open

brettheap wants to merge 1 commit into
mainfrom
release-envcheck-exact-limit

Conversation

@brettheap

@brettheap brettheap commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Brings release.yml's environment check level with image.yml's. Authority: Brett Heap's answer of 2026-11-17, "Fix under #656 ruling", recorded as an addendum on openxFactory#656: for testpypi and pypi, the check requires the deployment limit to be exactly the configured one, in the build job and again in each publish job, with tests.

image.yml (#104) reads the environment's list of deployment branch policies and requires exactly the one that was configured. release.yml already required each environment to carry a required reviewer and a custom deployment limit, but did not read which refs the limit names. It now does.

What the environments carry

Read through the API on 2026-11-17 (public metadata, read only; nothing was changed):

environment total_count policy type
testpypi 1 v* tag
pypi 1 v* tag

That is what the workflow's header already said was configured on 2026-10-05, so the check pins what is there.

What changes

  • Build job: a new step, both environments' deployment limits are exactly the tag v*, after the existing environment step. It reads each environment's deployment-branch-policies and requires exactly one policy, named v*, of type tag. More, fewer or different policies, a branch spelled v*, an answer in a shape the step does not know, and a failed read each refuse. Both environments are always read and reported.
  • testpypi and pypi jobs: the same script, for the job's own environment, as a step before the approval step. The approval step is unchanged, and so is its place right before the preflight and the upload. image.yml copies that step byte for byte in its own tests, and still matches.
  • Permissions: none added. The list endpoint answers to actions: read (GitHub's permissions table for "List deployment branch policies", the same table image.yml's change used), which the build job and both publish jobs already hold.
  • Comments: the header no longer says the pattern is not re-read. It says what the check reads, that the environment's own configuration is the control and GitHub enforces it before a job starts, and that the reads let a reviewed copy of the file notice a limit that was changed; they do not bind a ref that carries its own copy. The use-time budgets in the two publish jobs read 25 and 41 minutes (one minute for the new step); the job timeouts are unchanged.
  • Not changed: what is built or published, the gates on the commit (the root pin, main, the tag), the reviewer rule, the approval step, the environments, and every other job. release.yml was not dispatched. There is no release document under docs/ that describes these environments, so the workflow's own header comments are the record; docs/image-release.md already describes pypi as limiting to the tag v*, which stays true.

Tests

tests/test_release_workflow.py: 211 cases (129 before). The 82 new ones run the steps' own scripts with a stand-in gh, as the file's other cases do:

  • the accepting case, in the build job for both environments and in each publish job;
  • 19 refusals in each of the three places (the build job with either environment wrong): a wildcard tag, a wildcard branch, v* spelt as a branch, another tag pattern, capitals, a full ref in place of the name, main alone, an extra tag, an extra branch, a wildcard beside v*, no policy, a list longer than the one read, a count that is not a number, no list, a nameless entry, a typeless entry, null, a non-JSON answer, and a failed read;
  • the build job still reads and reports the other environment when one is wrong, and reports both when both are;
  • each check reads only its own URL(s), once;
  • the three checks run one script, in the right places, with no permission beyond actions: read;
  • the header says what it now does.

Deliberate breaks that turned these red, then restored: all three accepting any name; all three accepting a branch spelt v*; all three accepting an extra policy; the pypi job's script drifting from the others; the build job no longer reading pypi; the testpypi job losing its step. Also run locally: tests/test_image_workflow.py, tests/test_doc_surfaces.py, tests/test_leg_shape.py, tests/test_hermeticity.py (193 cases), and actionlint on all three workflows (0 errors). Whole-suite collection is 6150.

Not verified

The check runs against live environments only in a real release, and release.yml was not dispatched. The accepted case rests on the live reading above, and on the response shape (total_count, and branch_policies[] with name and type) that the same endpoint returned for these two environments today.

Maintenance branch

Whether release/0.1.x takes this change is decided if and when a 0.1.2 is ruled (item 3 of the addendum). No release is cut for this.

🤖 Generated with Claude Code

… level with image.yml

Brett Heap's answer of 2026-11-17, "Fix under #656 ruling" (openxFactory#656,
comment 6957231933): the release workflow is brought level with image.yml, which
requires the deployment limit to be exactly the one that was configured.

testpypi and pypi each carry one deployment policy, the tag v*, as read through
the API on 2026-11-17. The build job now reads both environments' lists, and
each publish job reads its own again at use time, and each requires exactly
that: one policy, named v*, of type tag. More, fewer or different policies, a
branch spelled v*, an answer in a shape the step does not know and a failed
read refuse. The three checks run one script. The endpoint answers to
actions: read, which all three jobs already hold, so no permission changes.

What is built or published, the gates on the commit, the reviewer rule, the
approval step and the environments themselves are unchanged. The header says
that the environment's own configuration is the control and that the reads let
a reviewed copy of the file notice a limit that was changed.

tests: the build job and each publish job against the configured limit and 19
refusals each, the scripts held equal, and the steps' places held.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 days and 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 17, 2026

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Read the deployment-policy list in the build and publish jobs and require exactly the configured tag policy, with workflow comments and timeout budgets updated to match.

  • .github/workflows/release.yml L292-337, L770-809, L1176-1215 (+7 small edits)

Tests

Add workflow tests for the shared policy-check script, its placement and permissions, successful configured policies, and refusal cases.

  • tests/test_release_workflow.py L43-49, L186-195, L446-617

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

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

1 participant