Skip to content

Contributing

Fast feedback and complete CI

Run the tests related to the change first. A layout edit usually needs the web tests; changes to execution receipts need native execution, continuation and approval regressions. Keep expensive integration tests in the full suite, and select them when their behavior is affected. Test count alone is not a reason to delete a regression: inspect its timing and whether it duplicates coverage.

Use existing pytest workers for focused checks, for example:

uv run --project bin --locked pytest tests/test_web_execution.py -n 4 --dist worksteal --durations=20

For a complete local run:

uv run --project bin --locked pytest -n auto --dist worksteal --durations=30

Linux CI and release qualification split the full selected collection over four independent runners. Windows CI partitions its existing delivery-contract set the same way. Each runner uses four pytest workers; their stable aggregate checks require every shard to pass. Every shard retains JUnit timings, including failed runs. Full regression, artifact and publication checks remain required.

To reproduce one CI partition, add --anvil-test-shard 1/4 explicitly to the same pytest selection. The four partitions are disjoint and cover that entire selection. A single partition is partial verification. Do not put this option in inherited PYTEST_ADDOPTS, where it could silently narrow nested test runs.

Working on the docs site

The site is MkDocs Material, built from docs/ and mkdocs.yml. CI builds it with --strict, so a broken relative link fails the build. Preview locally:

uvx --with-requirements docs/requirements.txt mkdocs serve
What Where
Landing page copy docs/index.md (raw HTML sections)
Landing page shell and site-wide template overrides/home.html, overrides/main.html
Colour tokens, theme mapping, docs reading styles docs/stylesheets/anvil.css
Landing page styles docs/stylesheets/home.css
Terminal replay player docs/javascripts/terminal-demo.js
Recorded session the replay plays docs/demo/session.json, docs/demo/strict-gate.json
Search scope (what the site search ranks or skips) scripts/mkdocs_hooks.py

Three rules keep the landing page honest:

  • Check every claim against the code. State the limit next to the strength; docs/_positioning.md is the voice guide.
  • Do not put version numbers or counts of tools, commands, or tests on it. They go stale. Link to the reference page that owns the number.
  • Never edit the recorded session by hand. scripts/record-site-demo.sh runs every command for real in a throwaway project and rewrites both JSON files. Re-record when CLI output changes, and update the output quoted in docs/index.md from the new files.

Links inside the landing page's raw HTML are not validated by MkDocs. After changing one, build the site and confirm the target exists.

Test workflows on Windows

Run these commands from the repository root. They work in PowerShell and keep the bin project environment explicit.

For the complete suite, use pytest-xdist across the available workers:

uv run --project bin pytest -n auto

For the Git-heavy fixture contract changed by the Windows performance work:

uv run --project bin pytest tests/test_git_ops.py tests/test_reconciliation.py -n 16 -q

The complete suite runs in parallel locally and in Linux CI. Windows CI uses separate focused contracts instead of repeating the complete suite. No maintained workflow requires or schedules a full serial run; the only broad serial result cited here is the revision-bound historical comparison below.

For a faster local feedback loop that skips tests marked slow:

uv run --project bin pytest -n auto -m "not slow"

The fast command is only a local test selection. It does not reduce the project's required test coverage or replace the complete parallel suite when a change needs broad verification.

For changes limited to the Windows sample source-binding repair, run its direct four-test contract:

uv run --project bin pytest tests/test_cli.py::TestSampleSourceBindingContract -q

This focused contract is one recurring Windows CI gate. Windows CI also runs the 167-node Git fixture contract at 16 workers and the timing-harness mechanics tests as separate steps with isolated temporary roots; it does not run the optional timed measurement. Changes to lifecycle, Git, replay, schema, or platform behavior still require the complete suite.

For the fixed native-Windows parallel regression measurement of the Git-heavy fixture contract, start from a clean, committed worktree, choose a public-safe host label, and leave the output path absent:

$env:ANVIL_TIMING_HOST_LABEL = "windows-test-host"
pwsh -NoProfile -File scripts/measure-windows-pytest.ps1 -Warmups 1 -Samples 3 -Workers 16 -TimeoutSeconds 120 -Output artifacts/windows-pytest-timing.json

The harness collects and executes only tests/test_git_ops.py and tests/test_reconciliation.py (currently 167 tests), records one parallel warmup plus three 16-worker samples, and keeps raw logs in a Git-ignored directory. It never runs the suite serially. The initial affected-slice regression budget is a 35-second median; this is a same-host ceiling, not a project-wide speedup claim.

The harness does not require an elevated shell. Windows may make individual Defender exclusion groups unavailable to a standard user; the artifact records each group's availability while still requiring power, Defender status, and every available exclusion digest to remain stable throughout the run.

The repository also has one-time full-suite evidence at commit 21af013fd29c7b6c6c988e1175ed08cdee09fa46. From the repository root, uv run --project bin pytest tests -q completed with 4,951 passed, 16 skipped, and 3 deselected in 1,982.05 seconds; uv run --project bin pytest tests -n auto -q completed with 4,951 passed and 16 skipped in 238.89 seconds (about 8.3x faster). That historical broad comparison supports the parallel default; it is not a recurring benchmark protocol or evidence for the narrower fixture budget by itself. Required parallel CI supplies broad verification, so contributors do not need to repeat the full suite locally for every change.