From 7a9e40a99b02d52a9a5a6e775ec50edfc938c3a1 Mon Sep 17 00:00:00 2001 From: cjber Date: Wed, 18 Nov 2026 08:35:13 +0000 Subject: [PATCH 1/3] docs(agents): add a gate entry point and Standards, make CLAUDE.md a pointer Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01KXatHM2Wro3XUtD6hGnED5 --- AGENTS.md | 16 +++++++++++++++- CONTRIBUTING.md | 2 +- scripts/gate | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100755 scripts/gate diff --git a/AGENTS.md b/AGENTS.md index e9d7b02..3be8b7a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,6 +6,16 @@ TypeScript backend. It is not affiliated with Rocicorp; say so wherever the proj Before any porting work, read [`docs/plan.md`](docs/plan.md): scope, the oracle that defines "compatible", the phases and their completion criteria, and the decisions already made. +## Checks + +```sh +scripts/gate # ruff format and lint, ty on changed files, tests/unit (offline, no Docker) +scripts/gate --changed # only what this branch's changed files reach: run before every push +``` + +CI runs the rest: whole-repo `ty check`, the full suite, `tests.compat`, the e2e run and the benchmarks, which need +Docker and Node. Bumping Zero is covered in [CONTRIBUTING.md](CONTRIBUTING.md#bumping-zero). + ## Conventions - Python 3.12+, uv, ruff, ty, pytest, Hypothesis. Typed throughout; wire models are Pydantic. @@ -14,4 +24,8 @@ phases and their completion criteria, and the decisions already made. and asserting what it should do. A Python behaviour with no differential test is unverified. - Ported code keeps Apache-2.0 attribution to rocicorp/mono; record each ported module's upstream path and commit in its docstring. -- All commits signed (`git commit -S`). One PR per phase against `main`; watch CI until green. +- One PR per phase against `main`. + +## Standards + +- `repo-standards`: the RS-* requirements every cjber and agent-labs-dev repo meets; its `audit.py` checks this repo. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b83b11c..28a9371 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ The tests start Postgres in Docker. To use your own instead, set `ZERO_SERVER_PG ## Checks -CI runs these, and a PR merges only when they pass: +Run `scripts/gate --changed` before pushing (`scripts/gate` for the whole tree and every offline unit test). CI runs the full steps, and a PR merges only when they pass: ```sh uv run ruff check diff --git a/scripts/gate b/scripts/gate new file mode 100755 index 0000000..7b59d59 --- /dev/null +++ b/scripts/gate @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# The fast local gate: format, lint, type check and the offline unit tests. Needs no Docker, Node or keys. +# scripts/gate ruff over the whole tree, ty on files changed from origin/main, tests/unit +# scripts/gate --changed only what this branch's changed files reach +# Whole-repo ty, tests/wire, tests.compat, the e2e run and the benchmarks need Docker and Node and run in CI. +set -euo pipefail +cd "$(git rev-parse --show-toplevel)" + +changed_only=0 +case "${1:-}" in + "") ;; + --changed) changed_only=1 ;; + *) echo "usage: scripts/gate [--changed]" >&2; exit 2 ;; +esac + +base=$(git merge-base HEAD origin/main) +mapfile -t changed < <({ git diff --name-only "$base"; git ls-files --others --exclude-standard; } | sort -u) + +py=() +run_unit=0 +for f in "${changed[@]}"; do + [[ $f == *.py && -f $f ]] && py+=("$f") + [[ $f == src/* || $f == tests/unit/* || $f == tests/conftest.py || $f == pyproject.toml || $f == uv.lock ]] && run_unit=1 +done + +uv sync --locked -q +if ((changed_only)); then + ((${#py[@]})) && { uv run ruff check "${py[@]}"; uv run ruff format --check "${py[@]}"; } +else + uv run ruff check + uv run ruff format --check +fi +((${#py[@]})) && uv run ty check "${py[@]}" +if ((!changed_only || run_unit)); then + uv run pytest tests/unit --no-cov -q +fi +exit 0 From 46fa0e96972b7b0cb40870a3ad7880ffc1e9317f Mon Sep 17 00:00:00 2001 From: cjber Date: Wed, 18 Nov 2026 08:40:33 +0000 Subject: [PATCH 2/3] docs(agents): keep the Standards line to the org name Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01KXatHM2Wro3XUtD6hGnED5 --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 3be8b7a..fc9f91f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,4 +28,4 @@ Docker and Node. Bumping Zero is covered in [CONTRIBUTING.md](CONTRIBUTING.md#bu ## Standards -- `repo-standards`: the RS-* requirements every cjber and agent-labs-dev repo meets; its `audit.py` checks this repo. +- `repo-standards`: the RS-* requirements every agent-labs-dev repo meets; its `audit.py` checks this repo. From b57a17eb655fcc597fffc2f9dd1b74c5fbddcf1c Mon Sep 17 00:00:00 2001 From: cjber Date: Wed, 18 Nov 2026 08:41:10 +0000 Subject: [PATCH 3/3] chore(agents): gate falls back to local main, parallax gate covers nested tests and non-Python inputs Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01KXatHM2Wro3XUtD6hGnED5 --- scripts/gate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/gate b/scripts/gate index 7b59d59..5866871 100755 --- a/scripts/gate +++ b/scripts/gate @@ -13,7 +13,7 @@ case "${1:-}" in *) echo "usage: scripts/gate [--changed]" >&2; exit 2 ;; esac -base=$(git merge-base HEAD origin/main) +base=$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main) mapfile -t changed < <({ git diff --name-only "$base"; git ls-files --others --exclude-standard; } | sort -u) py=()