Skip to content

ci: guard release version-stamp seds (ast.parse + exact-stamp check) - #236

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/version-stamp-sync-guards
Aug 17, 2026
Merged

ci: guard release version-stamp seds (ast.parse + exact-stamp check)#236
Jammy2211 merged 1 commit into
mainfrom
feature/version-stamp-sync-guards

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Adds loud-failure guards around the two __version__ stamp seds in release.yml (the rehearsal Build job and the live Stamp version in build tree step):

  • refuse an empty $VERSION in the live step (the rehearsal job already refused; the live step did not);
  • after each sed, ast.parse every */__init__.py it touched and require that any file carrying a __version__ line carries exactly __version__ = "$VERSION", with at least one stamped file — failing the job with ::error:: otherwise.

The sed pattern [\."\'0-9]* is unanchored and zero-or-more, so a reshaped assignment (e.g. a future try/except version block) would be corrupted into a SyntaxError and could previously ship an unimportable wheel silently — verified empirically. The guard converts that silent failure mode into a loud build failure.

Part of #235 (six sibling PRs: five library stamp syncs + this guard).

API Changes

None — internal changes only (CI workflow).
See full details below.

Test Plan

  • release.yml still valid YAML
  • Guard simulated locally: passes on the stamped literal (test-package __init__.pys without a stamp are tolerated), fails loudly on a corrupted non-literal assignment
Full API Changes (for automation & release notes)

Changed Behaviour

  • release.yml rehearsal Build + live Stamp steps — post-sed parse/exact-stamp verification; live step now refuses empty $VERSION

Generated by the PyAutoLabs agent workflow.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release Merged PR awaiting inclusion in the next release build label Aug 17, 2026
@Jammy2211
Jammy2211 merged commit 560bd26 into main Aug 17, 2026
3 checks passed
Jammy2211 added a commit that referenced this pull request Aug 18, 2026
The PyAutoHands leg of the tenant-firewall arc (PyAutoMind#198), deferred
at the time because PyAutoHands was claimed by the version-stamp task
(#235). That merged as #236, so the leg is unblocked.

This is the last of the 9 findings. With it, a four-organ
`repos_sync.py --check` reports `tenant firewall (organ code): OK`.

- tests/test_pre_build_staging.py: derive the five arbitrary repo literals
  from the already-parsed SPECS, the mechanism the file adopted precisely
  so its fixtures cannot drift from pre_build.sh. The three tests that
  already used SPECS[i][0] are untouched — only the hand-written names
  change. The `pyautobase` fixture root becomes a neutral name;
  pre_build.sh derives PYAUTOBASE from its own location, so the root is
  never matched by name. Fixture assert tightened to `len(SPECS) > 1`,
  which the missing-checkout test now relies on (it removes one repo and
  asserts against another).
- .github/workflows/tests.yml: check Hands out at `path: PyAutoHands`
  beside a pinned PyAutoMind, move pytest under `working-directory:`, and
  add the `--only "tenant firewall (organ code)"` gate step — the same
  shape PyAutoBrain and PyAutoHeart already carry. Every firewall finding
  to date merged through a green PR because no PR CI ran the check; this
  closes that hole for Hands. The header's "deliberately ONLY pytest"
  paragraph is updated rather than left contradicting the new step.

Verification: `--only "tenant firewall (organ code)"` against a
four-organ root → OK, exit 0. Negative probe: injecting a bogus manifest
name into the genericised file is flagged (exit 1) and removing it
returns OK, so the check is not weakened. pytest unchanged against
pristine main in this container — 302 passed / 4 skipped / 7 failed both
before and after, the 7 being an environment gap (ipynb-py-convert has no
wheel here), not a regression.

Follow-up owed on PyAutoMind: add the PyAutoHands checkout to
`firewall_gate.yml`, which deliberately omitted it while Hands main still
carried this finding. That must merge after this PR.


Claude-Session: https://claude.ai/code/session_013xP1c7XRVQJzxoWAoH92GQ

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release Merged PR awaiting inclusion in the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant