[AAASM-2863] ✅ (release-python): Add test for resolve step's PEP 440 conversion#111
Conversation
… script Move the sed-based agent-assembly tag → PEP 440 version conversion out of the release-python.yml `resolve` job's inline bash and into a single sourceable script `.github/scripts/tag-to-pep440.sh` exposing `tag_to_pep440 <tag>`. This makes the conversion the unit-under-test for the AAASM-2863 follow-up test harness rather than a copy of the regex. Refs AAASM-2863.
Replace the inline sed in the `resolve` job's repository_dispatch branch with a `source` + call into the new `.github/scripts/tag-to-pep440.sh` helper. Adds the matching `actions/checkout@v6` step so the working tree is on disk for the source call (the job previously did not check out). Conversion semantics are unchanged — the helper holds the same sed expression byte-for-byte. The win is that the AAASM-2863 unit tests now exercise the exact code path the workflow runs. Refs AAASM-2863.
Cover the six AAASM-2863 fixture categories — stable, alpha (single + double digit), beta, rc, and multi-digit base version with a large pre-release counter — by sourcing the same helper the workflow runs. Adds extra coverage for the v-prefix-only case, unknown pre-release types passing through, multi-digit beta/rc counters, and the empty-input fail-fast guard the workflow depends on to avoid emitting an empty pypi_version. Runnable locally with `bash .github/scripts/test_tag_to_pep440.sh`; CI wiring follows in a separate commit. Refs AAASM-2863.
Add a small CI workflow that lints and runs the tag → PEP 440 fixture suite whenever the conversion script, its test, the release-python workflow that sources the script, or this workflow itself changes. The existing ci.yaml is intentionally not broadened to cover .github/scripts/** — that workflow drives the full Python test matrix across multiple OSes and runs on Python source changes; gating it on a shell-script edit would be overkill. A dedicated workflow keeps the trigger surface tight and the runtime under a few seconds. Refs AAASM-2863.
Claude Code review — AAASM-2863CI stateBoth checks SUCCESS on head:
The new dedicated workflow ( Scope vs. acceptance criteria
Why the extraction mattersWithout Option A, the test would have proved its own copy of the regex, not the workflow's actual code path. The whole reason the ticket existed was that AAASM-2857's sed conversion was only "verified across 5 representative tags" — meaning the workflow's conversion wasn't testable without running the workflow. By extracting Diff audit — 4 atomic commits, 4 files
Net: +212 / -3 across 4 files. Notable design decisions (subagent's, validated)
Forward-compatibilityThe pattern (extract → source → test) is reusable. If node-sdk wants to add a similar test for its own bash logic (e.g. the dist-tag derivation in VerdictReady for human approval and merge. All 4 ACs covered. Option A (extraction) is the correct choice — without it, the test would have been worthless theatre. The dedicated test workflow is scoped tightly and runs fast. — Claude Code |
Description
Hardens the python-sdk release pipeline's agent-assembly tag → PEP 440 version conversion with a unit-test that exercises the same code the workflow runs.
Implementation:
release-python.yml'sresolvejob and into.github/scripts/tag-to-pep440.sh, exposing it as a sourceabletag_to_pep440function plus a CLI fall-through.resolvejob tosourcethe helper (with a matchingactions/checkoutso the file is on disk)..github/scripts/test_tag_to_pep440.sh— a bash fixture suite that sources the same helper and covers all six AAASM-2863 fixture categories plus a handful of edge cases..github/workflows/release-python-conversion-test.yml— a tiny PR-scoped workflow that shellchecks the two scripts and runs the suite. Scoped tightly so the existing multi-OS Pythonci.yamlmatrix is not pulled in by shell-script edits.Result: the workflow and the test now share the exact regex, so the test proves the workflow's behaviour rather than a copy of it.
Type of Change
Breaking Changes
release-python.ymlmaster HEAD.Related Issues
5c7a58c— original inline conversion).Testing
Local run on macOS (Apple silicon):
actionlintandshellcheck -xclean on both new shell scripts and both touched workflows.Checklist
Acceptance criteria coverage
bash .github/scripts/test_tag_to_pep440.shrelease-python-conversion-test.yml(PR-scoped to.github/scripts/**+release-python.yml)resolvejob sources.github/scripts/tag-to-pep440.sh