Skip to content

Add release_check pre-publish gate, PR CI, and gate the tag publish - #19

Closed
theodor90 wants to merge 2 commits into
mainfrom
test/release-check
Closed

theodor90 wants to merge 2 commits into
mainfrom
test/release-check

Conversation

@theodor90

Copy link
Copy Markdown
Owner

Before this, the repo had no PR CI and publish.yml published on a v* tag without running any tests. The 64 respx-mocked tests also cannot see a wheel missing files or real API drift.

py scripts/release_check.py, fail-fast:

  1. Version sync: pyproject = CHANGELOG top entry
  2. python -m build (sdist + wheel) into a temp dir
  3. twine check --strict, check-wheel-contents, and a check that every form4api/ module in the source tree is in the wheel (and nothing else is)
  4. Install the wheel into a fresh venv
  5. Smoke test the installed package outside the repo: all submodules import, __version__ matches, clients construct, the congress lag accepts None
  6. Live contract (FORM4API_TEST_KEY, never printed; --offline skips it): the same 9 calls as the JS SDK, raw responses validated against the live OpenAPI spec (OAS30Validator, nullable aware); a missing SDK method fails as a parity gap
  7. Version not already on PyPI (WARN under --offline, FAIL otherwise)

Also adds form4api.__version__, read from installed package metadata so it cannot drift from pyproject.

CI: new ci.yml on PRs and main (3.11 + 3.13: pytest, codegen check, release_check --offline). publish.yml now runs pytest and release_check before building and publishing.

Verified locally:

  • --offline green in a fresh venv; pytest 72/72 (8 new contract tests)
  • Fault injection, each reverted: wrong CHANGELOG version -> stage 1; form4api.resources* excluded from the build -> stage 3 (twine and check-wheel-contents both missed it; the source-vs-wheel check caught it); null lag against a non-nullable spec -> contract test fails; no key without --offline -> stage 6
  • Live stage not yet run with a real key.

scripts/release_check.py tests the built wheel instead of the source tree:
version sync (pyproject, CHANGELOG), python -m build into a temp dir,
twine check --strict, check-wheel-contents and a source-vs-wheel module
check, install into a fresh venv, a smoke test run outside the repo, a live
contract stage that validates raw API responses from the installed SDK
against the live OpenAPI spec (FORM4API_TEST_KEY, skipped with --offline),
and a PyPI check that the version is not already published.

contract/live-calls.json is the call list shared with the JS SDK.
tests/test_contract_validation.py covers the validator without a key.

Adds form4api.__version__ (read from installed package metadata), CI on
pull requests and main for Python 3.11 and 3.13, and publish.yml now runs
the tests and release_check before publishing.
Matches the JS gate's ajv-formats. The first live run on 2026-10-05 passed a
timezone-less date-time (institutionalOwnership.quarter) here while the JS
gate failed it; both gates now report it.
@theodor90

Copy link
Copy Markdown
Owner Author

Superseded by #20, which keeps only the CI, publish-gate and version changes.

@theodor90 theodor90 closed this Oct 5, 2026
@theodor90
theodor90 deleted the test/release-check branch October 5, 2026 15:57
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