build: add the pre-push review's configuration

.review-gates/config.json configures Crafter.Review's pre-push review
for this repository. Its commits mode lists four lenses:
repo-better-solution, repo-bug-prover, repo-security and repo-facts.
For each it names a section of this repository's own, under
.review-gates/lenses/. It sets requireSigned, forbids AI attribution
trailers, and lists fourteen gate0 commands: the version check, the
tests, a build of each product and five lint runs. It names no
authors: a patch that came by mail, as the README asks for one, keeps
its author.

One of the five lint runs is new to the guide: the daemon's, whose
sources list implementations/nostrod.cpp, which the other four's do
not. "Code style" and the command list name it.

.gitignore gains the review's two generated directories.

AGENTS.template.md gains the directory in its table and two commit
guidelines about the review, puts the review into the release recipe
before the tag, names the two generated directories among what is never
committed, and loses the sentence that asked for a Co-Authored-By
trailer on a commit an agent wrote.
This commit is contained in:
Jorijn van der Graaf 2026-11-21 06:39:19 +01:00
commit 564fcdfe0e
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
7 changed files with 372 additions and 4 deletions

View file

@ -41,6 +41,7 @@ Five C++26 modules, and a sixth in one build:
| `docs/screenshots/` | The README's pictures of the app, on a phone's screen and in a desktop window, and `take.sh`, which takes them again on the made-up system; see "Looking at the app". |
| `README.md`, `LICENSE`, `LICENSE.GPL` | The manual; the LGPL version 3, which the library, nostrod and the CLI are under, and the GPL version 3, which the LGPL adds its permissions to and which the app is under (design rule 13). |
| `AGENTS.template.md`, `AGENTS.consumer.md` | The source of this file, and the notes for consumers. `AGENTS.md` is gitignored: edit the template. |
| `.review-gates/` | The pre-push review's `config.json` and this repository's lens sections (`lenses/`), read by Crafter.Review. Its `push/` and `trees/` are generated and gitignored. |
| `.vscode/` | A build task and an lldb launch configuration, both stale; see "Gotchas". |
| `bin/`, `build/` | Generated and gitignored. The library and the CLI are both named `nostro`, so one build leaves two `bin/nostro-<target>-<march>-<mtune>-<hash>/` directories: the library's (`libnostro.a`, the PCMs, `std.pcm`) and the executable's (`nostro`). Glob for the one holding `nostro`. nostrod builds into `bin/nostrod-…/`, the checkout library into `bin/nostro-checkout-…/`, the app into `bin/nostro-app-…/` with its fonts and Crafter.Graphics' shaders beside it (`bin/nostro-app-core-…/` is `Nostro.App`'s library), or under `files/bin/` there when it is packaged as a Flatpak. `build/crafter-debug` is the launcher of Crafter.Debug's client, `build/fake-system/` the state of the made-up system `run fake` starts, `build/flatpak-apps/` what `install` and `bundle` make of the app. |
@ -157,6 +158,7 @@ crafter-build clean # delete bin/ and build/
crafter-build test --banks=bunq # the tests in tests/, against a fake bunq; none talks to bunq itself
tests/coverage.sh [profile runtime] # the tests with coverage: a report per file and every line no test ran
crafter-build lint --banks=bunq # the Crafter.LintRules lite rules project.cpp registers, report only
crafter-build lint --banks=bunq --product=daemon # the same over nostrod's own source
crafter-build lint --banks=bunq --product=app [--debug-api] # the same over the toolkit, the app and its window
flatpak run --filesystem=<dir> org.flatpak.Builder --user --force-clean --repo=<dir>/repo --state-dir=<dir>/state <dir>/build packaging/flatpak/net.catcrafts.Nostrod.yaml
crafter-build --banks=bunq --product=app --packaging=flatpak --march=x86-64-v3 --mtune=generic bundle # the app's Flatpak as one file; `install` installs it for you instead
@ -174,7 +176,7 @@ The app's packaging: `--packaging=flatpak` makes `bin/nostro-app-<variant>/files
- `check`, for a pull request and a run by hand: the version check, the tests, the lint of the library, the CLI and the tests, and then both Flatpaks for aarch64. It runs cold and mounts nothing of the host.
- `publish`, for a pushed tag `X.Y.Z`: the release checks, the tests and both Flatpaks. It then commits the two as `stable` into the Catcrafts Flatpak repository on the runner's host (`/var/www/flatpak`, signed with the key under `/etc/crafter-flatpak`, under the lock the other publishing workflows hold), puts each one's `.flatpakref` beside it with the repository's key in it, and makes release `X.Y.Z` on the forge with the two bundles, the ref files and their checksums.
A release is a tag, as it is for Crafter.Build and imsd-messages: a push without one runs nothing. `packaging/flatpak/release-version.sh` holds `NOSTRO_VERSION` in `project.cpp` to the newest `<release>` of the app's metainfo, whose description is the release notes. For a tag it also checks that the tag is that version, annotated, signed by the owner as Forgejo verifies it, on master, and newer than every release there is. So a release is: bump both, commit, `git tag -s X.Y.Z -m 'Nostro X.Y.Z'`, and push master and the tag together.
A release is a tag, as it is for Crafter.Build and imsd-messages: a push without one runs nothing. `packaging/flatpak/release-version.sh` holds `NOSTRO_VERSION` in `project.cpp` to the newest `<release>` of the app's metainfo, whose description is the release notes. For a tag it also checks that the tag is that version, annotated, signed by the owner as Forgejo verifies it, on master, and newer than every release there is. So a release is: bump both, commit, take that commit through the pre-push review until the owner approves its hash ("Commit and PR guidelines"), `git tag -s X.Y.Z -m 'Nostro X.Y.Z'` on the approved commit, and push master and the tag together.
The workflow was written on 2026-11-19 and pushed without having run once: its first run is its test. What it needs, and how each stood that day:
@ -249,7 +251,7 @@ What a test cannot show (that the window draws what the frame says, in the right
## Code style
- `crafter-build lint --banks=bunq` reports nothing, and neither does it with `--product=app`, with `--debug-api` added, and with `--product=fake-system`: the first reaches the library, the CLI and the tests, and only the others the toolkit's, the app's and the window's sources. A finding at a C boundary (`main`'s `argv`, a `char*` an OpenSSL or POSIX call hands out) is suppressed with `// lint-disable-next-line <rule>` and a comment saying why; anything else is fixed. The rules that need an AST cannot parse a file that `#include`s a standard header before `import std;` (the twelve that include `json.hpp`: four in the library, seven tests and the fake system), because the lint's libclang does not find libc++'s headers, so lint exits 1 for those alone until Crafter.Build issue #46 is fixed. Until then, name the headers through the environment and every rule runs on every file: `CPLUS_INCLUDE_PATH=<libc++'s include directory>`, which is `/app/include/c++/v1` in crafter-build's Flatpak (`flatpak run --env=CPLUS_INCLUDE_PATH=/app/include/c++/v1 net.catcrafts.CrafterBuild lint …`). Prefer C headers (`<errno.h>`, not `<cerrno>`) elsewhere. Tests are linted like the rest. `const-local` sees `bool` and the built-in types, not `std::size_t` or `std::int32_t`: those are made `const` by hand. Lint a product after building it: the AST rules read that product's module files, and against ones from before a change they report nonsense, such as a vector of a type they do not find yet as a local that is never modified.
- `crafter-build lint --banks=bunq` reports nothing, and neither does it with `--product=daemon`, with `--product=app`, with `--debug-api` added, and with `--product=fake-system`: the first reaches the library, the CLI and the tests, the daemon's lists `implementations/nostrod.cpp` among its sources, and only the app's two reach the toolkit's, the app's and the window's sources. A finding at a C boundary (`main`'s `argv`, a `char*` an OpenSSL or POSIX call hands out) is suppressed with `// lint-disable-next-line <rule>` and a comment saying why; anything else is fixed. The rules that need an AST cannot parse a file that `#include`s a standard header before `import std;` (the twelve that include `json.hpp`: four in the library, seven tests and the fake system), because the lint's libclang does not find libc++'s headers, so lint exits 1 for those alone until Crafter.Build issue #46 is fixed. Until then, name the headers through the environment and every rule runs on every file: `CPLUS_INCLUDE_PATH=<libc++'s include directory>`, which is `/app/include/c++/v1` in crafter-build's Flatpak (`flatpak run --env=CPLUS_INCLUDE_PATH=/app/include/c++/v1 net.catcrafts.CrafterBuild lint …`). Prefer C headers (`<errno.h>`, not `<cerrno>`) elsewhere. Tests are linted like the rest. `const-local` sees `bool` and the built-in types, not `std::size_t` or `std::int32_t`: those are made `const` by hand. Lint a product after building it: the AST rules read that product's module files, and against ones from before a change they report nonsense, such as a vector of a type they do not find yet as a local that is never modified.
- The first two lines of every source are `// SPDX-License-Identifier: LGPL-3.0-only`, or `GPL-3.0-only` in a source of the app (design rule 13 says which is which), and `// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®`, then a blank line. `project.cpp` carries them too.
- Four-space indentation, LF, K&R braces with `} else {`, one declaration per statement. `if(`, `for(`, `while(`, `switch(` without a space in most files (`:Utils` has the space; match the file). Lines run long rather than wrap.
- `import std;` everywhere; `#include`s only in a global module fragment (`module;` first), and only for OpenSSL, the vendored `json.hpp`, sd-bus and sd-event, and the POSIX calls of `:File`, `:Connector` and nostrod. `namespace fs = std::filesystem;` where paths appear.
@ -293,14 +295,16 @@ The checklist, from the bunq connector:
## Commit and PR guidelines
- Patches go by mail to jorijnvdgraaf@catcrafts.net, as the README says. Branch off `master`.
- Take the commit voice from the sibling Crafter repositories: `type(scope): imperative summary` with `feat`, `fix`, `refactor`, `docs` or `build`, and the partition or the CLI as the scope (`bunq`, `account`, `currency`, `connector`, `file`, `bus`, `client`, `daemon`, `checkout`, `cli`, `ui`, `app`, `shell`, `debug`, `build`, `packaging`). The body says what was wrong, why, and how it was verified against the sandbox. Add a `Co-Authored-By:` trailer when an agent wrote it.
- Take the commit voice from the sibling Crafter repositories: `type(scope): imperative summary` with `feat`, `fix`, `refactor`, `docs` or `build`, and the partition or the CLI as the scope (`bunq`, `account`, `currency`, `connector`, `file`, `bus`, `client`, `daemon`, `checkout`, `cli`, `ui`, `app`, `shell`, `debug`, `build`, `packaging`). The body says what was wrong, why, and how it was verified against the sandbox.
- The README is the manual: keep its CLI section true to `main.cpp` and "The app" true to the screens: what the one can do, the other can. Update `AGENTS.consumer.md` in the same change when a signature, a path, a default, a file format or an error behaviour consumers lean on changes; consumers pick it up on their next build.
- A change to how the app looks or is laid out says in its commit how it was looked at: which screens, at which sizes, on what. When it changes a screen the README shows, the pictures are taken again (`docs/screenshots/take.sh`) in the same commit.
- The app's version is `NOSTRO_VERSION` in `project.cpp`, and the newest release in `packaging/flatpak/net.catcrafts.Nostro.metainfo.xml` is the same: `packaging/flatpak/release-version.sh` fails on a tree where they differ, and CI runs it first.
- A change to `Transaction` is a schema change (design rule 5), and the commit message says so.
- A change to the D-Bus interfaces or the polkit policy changes the published contract (design rule 10); the XML, the policy and the test that holds them change together.
- A change that moves code between the library and the app moves it between two licences (design rule 13), and its commit message says so.
- Never commit `bin/`, `build/`, `AGENTS.md`, or a `connectors.json`.
- Every push of new commits to `master` goes through Crafter.Review's pre-push review first, and goes out only once the owner approves the frozen hash. Run `crafter-review init` once in a fresh checkout or worktree: it writes the `/prepush` skill that drives the review, and the skill stays untracked. The lenses it runs are the approach, the bug-prover, the security lens and the commit truth, each with this repository's own section (`.review-gates/lenses/`): a lesson of a review that is nostro's goes into the section of the lens that should have caught it. CI does not run for a plain push, so the review's gate0, the commands in `.review-gates/config.json`, is the check before one: the version check, the tests, a build of each product, and the five lint runs "Code style" names.
- Every commit of a pushed range is GPG-signed and carries neither a `Co-Authored-By:` nor an `Assisted-by:` trailer in its message, whoever the trailer names. `freeze` refuses a range with a commit that breaks either (`requireSigned` and `aiTrailers` in `.review-gates/config.json`). The config names no `authors`, so who wrote a commit is not checked: a patch that came by mail keeps its author.
- Never commit `bin/`, `build/`, `AGENTS.md`, `.review-gates/push/`, `.review-gates/trees/`, or a `connectors.json`.
## Security considerations