diff --git a/AGENTS.md b/AGENTS.md index 36f6945..ca856d2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -53,7 +53,8 @@ repo. Do not restate any of it in this file: a second copy is a copy that goes s and this file is for what someone changing worklane's own code needs. ## Testing -- Run: `cargo test` +- **Run `make check` before committing**: `cargo fmt --check`, then `cargo clippy --all-targets -- -D warnings`, then `cargo test`, cheapest first. That is the whole of the enforcement, and it is deliberate rather than a stopgap: this repo has no CI and does not want any, and a git hook is a per-clone opt-in the way `blame.ignoreRevsFile` is, so neither can be relied on. What was missing was one name to type, so the two rules below are a command and not a memory. `-D warnings` is what makes clippy's opinion an exit code; a warning printed into a wall of cargo output is unread, not clean. The completion checks are inside `cargo test` rather than a target of their own, since a second thing to remember is the problem this solves +- Run one suite: `cargo test` - Tests use `assert_cmd` and `assert_fs` for CLI testing - `setup_worklane()` creates temp `.worklane/` with the four flow status folders pre-created, plus `campaigns/` in `cmd_campaign.rs`, which is also where the on-demand creation is tested from a board without it. **The fixtures deliberately do not create `discarded/`**, so every discard test runs against a board that predates the status and `mv_creates_the_discarded_directory_on_a_board_that_predates_it` is not the only thing exercising the on-demand creation - `create_ticket()` writes fully-formed markdown files directly (no `--` separator for positional args in test commands) @@ -62,8 +63,8 @@ and this file is for what someone changing worklane's own code needs. - **`WORKLANE_KEEP_FIXTURES=1 cargo test` keeps the fixtures and prints each path.** Opt-in rather than kept-automatically-on-failure, because the assertions here carry the state they are about: a failing board test prints the rendered rows. The flag is read once when a fixture is made rather than at drop time, so the answer cannot change mid-test, and `Fixture::swept()` turns it off for the three tests that are about the guard itself and must not be failed by a reader's environment - **Verify a claim about leaked fixtures against a clean temp dir, not against `/tmp`.** `TMPDIR=/tmp/scratch cargo test` then count what is left in it: `/tmp` still holds the historical leak, so counting there measures the past rather than the change - In `tui.rs`, `write_member_card` is `write_tagged_card` plus a Campaign field and `write_campaign` puts a campaign on disk, creating the campaigns directory as it goes — `board_dir()` deliberately does not, so every test that does not write one is also the test that a board with no campaigns draws. `picker_rows` cuts the picker's list out of the frame by its own geometry, for the reason `overlay_title_row` exists: a card carries the same campaign label, so a search over every row finds the board rather than the list -- **`cargo clippy --all-targets` is clean. Keep it clean**, and do not silence a lint that is pointing at something real. The only two `allow`s in the tree sit on the `create_ticket` fixtures in `cmd_mv.rs` and `cmd_show.rs`, each carrying the reason and what would replace it -- **`cargo fmt --check` is clean too, and `rustfmt.toml` is what makes that affordable.** rustfmt is the formatter here, run it. The config is four stable width settings and nothing else: +- **`cargo clippy --all-targets` is clean, and `make check` is what says so. Keep it clean**, and do not silence a lint that is pointing at something real. The only two `allow`s in the tree sit on the `create_ticket` fixtures in `cmd_mv.rs` and `cmd_show.rs`, each carrying the reason and what would replace it +- **`cargo fmt --check` is clean too, `make check` runs it first, and `rustfmt.toml` is what makes that affordable.** rustfmt is the formatter here, run it. The config is four stable width settings and nothing else: | setting | value | why | |---|---|---| diff --git a/Cargo.lock b/Cargo.lock index 9226213..c52056f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1503,7 +1503,7 @@ dependencies = [ [[package]] name = "worklane" -version = "0.32.19" +version = "0.32.20" dependencies = [ "anyhow", "assert_cmd", diff --git a/Cargo.toml b/Cargo.toml index 2a74438..5d5951d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "worklane" -version = "0.32.19" +version = "0.32.20" edition = "2024" [dependencies] diff --git a/Makefile b/Makefile index f7e3bc9..512b254 100644 --- a/Makefile +++ b/Makefile @@ -5,15 +5,37 @@ # release cannot end up half-done: no version bump left untagged, no tag without # a bump. -.PHONY: help patch minor major version release install +.PHONY: help check patch minor major version release install help: + @echo "make check fmt, clippy and the suite, in that order" @echo "make patch bump $(CURRENT) -> next patch, amend into HEAD, tag" @echo "make minor bump $(CURRENT) -> next minor, amend into HEAD, tag" @echo "make major bump $(CURRENT) -> next major, amend into HEAD, tag" @echo "make version print the current version" @echo "make install cargo install --path . && worklane install-skill" +# The one command to run before committing. AGENTS.md pins fmt and clippy as clean and +# 83d31cd is what happens when only memory enforces that: fmt drifted to about 160 places +# across every file with the tool installed and configured the whole time. This is not CI, +# which a single-author tool with no pipeline anywhere does not want, and not a hook, which +# is a per-clone opt-in the way `blame.ignoreRevsFile` is. It is one name to type, so +# "remember to run fmt, clippy and the tests" becomes "run make check". +# +# Cheapest first, so a formatting slip is reported in a second rather than after the suite. +# `--all-targets` on clippy, matching the rule in AGENTS.md, so the tests are linted too. +# `-D warnings` is what makes clippy's opinion an exit code: the rule says clean, and a +# warning printed into a wall of cargo output is not clean, it is unread. +# +# Completions are in the suite rather than a step of their own. `cargo test` sources the +# generated script into a real fish and asks it for candidates, so "check tests, check +# completions" is one command already, and a second target would be a second thing to +# remember. The fish tests skip when fish is not installed, printing that they did. +check: + cargo fmt --check + cargo clippy --all-targets -- -D warnings + cargo test + # Read from the [package] table of Cargo.toml, which is the version the binary # reports through `--version`, so it is the single source of truth. The name is # what finds this crate's own entry in Cargo.lock. diff --git a/README.md b/README.md index 8dec4b4..849c7b0 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,17 @@ the command. A pipe holds 64 KiB, so a listing that fits lands in the buffer who and the writer never learns the reader left, giving 0. Only output past that gets far enough to be cut off. Either way nothing is printed to stderr. +## Checking + +```sh +make check # cargo fmt --check, clippy -D warnings, cargo test +``` + +One command, cheapest first, and the whole of what enforces the formatting and lint rules: +there is no CI here and no hook. The completion tests inside it source the generated script +into a real fish and ask it what it would offer, so they skip, saying so, on a machine +without fish. + ## Releasing ```sh