Architecture
Upgrading Z3¶
To move z3_mojo to a new Z3 release, update the pin in z3-version.toml and
regenerate the bindings from the new headers and libraries.
Local upgrade commands¶
pixi run bump [version] # defaults to the latest Z3Prover/z3 release
pixi run generate # fetch -> enums -> snapshot -> raw -> api -> docs
pixi run api-diff # Markdown diff against HEAD:api/z3-api.json
pixi run check-api # verify 100% coverage and zero stale overrides
pixi run test # run bindgen, raw, and public Mojo tests
pixi run docs-test # compile and run docs/examples/*.mojo
pixi run -e oracle oracle-test # compare against Python z3-solver at the same version
pixi run -e docs docs-build # build the docs site in strict mode
pixi run package # precompile build/z3_mojo.mojoc with --Werror
pixi run bump queries Z3Prover/z3 on GitHub, resolves the release tag and
commit hash, matches the three platform zip assets (linux-64,
linux-aarch64, osx-arm64) even when upstream bumps its glibc or macOS SDK
suffix, computes their SHA-256 digests, and rewrites z3-version.toml,
recipes/z3_mojo/recipe.yaml, and the z3-solver oracle pin in pixi.toml.
Automated GitHub workflow¶
.github/workflows/z3-update.yml runs twice a year (15 January and 15 July)
and can also be triggered manually via workflow_dispatch with an optional
version input. When a newer Z3 release exists, it:
- runs
pixi run bump; - runs
pixi run generateand writespixi run api-diff > api-diff.md; - runs
check-api,test,docs-test,oracle-test,docs-build, andpackage; - opens or updates a pull request on branch
z3-<version>with the API diff and test output.
What each upstream change needs¶
| Z3 change | How it appears | Who acts |
|---|---|---|
New standard C function (in, in_array, bool + out) |
Listed under "C functions added" in api-diff; picked up in raw.mojo, api.mojo, and reference/api.md |
Review |
| New C function with an unsupported signature (such as a C callback) | check-api reports it as unresolved |
Add a wrapper in gen_api.py or an entry in bindgen/overrides.toml |
| New opaque handle type | Inferred automatically if *_inc_ref/*_dec_ref or Z3_del_* exists; otherwise check-api flags it |
Add to [handles] in bindgen/overrides.toml |
| Removed function or handle that had an override | check-api flags a stale override |
Delete the stale entry |
| Changed C signature or renumbered enum | Shown in api-diff and regenerated automatically |
Review |