Files
ianitor/docs/release.md

110 lines
7.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Releases: notes and screenshots on the Gitea release
Ianitor is server-only: what runs is built by Nix on the server and switched in by the `deploy` pipeline
(`.fabrica/artifex/deploy.yaml`, `fabrica-deploy@ianitor`). A release adds what a deploy does not leave behind: a
Gitea release for the `vX.Y.Z` tag with the release notes and screenshots of the web UI, under a `SHA256SUMS`
signed by `domi-release`. It ships no binary; the deploy stays the deploy.
The release kit is Fabrica's (Fabrica `docs/12_release_kit.md`, core `docs/FORMATS.md`, "Fabrica: release notes"
and "Fabrica: the Aula page"). Ianitor uses it as it is, with one difference: Fabrica's `fabrica aula shots`
drives a built Windows WebView2 exe, which Ianitor does not have, so a repo script takes the same files from the
web UI in a headless browser.
## The pipeline: `.fabrica/artifex/release.yaml`
`on: tag "v*"` and `manual: true`, on the Windows runner (the Fabrica app on Mark's PC: `fabrica`, node and pnpm
are on every step's PATH).
| Step | Does | Produces |
| :-- | :-- | :-- |
| `version` | `node scripts/check-version.mjs <version>`: the tag's version must be the workspace `Cargo.toml`'s and both `package.json`s' | |
| `install` | `pnpm install --frozen-lockfile` | |
| `check`, `test` | `svelte-check` and the vitest click smoke test of the web UI the shots show | |
| `notes` | `fabrica notes` (the range since the previous `v*` tag; the first release covers the whole history) | `target/notes/release-notes.md`, `release-notes.json` |
| `shots` | `node apps/web/scripts/shots.mjs` (below) | `target/aula/aula-<name>.png`, `aula.json` |
| `approve` | the run's Custos approval, before anything is published | |
| `publish` | the Gitea release of the tag: the notes, the shots and `aula.json`; `sums: domi-release` adds `SHA256SUMS` and `SHA256SUMS.minisig`; `release-notes.md` becomes the release's text | |
The Rust tests are not in it: the edge, diff and ACME tests are Linux-only (ROADMAP §8.3) and the release builds
nothing. They run in WSL2 and in the Nix build.
**No landing page.** `fabrica aula page` and `aula-page.json` are left out while `.fabrica/app.yaml` has no
`aula: true`. Turning Aula on later is two lines: `aula: true` in `app.yaml` and a `page` step (`fabrica aula
page`, after `notes` and `shots`) whose `aula-page.json` is published; a brief (`.fabrica/aula/brief.md`) is
optional, its caption names are the shot names below.
**app.yaml stays as it is.** Its parts are `desktop` (a release pipeline started by the tag the card's Deploy
bumps and pushes, with installers) and `server` (a deploy pipeline). Ianitor has no installer and no version bump to
make, so it keeps its one `server` part; the release is started by its tag.
## Release notes
`fabrica notes` writes them from the first-parent commit subjects, the Pensum tickets done (Ianitor has none) and
`.fabrica/notes/<version>.md`, the highlights a person writes. The merges of PR 3 to 5 predate the
`[repo] Merge: <branch> (<title>, PR #n)` form and come out as bare "PR #n" lines; history is not rewritten, so
`.fabrica/notes/0.1.0.md` says in a few sentences what 0.1.0 is, and goes first.
## Screenshots: `apps/web/scripts/shots.mjs`
`node apps/web/scripts/shots.mjs [--out <dir>]` (default `target/aula` at the repo root):
1. empties the output folder of `aula-*.png` and `aula.json`;
2. builds the web UI (Vite, production) into a fresh temporary folder;
3. serves it on `127.0.0.1` (a free port), with `/api/v1` answered by the demo control plane
(`apps/web/tests/demo.ts`), and every other path falling back to `index.html` as in production;
4. starts headless Microsoft Edge (or Chrome; `IANITOR_SHOTS_BROWSER` names another) with a fresh profile in the
temporary folder, its DevTools port on loopback only, and a cleared environment (the system variables and the
temporary folder, nothing of the runner's: no `GITEA_TOKEN`, no hub token); a browser whose DevTools do not
answer within 20 s is stopped and started again, at most three times;
5. for each shot: sets the viewport (1440 × 900, scale 1), loads its page, clicks its selectors, waits for its
selector, the fonts, two frames and 400 ms, and saves `aula-<name>.png`; a wait that runs out (20 s) saves
`aula-<name>-failed.png` and fails;
6. writes `aula.json` in the format of core `docs/FORMATS.md` ("Fabrica: the Aula page"): `{"v":1,"shots":[…]}`,
each shot's `name`, `title`, `file`, `width` and `height` read from the PNG, and `sha256`;
7. on every way out kills the browser's process tree and, on Windows, any process left with a profile in the
temporary folder (Edge can start its browser again as a new process, outside the tree), stops the server, and
removes the temporary folder.
| Name | Page | Shows |
| :-- | :-- | :-- |
| `hosts` | `/` | the host list: health, chips, where each sends traffic, the last change |
| `host` | `/hosts/wiki.home.test/edit` | editing a host: upstreams, certificate, sign-in, health check |
| `engine` | `/`, then the engine chip | Pingora serving and the Caddy fallback ready, with its differences |
| `history` | `/history/<change>` | the history with a version picked and what restoring it changes |
| `certificates` | `/certificates` | the Domi intermediate and the device certificates |
**The demo control plane** (`apps/web/tests/demo.ts`) answers like control (docs/api.md), built on the click smoke
test's stand-in (`apps/web/tests/mockApi.ts`: the same host and apply shapes and every call the demo does not
replace). Its data is invented: hostnames under `.test`, upstream addresses in the documentation ranges
(192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24), people *ada* and *felix*, made-up commits, match codes and
fingerprints. A vitest test (`apps/web/tests/demo.test.ts`) asks every page's calls and fails on any other
hostname or address, so a real name cannot slip in through a later fixture.
## Risks
| Risk | Answer |
| :-- | :-- |
| A screenshot shows Mark's network | The UI talks only to the demo control plane; the demo data test refuses names outside `.test` and addresses outside the documentation ranges; the PNGs are looked at in the review. |
| The browser reaches out | It loads only `127.0.0.1`; the UI's own CSP allows no outside requests; background networking, sync and component updates are off; its profile is thrown away. |
| A secret reaches the browser | Its environment is cleared to the system variables. The demo serves no token, key or certificate. |
| A forged screenshot or note | They are release assets under `SHA256SUMS`, signed by `domi-release` through Custos; the Gitea text is not signed, the asset is. |
| The browser outlives the run | Its process tree is killed on every way out (`taskkill /T` on Windows). |
| A shot of a half-drawn screen | Each `wait` selector exists only once the screen's data is there; fonts and two frames are awaited. |
## Gaps
- Windows and Edge or Chrome only as tested; the script is plain Node and DevTools, so Linux with Chromium should
work, untested.
- One size (desktop); no phone layout shot.
- The release does not run the Rust tests (see above).
- No `[repo] Release:` bump: the version in `Cargo.toml` and the `package.json`s is changed by hand before tagging.
## Handover: releasing 0.1.0
1. On main: `git tag v0.1.0 && git push origin v0.1.0`.
2. Start the `release` pipeline at `v0.1.0` from Fabrica (no Gitea webhook to the hub yet: the hub's
`POST /api/runs`, ref `v0.1.0`). Approve on the Custos card, then sign `SHA256SUMS` on Custos (`domi-release`).
3. The Gitea release `v0.1.0` has the notes as its text and `release-notes.md`, `release-notes.json`, five
`aula-*.png`, `aula.json`, `SHA256SUMS` and `SHA256SUMS.minisig`.
4. Deploy as before: Fabrica's *Apps* → Ianitor → *Deploy*, then deploy/test-access.sh from a LAN machine.