Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 agent-labs-dev repo meets; its `audit.py` checks this repo.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 37 additions & 0 deletions scripts/gate
Original file line number Diff line number Diff line change
@@ -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 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=()
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
Loading