Skip to content

Run build & twine upload in afterPublish instead of afterRelease - #1945

Merged
yarikoptic merged 1 commit into
masterfrom
claude/autorc-afterpublish
Sep 30, 2026
Merged

yarikoptic merged 1 commit into
masterfrom
claude/autorc-afterpublish

Conversation

@yarikoptic-gitmate

Copy link
Copy Markdown
Collaborator

A one-line .autorc change to work around intuit/auto#1294 (spawnSync /bin/sh E2BIG from the exec plugin).

Why

  • auto's exec plugin puts every hook argument into the environment as JSON in ARG_<n>.
  • afterRelease's argument holds:
    • all commits in the release, with a full GitHub user record for every PR commit (about 1.4 KB each, not de-duplicated);
    • their changed files;
    • the release notes;
    • the full response from creating the GitHub release.
  • Linux rejects any single environment string over 128 KiB (MAX_ARG_STRLEN), however much of the 2 MiB total (ARG_MAX) is left. So once a release has roughly 90 or more PR commits, execSync fails before python -m build && twine upload dist/* even starts, although that command never reads ARG_0.

What changes

  • afterPublish takes no arguments, so no ARG_* variables are set and this failure can't happen.
  • In auto shipit it runs right after publish: protected-branch has pushed its release branch and git-tag has pushed the new tag. The version the build derives from the tag is therefore the same as before.
  • Only the order changes: PyPI upload now happens before the GitHub release is created and before released posts its comments. So if twine fails, no GitHub release is made for an unpublished version.
  • One side effect: in that failure case, protected-branch's afterRelease cleanup of its temporary release branch doesn't run. That branch would need deleting by hand.

How to test

  • This PR carries no release label, so merging it doesn't release anything.
  • master currently has an unreleased minor change (Remove deprecated validate-bids command #1943). The next release, whether from a PR labelled release or a manual workflow_dispatch of "Auto-release on PR merge", becomes 0.81.0 and exercises this change.
  • In the -vv log, expect: tag pushed → "Calling after publish hook" → build/twine output → GitHub release created.

An upstream fix for auto (oversized args go to a temp file exposed as ARG_<n>_FILE) is proposed in yarikoptic/intuit-auto#1.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W872omgTVzywQbbjRvCX6q


Generated by Claude Code

auto's exec plugin passes every hook argument as a JSON-encoded ARG_<n>
environment variable.  afterRelease's single argument carries all commits
in the release (with a full GitHub user record per PR commit), the release
notes and the GitHub release response, so for larger releases it exceeds
Linux's 128KiB per-string limit (MAX_ARG_STRLEN) and the command fails
with "spawnSync /bin/sh E2BIG" before it even starts, although
"python -m build && twine upload dist/*" never uses it
(intuit/auto#1294).

afterPublish takes no arguments, so no ARG_* variables are set.  It runs
in "auto shipit" right after git-tag has created and pushed the new tag,
so the version derived from the tag is the same; the only difference is
that PyPI upload now happens before, rather than after, the GitHub
release is created.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W872omgTVzywQbbjRvCX6q
@yarikoptic-gitmate yarikoptic-gitmate added the internal Changes only affect the internal API label Sep 30, 2026 — with Claude
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.33%. Comparing base (540c7c0) to head (d04b352).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1945      +/-   ##
==========================================
- Coverage   78.34%   78.33%   -0.01%     
==========================================
  Files          92       92              
  Lines       14109    14109              
==========================================
- Hits        11053    11052       -1     
- Misses       3056     3057       +1     
Flag Coverage Δ
unittests 78.33% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator Author

CI note: two red checks on d04b352, neither caused by this PR (it changes only .autorc, which no test or packaged code reads).

  • test (ubuntu-latest, 3.14, dev-deps): the pytest step died with exit code 139 (segfault) about 17 minutes in. It didn't fail an assertion. This job installs pynwb, hdmf, hdmf-zarr, nwbinspector and keyring from their git master branches. The same job passed on master at 06:08 UTC today (540c7c0), and every other matrix entry here passed, including ubuntu 3.14 normal and ubuntu 3.12 dev-deps. So this is either a flaky crash or a change on one of those dev branches since this morning. I couldn't retrieve the crashing test id: the log API only returns the last 5000 lines, which are the docker-compose dump. I'm re-running the failed job once to tell the two cases apart. No fix exists yet.
  • codecov/project: 78.26% (−0.08%). The coverage delta comes from test-run variance; the diff has no Python lines to cover. codecov/patch passes.
  • The early red check_labels run started before the internal label was added. The run triggered by the label passed.

Generated by Claude Code

@yarikoptic

Copy link
Copy Markdown
Member

We should try! first I will merge this with release to see that all still works as expected! then idelly we aggregate lots of changes to test if it actually addresses the issue for us! ;-)

@yarikoptic yarikoptic added the release Create a release when this pr is merged label Sep 30, 2026
@yarikoptic
yarikoptic merged commit 51eba7a into master Sep 30, 2026
67 of 70 checks passed
@yarikoptic
yarikoptic deleted the claude/autorc-afterpublish branch September 30, 2026 20:52
@github-actions

Copy link
Copy Markdown

🚀 PR was released in 0.81.0 🚀

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

Labels

internal Changes only affect the internal API release Create a release when this pr is merged released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants