diff --git a/README.md b/README.md index 8f2f414b..504d156f 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,7 @@ formatting nix fmt # treefmt: Nix, Gleam, Go, Python, and shell files pre-commit install # once per checkout; available in `nix develop` pre-commit run --all-files # format, lint Python, and type-check Python +test/quick.sh # every static check, without a hook gleam format src test # fix Gleam formatting ruff format priv/python test # fix Python formatting ruff check # lint Python @@ -149,7 +150,8 @@ ty check # type-check the kernel, plugins, and tests ``` The commit hook formats staged files and runs the Python checks; it needs -`gleam` on PATH. +`gleam` on PATH. `jj` runs no git hooks, so with `jj` run `test/quick.sh` before +each commit. tests diff --git a/agents.md b/agents.md index 5ca9ef7e..be2e178a 100644 --- a/agents.md +++ b/agents.md @@ -17,13 +17,14 @@ For Go changes, use the Go and gopls supplied by `nix develop` (they come from t - Gleam suites: `gleam test` - Go: `go -C cli vet ./...` and `go -C cli test ./...` - Rust (optional `view` renderer): `cargo test --release --locked --manifest-path native/render/Cargo.toml` -- Everything that must pass before a commit: `./test.sh` +- Static checks only (formatters, lints, type checks, generated-code checks), in seconds: `test/quick.sh` +- Everything that must pass before a commit: `./test.sh`, which starts with `test/quick.sh` Anything that opens a browser must set `ALBEDO_NO_BROWSER=1`; `test.sh` exports it for the whole gate. ### Test layout and the build lock -`./test.sh` is the gate. The quick checks run first, in order (Ruff lint and format checks, ty, Gleam format and lint checks, cargo test + renderer install, the web client's generated-API check and unit tests, Go vet, the CLI build the Python e2e suite drives); then it compiles the daemon once and runs every suite at the same time (`gleam test`, each `test/harness/*_test.py`, Go unit tests, the Go e2e suite, the Python e2e suite), each into its own log, printed only when that suite fails. +`./test.sh` is the gate. It runs `test/quick.sh` first, then cargo test + renderer install, the web client's unit tests and the CLI build the Python e2e suite drives; then it compiles the daemon once and runs every suite at the same time (`gleam test`, each `test/harness/*_test.py`, Go unit tests, the Go e2e suite, the Python e2e suite), each into its own log, printed only when that suite fails. Python test files are loaded through `test/python_test_runner.py`; a selected file with no unittest cases fails. The E2E runner also rejects an empty aggregate before boot. Gleam and Erlang discovery selects `_test` files with exported test functions or generators, excluding the `albedo_test.gleam` entrypoint and manual tools. Support modules remain compiled but are not suites. Put reusable Python fixtures in `_support.py` modules. Inspection transport belongs to `test/e2e/inspect_support.py`; probes use the typed session diagnostics described in `robot-docs/runtime.md`. @@ -46,6 +47,8 @@ Do not judge a UI change from its code or a text dump; render it and look at the Other sessions and agents often work in this checkout at the same time. Stage only the paths you changed (`git add -- `), leave other files alone, and never stash someone else's changes. +`jj` doesn't support git hooks (e.g. `pre-commit`), so you will need to run `test/quick.sh` before every commit or set up an alias for it. + If "push" could mean `main`, a branch, or a pull request, ask which before pushing. A push that fails with tangled's `too many concurrent operations from your address` is a rate limit, not a rejection: retry after about 15 seconds. diff --git a/test.sh b/test.sh index aa1d4bdd..31121b4b 100755 --- a/test.sh +++ b/test.sh @@ -1,34 +1,23 @@ #!/usr/bin/env bash # Every check that must pass before a commit. # -# The quick checks run first, in order. Then the daemon is compiled once and -# every suite runs at the same time, each into its own log, which is printed -# only if that suite fails. The e2e suites boot their daemons from that one -# snapshot (ALBEDO_TEST_DAEMON) instead of through gleam, so none of them waits -# on the build lock `gleam test` holds for its whole run. test/manual is opt-in -# and not run here; those harnesses need a provider, a PTY, or artifacts from -# an earlier benchmark run. +# test/quick.sh runs first, then the other quick checks. Then the daemon is +# compiled once and every suite runs at the same time, each into its own log, +# which is printed only if that suite fails. The e2e suites boot their daemons +# from that one snapshot (ALBEDO_TEST_DAEMON) instead of through gleam, so none +# of them waits on the build lock `gleam test` holds for its whole run. +# test/manual is opt-in and not run here; those harnesses need a provider, a +# PTY, or artifacts from an earlier benchmark run. set -euo pipefail cd "$(dirname "$0")" export ALBEDO_NO_BROWSER=1 # a detached kernel a suite left behind ends soon after, not in an hour export ALBEDO_KERNEL_GRACE_SECONDS=20 -# treefmt (Go, Nix and the other formatters CI runs); it rewrites what it fixes -# and fails when it had to, so commit the result -nix fmt -- --fail-on-change --no-cache -ruff check -ruff format --check priv/python test -ty check -gleam format --check src test -test/gleam-lint.sh +test/quick.sh cargo test --quiet --release --locked --manifest-path native/render/Cargo.toml native/render/install.sh -go -C cli/tools/apigen run . -check -test -d web/node_modules || npm --prefix web ci --no-audit --no-fund -npm --prefix web run generate:check npm --prefix web test -go -C cli vet ./... # the Python e2e suite drives the CLI through this binary go -C cli build -o bin/albedo ./cmd/albedo diff --git a/test/quick.sh b/test/quick.sh new file mode 100755 index 00000000..35abb176 --- /dev/null +++ b/test/quick.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# The static checks: formatters, linters, type checks and the generated-code +# checks. Seconds, no daemon. test.sh runs it first. +# +# Run it before every commit. jj never runs git hooks, so pre-commit does not +# guard a `jj commit`; this script is the hook for those. +set -euo pipefail +cd "$(dirname "$0")/.." + +# treefmt: the formatters and linters CI runs (Gleam, Go, Nix, Python with Ruff +# format and check, shell). It rewrites what it fixes and fails when it had to, +# so commit the result +nix fmt -- --fail-on-change --no-cache +ty check +test/gleam-lint.sh +go -C cli/tools/apigen run . -check +test -d web/node_modules || npm --prefix web ci --no-audit --no-fund +npm --prefix web run generate:check +go -C cli vet ./...