Amendments and releases
Approving an amendment
Built so that the person spends as little time as possible on it, which is
what purpose asks for. The person reads what the constitution
says and nothing
else: tools, checks and fixtures are ordinary changes (see File structure).
While the constitution is a draft, an amendment pull request is merged
once agent review has passed, and the person reads it afterwards on a
preview of the site; the description is still written as below, so that
the reading is quick. Only a change to an approved edition waits for the
person’s yes on a named head commit before it is merged. How the repo
keeps the edition in force and a draft of the next one is settled by
text-and-sources and draft-and-edition.
- An amendment pull request changes only
constitution/: the sources and the generated files rebuilt from them. - Its description opens with the diff of the generated text in the language the person reads, then the same diff in each other language, collapsed. The generated diff is what agents will read, numbers included; the person does not need to read the sources.
- Agent review is finished before the person is asked: CI’s constitution check is green, and the reviewer has checked that the texts in all languages say the same thing. A person approving the change approves the texts in all languages on the strength of that review.
- The description ends with the open questions, each clear and easy to
answer and with a recommended answer (
asking). - For an approved edition, the person’s yes names the head commit it
approves, and the merge lands exactly that commit (
independent-review). proposing-amendmentsasks for the generated diff in the language the approving person reads, andamendment-languagesfor the texts in all languages to change together; the steps above are how this repo meets them. If the head changes afterwards, the person is asked again with only the diff since the approved head.
Releases and versions
-
Versions are tags
v<major>.<minor>.<patch>onmain. A constitution amendment or a rule change that alters behavior is at least a minor bump; a change to tools that alters output is at least a minor bump; the rest is a patch. -
A release tag goes only on a
maincommit whose push-triggeredcheckrun succeeded on its first attempt. A rerun that turned green does not qualify; tag a later commit that passed the first time. -
Pushing a release tag makes a version available. By default a release is an item of
must-ask, added by rule 32 (release-must-ask), and needs a person’s yes; a project may move it underrelaxations.project-overrides. -
The crates under
crates/are published to crates.io, each with its own version in itsCargo.toml; publishing one is a release too.statute0.0.1 was a placeholder that held the name. -
A crate’s version is independent of the repo’s, so its tag carries the crate’s name: pushing
statute-v<version>releasesstatuteat that version, under the same rules as a release tag above..github/workflows/release.ymlpublishes it. The workflow holds no crates.io token: crates.io trusts this repo’srelease.ymlrunning in the GitHub environmentrelease(Trusted Publishing), and the job trades its OIDC token for a short-lived crates.io token. The environment admits only tagsstatute-v*. -
Before publishing, a job of its own, outside the environment and without the OIDC token, runs
check-release-tag; the job that publishes runs only when it passed, so no tool of the check can get the token. The check takes three steps in order, each only once the one before it passed, and stops at the first that fails: the tag isstatute-vfollowed by the version incrates/statute/Cargo.toml, and a manifest without a version to read fails; the tagged commit is onmain; that commit’s push-triggered run ofci.ymlcompleted withsuccesson its first attempt. So the tag goes on after that run has finished; when it was pushed earlier, the check fails, and the workflow is rerun once the CI run has passed. -
The same tag also attaches a prebuilt
statutebinary to its GitHub Release, forx86_64-unknown-linux-musl,aarch64-unknown-linux-musl,x86_64-apple-darwinandaarch64-apple-darwin: each target is an assetstatute-<target>.tar.gzwith the binary at its top level, beside a sidecarstatute-<target>.sha256insha256sumformat. The Linux binaries are statically linked against musl and also run on glibc systems. The binaries are built only aftercheck-release-tagpassed, in jobs that hold neither the OIDC token nor a token that can write to the repo; a job of its own, which builds nothing, creates the Release when the tag has none and uploads the assets. There is no install script; a CI job or a person installs a version with the commands below, withversionset to the version (such as0.1.17, the first version with binaries) andtargetto one of the four targets:base=https://github.com/Luolc/agent-constitution/releases/download/statute-v$version curl -fsSLO "$base/statute-$target.tar.gz" -O "$base/statute-$target.sha256" sha256sum --check --strict "statute-$target.sha256" tar -xzf "statute-$target.tar.gz" statuteOn macOS,
shasum -a 256 --checkstands in forsha256sum --check. Running the workflow by hand (workflow_dispatch, with the required inputtag, an existingstatute-v*tag, and no default) builds the four binaries and keeps them as workflow artifacts, without the check and without publishing anything. -
The same tag also writes the Homebrew formula
Formula/statute.rbto the tapLuolc/homebrew-tap, so thatbrew install luolc/tap/statuteinstalls the Release binary. After the Release has its assets, a job on macOS renders the formula withtools/render_homebrew_formula.shfrom the four.sha256sidecars: it points at the Release tarballs, and Homebrew compiles nothing. The job puts the formula in a local tap, checks withtools/check_formula_version.shthat the version Homebrew reads is the tag’s, and runsbrew audit --strict,brew installandbrew test. Only on a tag push does it then commit the formula to the tap’smain, with the repository secretHOMEBREW_TAP_TOKEN, and it commits nothing when the formula is unchanged. A dispatch runs every step but that commit for the tag in its inputtag, and writes no tap. The job’s failure leaves crates.io and the Release as they are. -
The same tag also publishes
statuteto PyPI, as wheels that hold the Release’s binaries as they are and install them as the commandstatute(uv add --dev statute,pip install statute): each Linux target has a manylinux and a musllinux wheel with the same musl binary in them, each macOS target one wheel, and there is no Windows wheel. A wheel’s version is the tag’s. The jobpypi-wheels, which holds no token that can publish, downloads the Release’s assets, builds the six wheels withtools/build_pypi_wheels.sh, and runstools/check_pypi_wheels.sh: the binary in each wheel has the sha256 of the one in its Release tarball, both printed, and the wheels are exactly the six expected. It then runstwine check --strict, installs the x86_64 Linux wheel and checks thatstatute --versionprints the tag’s version. The jobpublish-pypiruns after it and after crates.io, in the environmentrelease, and is the only job of the two with the OIDC token: PyPI trusts this repo’srelease.ymlin that environment (Trusted Publishing), so the repo holds no PyPI token either. Before the first upload, a person registers that workflow and environment as a pending publisher of the projectstatuteon PyPI. Before it uploads,tools/pypi_upload_set.shdrops each wheel PyPI already holds with the same sha256 and stops on one PyPI holds with another, so a run that failed part-way through the upload can be rerun. A dispatch builds and checks the wheels of the tag in its inputtagfrom that tag’s Release and keeps them as a workflow artifact, uploading nothing. No job asks PyPI for a token only to check the publisher: for a pending publisher, PyPI creates the project when it mints the token. -
The same tag also updates the pre-commit mirror
Luolc/statute-pre-commit, whose hookstatute-compilerunsstatute compile --check. pre-commit has no language that downloads a prebuilt binary, butlanguage: pythoninstalls a Python project from the root of the hook’s repository, and itspyproject.tomldepends onstatute==<version>, so pre-commit installs the PyPI wheel and compiles nothing. The mirror is a repository of its own because thatpyproject.tomlhas to sit at its root, where this repo keeps thepyproject.tomlof its uv workspace. The jobmirrorruns afterpublish-pypiand writes the mirror directly, without polling PyPI: a mirror tag whose pin PyPI does not serve yet would fail atpip installin a consumer’s repository rather than in this run. It takes four steps, each with a check that fails when the step did not do its work:- It installs
statute==<version>from PyPI withuvxand checks thatstatute --versionprints the tag’s version, before writing anything. - It looks up the mirror’s tag
v<version>(the mirror’s tags carry nostatute-prefix) before writing anything. A tag that points at the mirror’sHEAD, whose pin is this version, is an earlier run of the job, and the job passes there; a tag that points elsewhere fails the job and is not moved. It compares commits: it lists every tag and takes the peeled^{}line when there is one, since an annotated tag’s own line carries the tag object, andgit ls-remotewith a pattern drops the peeled line. - With no tag yet, it fails when the pin on the mirror’s
mainis already a later version, so that a rerun for an older release cannot move it back. Otherwise it rewrites the linedependencies = ["statute==<version>"]in the mirror’spyproject.tomlwithsed, andgrep -Fxqchecks that the line is there;sedexits 0 when its pattern matched nothing. It commits and pushes to the mirror’smainonly when the pin changed. - It tags the mirror’s
HEADv<version>and pushes the tag.
Only that pin and the tags are written by the job; the mirror’s hook definition, README,
AGENTS.mdandLICENSEare hand-written there. The job holds no permission on this repo (permissions: {}) and writes the mirror with the repository secretPRECOMMIT_MIRROR_TOKEN, a token a person creates that can write toLuolc/statute-pre-commit. No job needsmirror, so its failure leaves crates.io, the Release, the tap and PyPI as they are, andgh run rerun --failedresumes it. - It installs
-
The overlay pins a tag and its commit SHA and refuses to build if they disagree. It moves to a new version by a change in the overlay, reviewed there.