22 Commits

Author SHA1 Message Date
mnovak d9871ae1b7 [docs] Roadmap: Phase 4 is PR 13 2026-11-22 19:44:08 +01:00
mnovak aca9bd8d9f [tests] Fuzz: Cargo.lock follows the workspace version 0.2.0 2026-11-22 19:43:30 +01:00
mnovak 8efea92c01 [repo] Merge: main into phase-4 (Fabrica onboarding and 0.2.0, PRs #11 and #12)
# Conflicts:
#	.fabrica/artifex/release.yaml
#	docs/ROADMAP.md
#	docs/release.md
2026-11-22 19:34:22 +01:00
mnovak 25d4875b38 [docs] Roadmap: Phase 4 status and handover 2026-11-22 19:31:18 +01:00
mnovak 5023575680 [fabrica] Release pin (QC round 2): verifiers build the tagged commit (flake rev and docs); the commit the pin names is kept for the record, must hold the recorded source tree when present, and is published unchecked when absent 2026-11-22 19:29:28 +01:00
mnovak ea1ec11cd1 [fabrica] Release pin, tests first (QC round 2): a forged pinned commit is refused, a rebased-away one is accepted with the tagged commit as the build reference (red) 2026-11-22 19:28:52 +01:00
mnovak 1905ff81ce [bench] Conformance rerun with the slow-client probes: both engines drop a TLS handshake that never starts at 60 s; Ianitor drops an endless HTTP/2 header block in 2.5 s, Caddy keeps it open; Caddy's version recorded (v2.11.7) 2026-11-22 19:19:50 +01:00
mnovak 3ca88e26cc [deploy] Proxy socket: the option says X-Forwarded-Proto is always https there (HTTPS fronts only) 2026-11-22 19:05:25 +01:00
mnovak d058a72ed2 [tests] Fuzz: one fixed credentials folder, rewritten by each run, instead of one per process 2026-11-22 19:05:03 +01:00
mnovak facf4422c8 [bench] Conformance: the slow-client probes (a TLS handshake that never starts, an HTTP/2 header block that never ends) against both engines, and Caddy's real version from the binary's build info 2026-11-22 19:04:59 +01:00
mnovak 142f0bedf7 [fabrica] Release: the pin gate's own tests run before the pin step; python3 in the ci shell for the slow-client probes 2026-11-22 19:04:56 +01:00
mnovak 7f733102bf [control] Start and resolver (QC nits): the live tree goes through the same rules as an apply before control writes it to the engines, and a guard frees an edge name lookup's entry and thread on every way out, a panic included 2026-11-22 19:04:47 +01:00
mnovak 6f259e410a [edge] Resolver and control start, tests first (QC nits): a lookup thread that panics must not leave its name stuck, and a kept tree that breaks a changed [ui] config is not written to the engines at start (red) 2026-11-22 19:04:35 +01:00
mnovak b0e92ff262 [repo] Merge: docs/v0.2.0-release-state (ROADMAP: the v0.2.0 release run waits for Mark's Custos card, PR #12) 2026-11-19 02:24:11 +01:00
mnovak a626c2559f [docs] ROADMAP: the v0.2.0 release run waits for Mark's Custos card 2026-11-19 02:22:16 +01:00
mnovak 7aa8b0ea62 [repo] Merge: feature/fabrica-onboarding (Fabrica: Ianitor onboarded, Aula page, e2e showcase, tests, 0.2.0, PR #11) 2026-11-19 01:57:11 +01:00
mnovak 805b4b8db5 [repo] Fabrica: the release sets PLAYWRIGHT_BROWSERS_PATH on F: for the videos' ffmpeg 2026-11-19 01:55:20 +01:00
mnovak ec4a0086b9 [web] E2E: the suite is type-checked with Node's types, apart from the UI's 2026-11-19 01:50:09 +01:00
mnovak 6c11acdc6d [repo] Release: 0.2.0 2026-11-19 01:38:54 +01:00
mnovak 82339f098f [repo] Fabrica: aula: true, the Aula page, the source archive, tests.yaml and the e2e pipeline 2026-11-19 01:37:46 +01:00
mnovak 76a56311cf [web] E2E: Playwright flows recorded and the Aula shots, on the demo control plane at a fixed instant 2026-11-19 01:36:02 +01:00
mnovak a212d5d421 [docs] Fabrica: the six onboarding items for Ianitor, the release's download and the Aula entry 2026-11-19 01:34:58 +01:00
56 changed files with 1762 additions and 940 deletions
+8 -4
View File
@@ -1,10 +1,14 @@
# Ianitor Domi declares itself to Fabrica (Fabrica core docs/FORMATS.md, "Fabrica: the app"): a server part only, # Ianitor Domi declares itself to Fabrica (Fabrica core docs/FORMATS.md, "Fabrica: the app"; docs/fabrica.md): a server
# the reverse proxy with its control plane and web UI, deployed by .fabrica/artifex/deploy.yaml through the server's # part only, the reverse proxy with its control plane and web UI, deployed by .fabrica/artifex/deploy.yaml through the
# fabrica-deploy@ianitor. Fabrica's Apps screen shows one card for it: Deploy, then the Custos card. The colour is # server's fabrica-deploy@ianitor, which is also how it updates. Its Aula page comes from the release of a `v*` tag
# the murex accent (packages/ui/src/tokens.css, --accent). # (.fabrica/artifex/release.yaml), started on the hub for the pushed tag: no desktop part, as Ianitor has no installer
# to bump and tag. Fabrica's Apps screen shows one card: Deploy, then the Custos card. The colour is the murex accent
# (packages/ui/src/tokens.css, --accent).
name: Ianitor name: Ianitor
icon: globe icon: globe
color: "#e0a3dc" color: "#e0a3dc"
aula: true
tagPrefix: v
parts: parts:
server: server:
pipeline: deploy pipeline: deploy
+15
View File
@@ -0,0 +1,15 @@
# Ianitor Domi: the web UI's e2e suite on Fabrica's e2e runner (docs/fabrica.md part 6; Fabrica docs/20_tests.md,
# docs/31_runners_here.md): the built UI against the demo control plane, Playwright headless in the installed Edge,
# the records, traces and videos kept with the run. Manual: no push webhook reaches the hub yet. The e2e runner's
# runner.json sets PLAYWRIGHT_BROWSERS_PATH (Playwright's ffmpeg for the videos; on D: or F:, never C:).
name: e2e
on:
manual: true
runner: windows-e2e
steps:
- id: install
run: pnpm install --frozen-lockfile
- id: web
needs: [install]
run: fabrica tests run --target web
artifacts: [".fabrica/runs/tests/**"]
+35 -11
View File
@@ -1,11 +1,15 @@
# Ianitor Domi: the Gitea release of a v* tag (docs/release.md). Ianitor ships no binary (the server builds it with # Ianitor Domi: the Gitea release of a v* tag (docs/release.md, docs/fabrica.md). Ianitor ships no binary (the server
# Nix and the deploy pipeline switches it in), so a release is its notes and screenshots of the web UI, published under # builds it with Nix and the deploy pipeline switches it in), so a release is the source archive of the tag, its notes,
# a SHA256SUMS signed by domi-release through Custos; release-notes.md is also the release's text on Gitea. # the screenshots of the web UI, the Aula page and the Nix pin, all under a SHA256SUMS signed by domi-release through
# Custos; release-notes.md is also the release's text on Gitea.
# The Windows runner (the Fabrica app on Mark's PC) runs it: `fabrica`, node and pnpm are on every step's PATH. # The Windows runner (the Fabrica app on Mark's PC) runs it: `fabrica`, node and pnpm are on every step's PATH.
# No Gitea webhook to the hub yet: a pushed tag is started on demand (the hub's POST /api/runs, ref v<version>). # No Gitea webhook to the hub yet: a pushed tag is started on demand (the hub's POST /api/runs, ref v<version>).
# `notes` is Fabrica's release notes since the previous v* tag (Fabrica docs/12_release_kit.md); `shots` takes the # The web UI's e2e suite (apps/web/playwright.config.ts) runs the main flows and takes the pictures in the installed
# same files as `fabrica aula shots` (core docs/FORMATS.md, "Fabrica: the Aula page") from the built web UI against # Edge against the demo control plane with invented data, at a fixed instant; `fabrica aula shots` checks and copies
# the demo control plane with invented data, in headless Edge. No landing page while app.yaml has no `aula: true`. # them (.fabrica/aula.yaml, `file:` shots) and `fabrica aula page` builds the landing page from them and the brief.
# Playwright's ffmpeg (the flows' videos) is in PLAYWRIGHT_BROWSERS_PATH, set here so the step does not depend on the
# runner's environment: F:\ms-playwright on Mark's PC, never C:. Nothing is downloaded during a release; a runner
# without it fails the e2e step with Playwright's "Executable doesn't exist" naming the path.
# `pin` publishes the Nix build's NAR hashes (.fabrica/nix/pin.json, written by scripts/nix-pin.sh on Linux at a # `pin` publishes the Nix build's NAR hashes (.fabrica/nix/pin.json, written by scripts/nix-pin.sh on Linux at a
# clean commit and committed before the tag) as ianitor-nix.json, and refuses a pin made from other code than the # clean commit and committed before the tag) as ianitor-nix.json, and refuses a pin made from other code than the
# tag's (its recorded source tree must be the tag's); that check is the gate, since pipelines cannot depend on one # tag's (its recorded source tree must be the tag's); that check is the gate, since pipelines cannot depend on one
@@ -15,6 +19,8 @@ on:
tag: "v*" tag: "v*"
manual: true manual: true
runner: windows runner: windows
env:
PLAYWRIGHT_BROWSERS_PATH: 'F:\ms-playwright'
steps: steps:
- id: version - id: version
run: node scripts/check-version.mjs ${{ version }} run: node scripts/check-version.mjs ${{ version }}
@@ -26,28 +32,46 @@ steps:
- id: test - id: test
needs: [install] needs: [install]
run: pnpm --filter web test run: pnpm --filter web test
- id: e2e
needs: [check, test]
run: pnpm --filter web test:e2e
- id: pictures
needs: [e2e]
run: pnpm --filter web aula:shots
- id: source
needs: [version]
run: node scripts/pack-source.mjs ${{ version }}
artifacts: ["target/release/ianitor-*-src.tar.gz"]
- id: notes - id: notes
run: fabrica notes run: fabrica notes
artifacts: ["target/notes/release-notes.md", "target/notes/release-notes.json"] artifacts: ["target/notes/release-notes.md", "target/notes/release-notes.json"]
- id: shots - id: shots
needs: [check, test] needs: [pictures]
run: node apps/web/scripts/shots.mjs run: fabrica aula shots
artifacts: ["target/aula/aula-*.png", "target/aula/aula.json"] artifacts: ["target/aula/aula-*.png", "target/aula/aula.json"]
- id: page
needs: [notes, shots]
run: fabrica aula page
artifacts: ["target/aula/aula-page.json", "target/aula/aula-page.html"]
- id: pin-test
run: node --test scripts/release-pin.test.mjs
- id: pin - id: pin
needs: [version] needs: [version, pin-test]
run: node scripts/release-pin.mjs ${{ version }} ${{ tag }} ${{ commit }} run: node scripts/release-pin.mjs ${{ version }} ${{ tag }} ${{ commit }}
artifacts: ["target/nix/ianitor-nix.json"] artifacts: ["target/nix/ianitor-nix.json"]
- id: approve - id: approve
needs: [version, notes, shots, pin] needs: [source, page, pin]
approve: "Publish Ianitor ${{ tag }}: its notes and screenshots?" approve: "Publish Ianitor ${{ tag }}: its source, notes, screenshots and Nix pin?"
- id: publish - id: publish
needs: [approve] needs: [approve]
publish: publish:
gitea-release: true gitea-release: true
files: files:
- "**/ianitor-*-src.tar.gz"
- "**/release-notes.md" - "**/release-notes.md"
- "**/release-notes.json" - "**/release-notes.json"
- "**/aula-*.png" - "**/aula-*.png"
- "**/aula.json" - "**/aula.json"
- "**/aula-page.json"
- "**/ianitor-nix.json" - "**/ianitor-nix.json"
sums: domi-release sums: domi-release
+26
View File
@@ -0,0 +1,26 @@
# Ianitor Domi's Aula page (docs/fabrica.md part 2, part 5; Fabrica docs/09_aula_pages.md, docs/19_web_shots.md).
# Every picture is taken by the web UI's own e2e suite (`pnpm --filter web aula:shots`, apps/web/e2e/specs/aula.spec.ts):
# the built UI in Edge against the demo control plane (apps/web/tests/demo.ts: hostnames under .test, addresses in the
# documentation ranges, people ada and felix), 1440 x 900, at a fixed instant in Europe/Prague. `fabrica aula shots`
# checks each file and publishes it as aula-<name>.png with aula.json; it starts no browser of its own.
shots:
- name: hosts
title: Every host, its health and where it sends traffic
section: Hosts
file: target/e2e/aula/hosts.png
- name: host
title: Editing a host
section: Hosts
file: target/e2e/aula/host.png
- name: engine
title: Pingora serving, Caddy ready as the fallback
section: Engines
file: target/e2e/aula/engine.png
- name: history
title: "History: going back to a kept version"
section: Changes
file: target/e2e/aula/history.png
- name: certificates
title: The Domi CA and the device certificates
section: Certificates
file: target/e2e/aula/certificates.png
+9
View File
@@ -0,0 +1,9 @@
A reverse proxy for a home server where every change is tried, watched and undone if it fails.
Each host says in plain words where its traffic goes, which certificate it uses and whether visitors sign in first. A change is checked, tried and watched for a minute, and goes back on its own if a host stops answering. Pingora serves, Caddy stands by built from the same routes, and a small Domi certificate authority issues the certificates for home-only hosts and devices.
- hosts: Every host with its health, its certificate and where it sends traffic.
- host: A host in plain words: upstreams, certificate, sign-in and health check.
- engine: Pingora serving, with Caddy built from the same routes and compared host by host.
- history: Every kept version in history, and exactly what restoring one would change.
- certificates: The Domi intermediate and the device certificates for phones, laptops and apps.
+13
View File
@@ -0,0 +1,13 @@
Ianitor 0.2.0 gives Ianitor its own page on Aula.
- **The Domi CA from the shared crate domi-pki.** Ianitor's certificate authority is now the shared crate domi-pki
1.0.0, which Fabrica also uses. It keeps the same certificates, messages and key format.
- **A page on Aula** with a short description, five captioned screenshots, these notes, and the source of the version
as its download. All of them are under a `SHA256SUMS` signed by domi-release.
- **Screenshots and videos from the tests.** The web UI's flows run in a real browser against an invented home
server at a fixed time: add a host, undo, restore, share a link, switch the engine and issue a device certificate.
Each flow is recorded. The same run takes the screenshots, so they are the same in every release.
- **Tested in Fabrica.** The flows are Fabrica's `web` test target and its `e2e` pipeline.
Updates stay a deploy. Fabrica's Deploy moves the server to the new commit and switches back if the health check
does not answer.
@@ -0,0 +1,15 @@
---
id: j4yav1
title: Turn on the visual gate against v0.2.0
status: todo
priority: normal
labels: [fabrica, release]
created: 2026-11-19T01:25:43+01:00
updated: 2026-11-19T01:25:43+01:00
doc: docs/fabrica.md
---
Add Fabrica's visual step (docs/28_visual.md part 6) to .fabrica/artifex/release.yaml after shots: fabrica visual compare --shots target/aula --out target/visual --before ${{ tag }} --forge https://gitea.marek-novak.cz/mnovak/ianitor, custos: [gitea-token], and approve needs visual. Waits one release because v0.1.0's shots were taken at a moving clock, so every shot would differ (docs/fabrica.md part 5).
## Log
- 2026-11-19T01:25:43+01:00 mnovak: created
@@ -0,0 +1,15 @@
---
id: jd3x1h
title: Publish the showcase videos on Aula
status: todo
priority: normal
labels: [fabrica, aula]
created: 2026-11-19T01:25:17+01:00
updated: 2026-11-19T01:25:17+01:00
doc: docs/fabrica.md
---
The e2e suite records each main flow as target/e2e/videos/<flow>.webm (docs/fabrica.md part 5). Once Fabrica's docs/37 (aula.yaml `videos:`) is on Fabrica main, list them in .fabrica/aula.yaml, add **/aula-*.webm to the release's publish files and to Aula's entry if needed, and check the limits (WebM, at most 8 MiB and 60 s each, at most 6).
## Log
- 2026-11-19T01:25:17+01:00 mnovak: created
+11
View File
@@ -0,0 +1,11 @@
# Ianitor Domi's Playwright tests (docs/fabrica.md part 6; Fabrica docs/20_tests.md): the web UI's main flows on the
# built UI and the demo control plane (apps/web/playwright.config.ts, project `web`), each recorded as a video.
# `fabrica tests run`, or Tests in the Fabrica app; the e2e pipeline (.fabrica/artifex/e2e.yaml) runs the same target
# on the e2e runner. No android target: Ianitor has no Android build. The Rust suites run in WSL2 and the Nix build.
dir: apps/web
gate: [web]
targets:
- name: web
kind: web
title: The web UI's main flows
project: web
+48
View File
@@ -0,0 +1,48 @@
# Ianitor Domi
*Ianitor* (Latin: the doorkeeper) is the reverse proxy of a home server. It decides which name goes to which
service, with which certificate, and who has to sign in first. Every change is tried before it stays.
- **Hosts in plain words.** Add a host, say where its traffic goes, and pick a Domi or Let's Encrypt certificate.
Choose whether visitors sign in first (Authelia forward-auth). Each host is checked for health and shows as
healthy, degraded or down.
- **Changes that undo themselves.** Every change is compiled, tried, and watched for 60 seconds. If a host stops
answering, the change is reverted on its own. Routes live in a git repository, one file per host, with Undo and a
history you can restore any kept version from.
- **Two engines.** Cloudflare's Pingora serves. Caddy is built from the same routes, compared with Pingora host by
host, and can take over at runtime in about two seconds.
- **The Domi certificate authority.** It issues certificates for hosts reached only from home, and device
certificates (mTLS) for phones, computers and Domi apps. They come from an intermediate whose root stays offline.
- **Share links**, signed and time-limited, for a single host.
- **Every action in three clicks or fewer**, in a dark web UI that only the signed-in owner reaches.
## For whom
For someone who runs services at home (a wiki, photos, music, cameras) and wants each one to have a name, a
certificate and a sign-in, without editing a proxy's config by hand and without a change that breaks the house.
## Installing
Ianitor runs on NixOS. There is nothing to download and run: the server builds it from source with Nix.
1. Add the flake `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git` as an input of the server's flake, and
import its module `nixosModules.ianitor`.
2. Set `services.ianitor`: `enable`, the edge's listen addresses, the routes repository, the share-link key file
and, for the Domi CA, `pki`. Keys and passwords come from files the system provides (sops, systemd
credentials), never from the Nix store. Then rebuild.
3. Open the UI's name in a browser and sign in through Authelia.
Ianitor can run beside an existing Caddy first, taking over one host at a time. Updates are a deploy: the server's
flake input moves to the new commit and the system switches, and switches back if the health check does not answer.
## System requirements
- NixOS on x86_64 Linux, with ports 80 and 443 for the edge.
- Authelia for sign-in to the UI and to the hosts that ask for it.
- A git server for the routes repository (any that takes a push over HTTPS).
## The files on this page
`ianitor-<version>-src.tar.gz` is the source of this version: every file in the repository at its tag. The
server's Nix build is made from the same tree. It is listed in `SHA256SUMS`, which verifies with domi-release.
The screenshots show invented hosts on an invented home server.
+4 -2
View File
@@ -21,12 +21,14 @@ bench layer 5 results as data (CSV/JSON), layer 2 outputs.
cargo test --workspace # quote test counts per crate; an exit code alone is not green cargo test --workspace # quote test counts per crate; an exit code alone is not green
cargo run -p ianitor-control -- --dev cargo run -p ianitor-control -- --dev
pnpm --filter web dev # 127.0.0.1 only, never --host pnpm --filter web dev # 127.0.0.1 only, never --host
node apps/web/scripts/shots.mjs # the release's screenshots (demo data, headless Edge) -> target/aula (docs/release.md) pnpm --filter web test:e2e # the web UI's flows in Edge on demo data, recorded -> target/e2e/videos (docs/fabrica.md)
pnpm --filter web aula:shots # the Aula screenshots from the same suite -> target/e2e/aula; then `fabrica aula shots`
node scripts/check-version.mjs X.Y.Z # Cargo.toml and both package.json carry the version node scripts/check-version.mjs X.Y.Z # Cargo.toml and both package.json carry the version
scripts/conformance.sh # layer 2: h2spec + testssl.sh, Ianitor vs Caddy (nix develop .#ci) scripts/conformance.sh # layer 2: h2spec + testssl.sh, Ianitor vs Caddy (nix develop .#ci)
tests/fuzz/run.sh 60 # layer 3: cargo-fuzz, 60 s a target; crashes become regressions tests/fuzz/run.sh 60 # layer 3: cargo-fuzz, 60 s a target; crashes become regressions
scripts/bench.sh <label> # layer 5: load and soak vs Caddy -> bench/results scripts/bench.sh <label> # layer 5: load and soak vs Caddy -> bench/results
scripts/nix-pin.sh # reproducible build check; writes .fabrica/nix/pin.json before a tag scripts/nix-pin.sh # rebuild check of the outputs; writes .fabrica/nix/pin.json before a tag
node --test scripts/release-pin.test.mjs # the release's pin gate (a pin must be of the tagged code)
nix build .#ianitor nix build .#ianitor
nix flake check # includes NixOS VM tests (Linux + KVM) nix flake check # includes NixOS VM tests (Linux + KVM)
Generated
+6 -6
View File
@@ -1304,7 +1304,7 @@ dependencies = [
[[package]] [[package]]
name = "ianitor-control" name = "ianitor-control"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"axum", "axum",
"base64 0.22.1", "base64 0.22.1",
@@ -1331,7 +1331,7 @@ dependencies = [
[[package]] [[package]]
name = "ianitor-core" name = "ianitor-core"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"domi-pki", "domi-pki",
@@ -1348,7 +1348,7 @@ dependencies = [
[[package]] [[package]]
name = "ianitor-diff" name = "ianitor-diff"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"bytes", "bytes",
"http-body-util", "http-body-util",
@@ -1366,7 +1366,7 @@ dependencies = [
[[package]] [[package]]
name = "ianitor-edge" name = "ianitor-edge"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"async-trait", "async-trait",
@@ -1394,7 +1394,7 @@ dependencies = [
[[package]] [[package]]
name = "ianitor-fuzz" name = "ianitor-fuzz"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"ianitor-core", "ianitor-core",
"ianitor-edge", "ianitor-edge",
@@ -1403,7 +1403,7 @@ dependencies = [
[[package]] [[package]]
name = "ianitor-testkit" name = "ianitor-testkit"
version = "0.1.0" version = "0.2.0"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-util", "futures-util",
+1 -1
View File
@@ -12,7 +12,7 @@ members = [
exclude = ["tests/fuzz/fuzz"] exclude = ["tests/fuzz/fuzz"]
[workspace.package] [workspace.package]
version = "0.1.0" version = "0.2.0"
edition = "2024" edition = "2024"
rust-version = "1.89" rust-version = "1.89"
license = "MPL-2.0" license = "MPL-2.0"
+1 -1
View File
@@ -80,7 +80,7 @@ support is best effort), Caddy and Pebble on PATH: `nix develop .#ci`.
A release is a signed manifest, not a binary: `SHA256SUMS` signed by `domi-release` (through Custos) over the A release is a signed manifest, not a binary: `SHA256SUMS` signed by `domi-release` (through Custos) over the
release notes, screenshots of the UI and `ianitor-nix.json`, the NAR hashes of the Nix build at the tagged commit. release notes, screenshots of the UI and `ianitor-nix.json`, the NAR hashes of the Nix build at the tagged commit.
Anyone can rebuild the pinned commit and compare the hashes: [docs/verify.md](docs/verify.md). What is checked Anyone can rebuild the tagged commit and compare the hashes: [docs/verify.md](docs/verify.md). What is checked
so far is narrower than "reproducible": the output derivations are rebuilt once and compared, with dependencies so far is narrower than "reproducible": the output derivations are rebuilt once and compared, with dependencies
from the binary cache, and that has not run yet; the first pin needs a machine with Nix. from the binary cache, and that has not run yet; the first pin needs a machine with Nix.
+6
View File
@@ -0,0 +1,6 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
/** The suite's instant: the demo's answers and the page's Date both read it (a Monday morning in Prague). */
export const CLOCK = "2026-11-16T09:30:00+01:00";
+64
View File
@@ -0,0 +1,64 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// What every e2e test gets: the demo started over, the page's clock at the suite's instant, `open`
// for a page of the UI, and afterwards a check that nothing the page showed looks real
// (tests/demo.ts realLooking: names outside .test, addresses outside the documentation ranges).
// A test with a `video` annotation has its recording kept as target/e2e/videos/<name>.webm.
import { mkdirSync } from "node:fs";
import { join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { test as base, expect, type Page } from "@playwright/test";
import { realLooking } from "../tests/demo";
import { CLOCK } from "./clock";
export const REPO = resolve(fileURLToPath(new URL(".", import.meta.url)), "../../..");
export const TARGET = join(REPO, "target", "e2e");
function url(): string {
const u = process.env.IANITOR_E2E_URL;
if (!u) throw new Error("IANITOR_E2E_URL is not set: run the suite through playwright.config.ts (its global setup serves the demo)");
return u;
}
/** Every text, field value and link the page shows (the body: the head's links are the build's own files). */
async function shown(page: Page): Promise<string[]> {
return page.evaluate(() => {
const out: string[] = [];
const walk = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
for (let n = walk.nextNode(); n; n = walk.nextNode()) if (n.textContent?.trim()) out.push(n.textContent);
document.body.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>("input, textarea").forEach((i) => out.push(i.value));
document.body.querySelectorAll("[href]").forEach((a) => out.push(a.getAttribute("href") ?? ""));
return out;
});
}
export const test = base.extend<{ open: (path: string) => Promise<void> }>({
open: async ({ page, request }, use) => {
const res = await request.post(`${url()}/__demo/reset`);
expect(res.status()).toBe(204);
await page.clock.setFixedTime(new Date(CLOCK));
await use(async (path: string) => {
await page.goto(url() + path);
});
},
});
test.afterEach(async ({ page }, info) => {
const video = info.annotations.find((a) => a.type === "video")?.description;
if (!page.isClosed()) {
const seen = (await shown(page)).flatMap(realLooking);
expect(seen, "the page showed something that looks real").toEqual([]);
}
const rec = page.video();
if (video && rec && info.status === info.expectedStatus) {
await page.close();
const dir = join(TARGET, "videos");
mkdirSync(dir, { recursive: true });
await rec.saveAs(join(dir, `${video}.webm`));
}
});
export { expect };
+113
View File
@@ -0,0 +1,113 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// The e2e suite's server (Playwright's global setup): builds the web UI (Vite, production) into a
// fresh temporary folder and serves it on 127.0.0.1 at a free port, with /api/v1 answered by the
// demo control plane (tests/demo.ts) at the suite's fixed instant. Any other path falls back to
// index.html, as in production. POST /__demo/reset starts the demo over (each test starts from the
// same invented server). The address reaches the tests as IANITOR_E2E_URL. Nothing here listens on
// anything but loopback, and the temporary folder is removed when the run ends.
import { existsSync, mkdtempSync, readFileSync, rmSync, statSync } from "node:fs";
import { createServer, type IncomingMessage, type Server } from "node:http";
import { tmpdir } from "node:os";
import { extname, join, normalize, resolve, sep } from "node:path";
import { fileURLToPath } from "node:url";
import { build } from "vite";
import { demoApi } from "../tests/demo";
import { clock } from "../tests/mockApi";
import { CLOCK } from "./clock";
const web = resolve(fileURLToPath(new URL(".", import.meta.url)), "..");
const TYPES: Record<string, string> = {
".html": "text/html; charset=utf-8",
".js": "text/javascript; charset=utf-8",
".css": "text/css; charset=utf-8",
".json": "application/json",
".svg": "image/svg+xml",
".png": "image/png",
".ico": "image/x-icon",
".woff": "font/woff",
".woff2": "font/woff2",
".txt": "text/plain; charset=utf-8",
};
function body(req: IncomingMessage): Promise<Record<string, unknown>> {
return new Promise((ok) => {
const chunks: Buffer[] = [];
req.on("data", (c: Buffer) => chunks.push(c));
req.on("end", () => {
try {
ok(chunks.length ? (JSON.parse(Buffer.concat(chunks).toString("utf8")) as Record<string, unknown>) : {});
} catch {
ok({});
}
});
});
}
function serve(dist: string): Promise<Server> {
const index = readFileSync(join(dist, "index.html"));
let api = demoApi();
const server = createServer((req, res) => {
const url = new URL(req.url ?? "/", "http://127.0.0.1");
if (url.pathname === "/__demo/reset" && req.method === "POST") {
api = demoApi();
res.writeHead(204).end();
return;
}
if (url.pathname === "/api/v1" || url.pathname.startsWith("/api/v1/")) {
void body(req).then((b) => {
const a = api(req.method ?? "GET", url.pathname.slice("/api/v1".length) + url.search, b);
res.writeHead(a.status, { "Content-Type": "application/json", "Cache-Control": "no-store" });
res.end(a.text ?? undefined);
});
return;
}
let path: string;
try {
path = decodeURIComponent(url.pathname);
} catch {
res.writeHead(400).end();
return;
}
const file = normalize(join(dist, path));
if (file.startsWith(dist + sep) && existsSync(file) && statSync(file).isFile()) {
res.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" });
res.end(readFileSync(file));
return;
}
res.writeHead(200, { "Content-Type": TYPES[".html"], "Cache-Control": "no-store" });
res.end(index);
});
return new Promise((ok, fail) => {
server.once("error", fail);
server.listen(0, "127.0.0.1", () => ok(server));
});
}
export default async function setup(): Promise<() => Promise<void>> {
clock.fixed = Date.parse(CLOCK);
const tmp = mkdtempSync(join(tmpdir(), "ianitor-e2e-"));
const remove = () => rmSync(tmp, { recursive: true, force: true, maxRetries: 10, retryDelay: 200 });
let server: Server;
try {
const dist = join(tmp, "dist");
await build({ root: web, logLevel: "warn", build: { outDir: dist, emptyOutDir: true } });
server = await serve(dist);
} catch (e) {
remove();
throw e;
}
const addr = server.address();
if (!addr || typeof addr === "string") throw new Error("the demo server has no port");
process.env.IANITOR_E2E_URL = `http://127.0.0.1:${addr.port}`;
console.log(`e2e: the built UI and the demo control plane on ${process.env.IANITOR_E2E_URL}`);
return async () => {
server.closeAllConnections();
await new Promise<void>((r) => server.close(() => r()));
remove();
};
}
+28
View File
@@ -0,0 +1,28 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// The release's screenshots (docs/release.md): each shot of tests/demo.ts SHOTS, 1440 × 900 at
// scale 1, saved as target/e2e/aula/<name>.png. .fabrica/aula.yaml lists the same files, which
// `fabrica aula shots` checks and publishes as aula-<name>.png with aula.json.
import { mkdirSync } from "node:fs";
import { join } from "node:path";
import { SHOTS } from "../../tests/demo";
import { TARGET, expect, test } from "../fixtures";
const dir = join(TARGET, "aula");
for (const shot of SHOTS) {
test(`aula: ${shot.name}`, async ({ page, open }) => {
await open(shot.path);
for (const sel of shot.click ?? []) await page.locator(sel).first().click();
await expect(page.locator(shot.wait).first()).toBeAttached();
// Nothing still loading, the fonts in, two frames drawn and transitions over.
await expect(page.locator("[aria-busy=true]")).toHaveCount(0);
await page.evaluate(() => document.fonts.ready.then(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)))));
await page.waitForTimeout(400);
mkdirSync(dir, { recursive: true });
await page.screenshot({ path: join(dir, `${shot.name}.png`), animations: "disabled", caret: "hide" });
});
}
+116
View File
@@ -0,0 +1,116 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// The main flows of ROADMAP §4 in a real browser, on the built UI and the demo control plane, with
// the clicks counted as in the smoke test (tests/flows.test.ts). Each is recorded: the showcase
// videos (docs/fabrica.md part 5) are target/e2e/videos/<name>.webm.
import type { Locator, Page } from "@playwright/test";
import { expect, test } from "../fixtures";
function counter() {
let n = 0;
return {
click: async (l: Locator) => {
n++;
await l.click();
},
get count() {
return n;
},
};
}
/** A beat for the viewer of the video, so a screen is seen before the next click. */
const beat = (page: Page) => page.waitForTimeout(700);
const nav = (page: Page) => page.getByRole("navigation", { name: "Main" }).first();
test("Add a host: + Host → fill → Apply = 2 clicks, kept", { annotation: { type: "video", description: "add-host" } }, async ({ page, open }) => {
const c = counter();
await open("/");
await expect(page.getByRole("button", { name: "More for wiki.home.test" })).toBeVisible();
await beat(page);
await c.click(page.getByRole("button", { name: "Add a host" }));
await page.getByLabel("Hostname").pressSequentially("notes.home.test");
await page.getByLabel("Send traffic to").fill("http://192.0.2.60:8080");
await beat(page);
await c.click(page.getByRole("button", { name: "Apply" }));
await expect(page.locator("dialog.ia-panel")).toHaveCount(0, { timeout: 10_000 });
await expect(page.getByRole("button", { name: "More for notes.home.test" })).toBeVisible();
await beat(page);
expect(c.count).toBe(2);
});
test("Undo the last change = 1 click", { annotation: { type: "video", description: "undo" } }, async ({ page, open }) => {
const c = counter();
await open("/");
const undo = page.getByRole("button", { name: /^Undo: Added recipes\.home\.test/ });
await expect(undo).toBeVisible();
await beat(page);
const sent = page.waitForRequest((r) => r.method() === "POST" && r.url().endsWith("/api/v1/undo"));
await c.click(undo);
expect((await sent).postDataJSON()).toMatchObject({ target_change_id: "ch_0008" });
await beat(page);
expect(c.count).toBe(1);
});
test("Restore: History → pick → Restore = 3 clicks", { annotation: { type: "video", description: "restore" } }, async ({ page, open }) => {
const c = counter();
await open("/");
await expect(page.getByRole("button", { name: "Add a host" })).toBeVisible();
await c.click(nav(page).getByRole("link", { name: "History" }));
await beat(page);
await c.click(page.getByRole("button", { name: /Turned share links on for wiki\.home\.test/ }));
await expect(page.getByRole("button", { name: "Restore this version" })).toBeVisible();
await beat(page);
const sent = page.waitForRequest((r) => r.method() === "POST" && r.url().endsWith("/api/v1/restore"));
await c.click(page.getByRole("button", { name: "Restore this version" }));
await sent;
await beat(page);
expect(c.count).toBe(3);
});
test("Share link: ⋯ → Share link → Copy = 3 clicks, 7 days", { annotation: { type: "video", description: "share-link" } }, async ({ page, context, open }) => {
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
const c = counter();
await open("/");
await c.click(page.getByRole("button", { name: "More for wiki.home.test" }));
const minted = page.waitForRequest((r) => r.method() === "POST" && r.url().endsWith("/share-links"));
await c.click(page.getByRole("menuitem", { name: /Share link/ }));
expect((await minted).postDataJSON()).toMatchObject({ expires_in_s: 604800 });
const copy = page.getByRole("button", { name: "Copy link" });
await expect(copy).not.toHaveAttribute("aria-disabled", /.*/);
await beat(page);
await c.click(copy);
await expect(page.getByText("Copied")).toBeVisible();
await beat(page);
expect(c.count).toBe(3);
});
test("Switch engine: engine chip → Switch to Caddy = 2 clicks", { annotation: { type: "video", description: "engine" } }, async ({ page, open }) => {
const c = counter();
await open("/");
await c.click(page.getByRole("button", { name: /^Engine: Pingora/ }));
await expect(page.getByRole("button", { name: "Switch to Caddy" })).toBeVisible();
await beat(page);
await c.click(page.getByRole("button", { name: "Switch to Caddy" }));
await expect(page.getByText("Now serving with Caddy.")).toBeVisible({ timeout: 10_000 });
await beat(page);
expect(c.count).toBe(2);
});
test("Device certificate: Certificates → + Device → Issue = 3 clicks", { annotation: { type: "video", description: "device-certificate" } }, async ({ page, open }) => {
const c = counter();
await open("/");
await expect(page.getByRole("button", { name: "Add a host" })).toBeVisible();
await c.click(nav(page).getByRole("link", { name: "Certificates" }));
await beat(page);
await c.click(page.getByRole("button", { name: "Add a device certificate" }));
await page.getByLabel("Device name").fill("felix's tablet");
await c.click(page.getByRole("button", { name: "Issue" }));
await expect(page.getByLabel("Match code 47 19 83")).toBeVisible();
expect(c.count).toBe(3);
await expect(page.getByRole("button", { name: "Show QR code" })).toBeVisible({ timeout: 10_000 });
await beat(page);
});
+9
View File
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["node"],
"noEmit": true,
"allowImportingTsExtensions": false
},
"include": ["./**/*.ts", "../playwright.config.ts", "../tests/demo.ts", "../tests/mockApi.ts"]
}
+6 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "web", "name": "web",
"version": "0.1.0", "version": "0.2.0",
"private": true, "private": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"description": "Ianitor Domi web UI (Svelte 5, runes, TypeScript strict). A pure client of the control API.", "description": "Ianitor Domi web UI (Svelte 5, runes, TypeScript strict). A pure client of the control API.",
@@ -8,18 +8,21 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings", "check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && tsc -p e2e/tsconfig.json",
"test": "vitest run", "test": "vitest run",
"shots": "node scripts/shots.mjs" "test:e2e": "playwright test --project=web",
"aula:shots": "playwright test --project=aula"
}, },
"dependencies": { "dependencies": {
"@ianitor/ui": "workspace:*" "@ianitor/ui": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "1.56.1",
"@sveltejs/vite-plugin-svelte": "^5.0.3", "@sveltejs/vite-plugin-svelte": "^5.0.3",
"@testing-library/svelte": "^5.2.6", "@testing-library/svelte": "^5.2.6",
"@testing-library/user-event": "^14.6.1", "@testing-library/user-event": "^14.6.1",
"@tsconfig/svelte": "^5.0.4", "@tsconfig/svelte": "^5.0.4",
"@types/node": "^22.20.5",
"jsdom": "^26.0.0", "jsdom": "^26.0.0",
"svelte": "^5.20.0", "svelte": "^5.20.0",
"svelte-check": "^4.1.4", "svelte-check": "^4.1.4",
+51
View File
@@ -0,0 +1,51 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// The web UI's end-to-end suite (docs/fabrica.md, part 5): the built UI in a real browser against
// the demo control plane (tests/demo.ts, invented data only), served on 127.0.0.1 by e2e/serve.ts.
// Two projects:
// web the main flows of ROADMAP §4, each recorded as a video (target/e2e/videos/<flow>.webm);
// Fabrica's `web` target (.fabrica/tests.yaml) and its e2e pipeline run this one.
// aula the release's screenshots (target/e2e/aula/<name>.png), which `fabrica aula shots` checks
// and publishes (.fabrica/aula.yaml, `file:` shots).
// Every page is drawn at a fixed instant in a fixed zone, so two takes of a screen are the same.
// On Windows the browser is the installed Edge (PW_CHANNEL names another, e.g. chrome): nothing is
// downloaded. Elsewhere it is Playwright's own Chromium. Videos need Playwright's ffmpeg, which lives
// in PLAYWRIGHT_BROWSERS_PATH (on F: on Mark's PC, never C:).
import { defineConfig, devices } from "@playwright/test";
const channel = process.env.PW_CHANNEL ?? (process.platform === "win32" ? "msedge" : undefined);
// Fabrica's live view (Fabrica docs/20_tests.md part 3): the port its Tests page watches.
const devtools = process.env.FABRICA_TESTS_DEVTOOLS ? [`--remote-debugging-port=${process.env.FABRICA_TESTS_DEVTOOLS}`] : [];
const desktop = {
...devices["Desktop Chrome"],
...(channel ? { channel } : {}),
viewport: { width: 1440, height: 900 },
deviceScaleFactor: 1,
locale: "en-GB",
timezoneId: "Europe/Prague",
launchOptions: { args: ["--lang=en-GB", ...devtools] },
};
export default defineConfig({
testDir: "e2e/specs",
outputDir: "../../target/e2e/results",
globalSetup: "./e2e/serve.ts",
fullyParallel: false,
workers: 1,
retries: 0,
forbidOnly: !!process.env.CI,
// Generous: the release PC runs several apps' suites at once, and a loaded PC types and draws slowly
// (one Edge start took 45 s there, one flow 72 s). A real hang still ends.
timeout: 180_000,
expect: { timeout: 15_000 },
reporter: [["list"]],
use: { trace: "retain-on-failure" },
projects: [
{ name: "web", testMatch: "flows.spec.ts", use: { ...desktop, video: { mode: "on", size: { width: 1440, height: 900 } } } },
{ name: "aula", testMatch: "aula.spec.ts", use: desktop },
],
});
-418
View File
@@ -1,418 +0,0 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// The release's screenshots of the web UI (docs/release.md):
// node apps/web/scripts/shots.mjs [--out <dir>] (default: <repo>/target/aula)
// Builds the UI, serves it on 127.0.0.1 with /api/v1 answered by the demo control plane
// (tests/demo.ts: invented data only), photographs each shot of demo.ts's SHOTS in headless Edge
// or Chrome over DevTools, and writes aula-<name>.png and aula.json in the format of Fabrica's
// core docs/FORMATS.md ("Fabrica: the Aula page"). On every way out the browser's process tree
// and the server are stopped and the temporary folder is removed.
// Exit codes: 0 done, 1 a problem, 130 cancelled.
import { spawn, spawnSync } from "node:child_process";
import { createHash } from "node:crypto";
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
import { createServer as createHttpServer } from "node:http";
import { tmpdir } from "node:os";
import { basename, delimiter, dirname, extname, join, normalize, resolve, sep } from "node:path";
import { fileURLToPath } from "node:url";
import { build, createServer as createViteServer } from "vite";
const web = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const repo = resolve(web, "../..");
const WAIT_MS = 20_000;
function usage(msg) {
console.error(`shots: ${msg}\nusage: node apps/web/scripts/shots.mjs [--out <dir>]`);
process.exit(1);
}
let out = join(repo, "target", "aula");
for (let i = 2; i < process.argv.length; i++) {
const a = process.argv[i];
if (a === "--out" && process.argv[i + 1]) out = resolve(process.argv[++i]);
else usage(`unknown argument ${a}`);
}
const log = (m) => console.log(`shots: ${m}`);
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
// ---------- cleanup on every way out ----------
const cleanups = [];
let cleaning = false;
async function cleanup() {
if (cleaning) return;
cleaning = true;
for (const f of cleanups.reverse()) {
try {
await f();
} catch (e) {
console.error(`shots: cleanup: ${e?.message ?? e}`);
}
}
}
process.on("SIGINT", () => void cleanup().then(() => process.exit(130)));
process.on("SIGTERM", () => void cleanup().then(() => process.exit(130)));
// ---------- the output folder ----------
function clearOutput() {
mkdirSync(out, { recursive: true });
for (const n of readdirSync(out)) {
if (n === "aula.json" || (n.startsWith("aula-") && n.endsWith(".png"))) rmSync(join(out, n), { force: true });
}
}
/** Width and height from the PNG's IHDR, not assumed. */
function pngSize(png) {
const sig = "89504e470d0a1a0a";
if (png.length < 24 || png.subarray(0, 8).toString("hex") !== sig || png.subarray(12, 16).toString("latin1") !== "IHDR") {
throw new Error("the browser's capture is not a PNG");
}
return { width: png.readUInt32BE(16), height: png.readUInt32BE(20) };
}
// ---------- the demo control plane and the built UI on 127.0.0.1 ----------
const TYPES = {
".html": "text/html; charset=utf-8",
".js": "text/javascript; charset=utf-8",
".css": "text/css; charset=utf-8",
".json": "application/json",
".svg": "image/svg+xml",
".png": "image/png",
".ico": "image/x-icon",
".woff": "font/woff",
".woff2": "font/woff2",
".txt": "text/plain; charset=utf-8",
};
function serve(dist, api) {
const index = readFileSync(join(dist, "index.html"));
const server = createHttpServer((req, res) => {
const url = new URL(req.url ?? "/", "http://127.0.0.1");
if (url.pathname.startsWith("/api/v1/") || url.pathname === "/api/v1") {
const chunks = [];
req.on("data", (c) => chunks.push(c));
req.on("end", () => {
let body = {};
try {
body = chunks.length ? JSON.parse(Buffer.concat(chunks).toString("utf8")) : {};
} catch {
body = {};
}
const a = api(req.method ?? "GET", url.pathname.slice("/api/v1".length) + url.search, body);
res.writeHead(a.status, { "Content-Type": "application/json", "Cache-Control": "no-store" });
res.end(a.text ?? undefined);
});
return;
}
// The built files; any other path is the app's own route, answered with index.html.
const file = normalize(join(dist, decodeURIComponent(url.pathname)));
if (file.startsWith(dist + sep) && existsSync(file) && statSync(file).isFile()) {
res.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" });
res.end(readFileSync(file));
return;
}
res.writeHead(200, { "Content-Type": TYPES[".html"], "Cache-Control": "no-store" });
res.end(index);
});
return new Promise((ok, fail) => {
server.once("error", fail);
server.listen(0, "127.0.0.1", () => ok(server));
});
}
// ---------- the browser ----------
function findBrowser() {
const named = process.env.IANITOR_SHOTS_BROWSER;
if (named) {
if (!existsSync(named)) throw new Error(`IANITOR_SHOTS_BROWSER: ${named} does not exist`);
return named;
}
const candidates = [];
if (process.platform === "win32") {
for (const base of [process.env["ProgramFiles(x86)"], process.env.ProgramFiles, process.env.LOCALAPPDATA].filter(Boolean)) {
candidates.push(join(base, "Microsoft", "Edge", "Application", "msedge.exe"), join(base, "Google", "Chrome", "Application", "chrome.exe"));
}
} else {
for (const dir of (process.env.PATH ?? "").split(delimiter).filter(Boolean)) {
for (const n of ["chromium", "chromium-browser", "google-chrome", "google-chrome-stable", "microsoft-edge"]) candidates.push(join(dir, n));
}
candidates.push("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
}
const found = candidates.find((c) => existsSync(c));
if (!found) throw new Error("no Microsoft Edge or Chrome found; set IANITOR_SHOTS_BROWSER to a Chromium browser");
return found;
}
/** Only what a program needs to run, the user folders in the temporary folder, nothing of the runner's. */
function cleanEnv(home) {
const keep = /^(SystemRoot|SystemDrive|windir|ComSpec|PATH|PATHEXT|OS|PROCESSOR_.*|NUMBER_OF_PROCESSORS|ProgramFiles.*|ProgramW6432|CommonProgramFiles.*|CommonProgramW6432|ProgramData|ALLUSERSPROFILE|PUBLIC|LANG|TZ)$/i;
const env = {};
for (const [k, v] of Object.entries(process.env)) if (keep.test(k) && v !== undefined) env[k] = v;
for (const d of ["home", "appdata", "local", "temp"]) mkdirSync(join(home, d), { recursive: true });
Object.assign(env, {
HOME: join(home, "home"),
USERPROFILE: join(home, "home"),
APPDATA: join(home, "appdata"),
LOCALAPPDATA: join(home, "local"),
TEMP: join(home, "temp"),
TMP: join(home, "temp"),
TMPDIR: join(home, "temp"),
});
return env;
}
/** Edge may start its browser again as a new process, outside the tree: on Windows, anything still
* running with a profile in the temporary folder is stopped by its command line. */
function sweep(exe, tmp) {
if (process.platform !== "win32") return;
const script = "Get-CimInstance Win32_Process -Filter \"Name='$env:SHOTS_EXE'\" | Where-Object { $_.CommandLine -and $_.CommandLine.Contains($env:SHOTS_TMP) } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }";
spawnSync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", script], {
stdio: "ignore",
windowsHide: true,
env: { ...cleanEnv(join(tmp, "sweep")), SHOTS_EXE: basename(exe), SHOTS_TMP: tmp },
});
}
function killTree(child) {
if (!child.pid || child.exitCode !== null) return;
if (process.platform === "win32") {
spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
} else {
try {
process.kill(-child.pid, "SIGKILL");
} catch {
child.kill("SIGKILL");
}
}
}
/** Starts the browser; one that has not opened DevTools after 20 s is killed and started again, twice. */
async function startBrowser(exe, tmp, size) {
for (let attempt = 1; ; attempt++) {
try {
return await launch(exe, join(tmp, `profile-${attempt}`), join(tmp, `user-${attempt}`), size);
} catch (e) {
if (attempt === 3 || e.fatal) throw e;
log(`${e.message}; starting it again`);
}
}
}
async function launch(exe, profile, user, size) {
mkdirSync(profile, { recursive: true });
const args = [
"--headless=new",
"--remote-debugging-port=0",
"--remote-debugging-address=127.0.0.1",
`--user-data-dir=${profile}`,
"--no-first-run",
"--no-default-browser-check",
"--disable-extensions",
"--disable-sync",
"--disable-background-networking",
"--disable-component-update",
"--disable-default-apps",
"--disable-features=Translate,OptimizationHints,MediaRouter,msSmartScreenProtection",
"--hide-scrollbars",
"--mute-audio",
"--force-color-profile=srgb",
"--force-device-scale-factor=1",
`--window-size=${size.width},${size.height}`,
"about:blank",
];
const child = spawn(exe, args, { env: cleanEnv(user), stdio: ["ignore", "ignore", "pipe"], windowsHide: true, detached: process.platform !== "win32" });
const stop = async () => {
killTree(child);
for (let i = 0; i < 50 && child.exitCode === null && child.signalCode === null; i++) await sleep(100);
};
cleanups.push(stop);
let stderr = "";
child.stderr.on("data", (d) => (stderr = (stderr + d).slice(-2000)));
const fail = async (msg, fatal = false) => {
await stop();
const tail = stderr.trim().split(/\r?\n/).slice(-3).join(" | ");
throw Object.assign(new Error(`${msg}${tail ? `; it said: ${tail}` : ""}`), { fatal });
};
let exited = null;
child.on("exit", (code) => (exited = code ?? -1));
child.on("error", (e) => (exited = e.message));
const portFile = join(profile, "DevToolsActivePort");
const deadline = Date.now() + 20_000;
let seen = "no DevToolsActivePort yet";
for (;;) {
if (exited !== null) await fail(`the browser exited before it was ready (${exited})`, typeof exited === "string");
if (existsSync(portFile)) {
const port = Number(readFileSync(portFile, "utf8").split(/\r?\n/)[0]);
if (port > 0) {
try {
const list = await (await fetch(`http://127.0.0.1:${port}/json/list`)).json();
const page = list.find((t) => t.type === "page" && t.webSocketDebuggerUrl);
if (page) return page.webSocketDebuggerUrl;
seen = `no page among ${list.length} targets on port ${port}`;
await fetch(`http://127.0.0.1:${port}/json/new?about:blank`, { method: "PUT" }).catch(() => {});
} catch (e) {
seen = `port ${port}: ${e.cause?.message ?? e.message}`;
}
}
}
if (Date.now() > deadline) await fail(`the browser's DevTools did not answer within 20 s (${seen})`);
await sleep(200);
}
}
/** A minimal DevTools client over Node's WebSocket. */
async function devtools(url) {
const ws = new WebSocket(url);
await new Promise((ok, fail) => {
ws.onopen = ok;
ws.onerror = () => fail(new Error("cannot open the browser's DevTools socket"));
});
let id = 0;
const pending = new Map();
ws.onmessage = (m) => {
const msg = JSON.parse(String(m.data));
const p = msg.id !== undefined && pending.get(msg.id);
if (!p) return;
pending.delete(msg.id);
if (msg.error) p.fail(new Error(`${p.method}: ${msg.error.message}`));
else p.ok(msg.result);
};
ws.onclose = () => {
for (const p of pending.values()) p.fail(new Error("the browser closed its DevTools socket"));
pending.clear();
};
cleanups.push(() => ws.close());
const send = (method, params = {}) =>
new Promise((ok, fail) => {
const n = ++id;
pending.set(n, { ok, fail, method });
ws.send(JSON.stringify({ id: n, method, params }));
});
/** The value of an expression in the page; a page being replaced answers again later. */
const evaluate = async (expression) => {
const r = await send("Runtime.evaluate", { expression, awaitPromise: true, returnByValue: true });
if (r.exceptionDetails) throw new Error(r.exceptionDetails.exception?.description ?? r.exceptionDetails.text);
return r.result.value;
};
return { send, evaluate };
}
async function until(what, test) {
const deadline = Date.now() + WAIT_MS;
let last = null;
while (Date.now() < deadline) {
try {
if (await test()) return;
} catch (e) {
last = e;
}
await sleep(100);
}
throw new Error(`waited ${WAIT_MS / 1000} s for ${what}${last ? ` (${last.message})` : ""}`);
}
// ---------- the shots ----------
async function main() {
clearOutput();
const tmp = mkdtempSync(join(tmpdir(), "ianitor-shots-"));
cleanups.push(async () => {
for (let i = 0; i < 20; i++) {
try {
rmSync(tmp, { recursive: true, force: true });
return;
} catch {
await sleep(250);
}
}
console.error(`shots: could not remove ${tmp}`);
});
// The demo's shots and answers, from the TypeScript the tests use.
const loader = await createViteServer({
root: web,
configFile: false,
logLevel: "error",
appType: "custom",
server: { middlewareMode: true, hmr: false, ws: false },
optimizeDeps: { noDiscovery: true, include: [] },
});
let demo;
try {
demo = await loader.ssrLoadModule("/tests/demo.ts");
} finally {
await loader.close();
}
const { SHOTS, SIZE, demoApi } = demo;
log("building the web UI");
const dist = join(tmp, "dist");
await build({ root: web, logLevel: "warn", build: { outDir: dist, emptyOutDir: true } });
const server = await serve(dist, demoApi());
cleanups.push(() => new Promise((r) => server.close(() => r())));
server.closeAllConnections && cleanups.push(() => server.closeAllConnections());
const base = `http://127.0.0.1:${server.address().port}`;
log(`demo control plane and UI on ${base}`);
const exe = findBrowser();
log(`browser: ${exe}`);
cleanups.push(() => sweep(exe, tmp));
const page = await devtools(await startBrowser(exe, tmp, SIZE));
await page.send("Page.enable");
await page.send("Emulation.setDeviceMetricsOverride", { width: SIZE.width, height: SIZE.height, deviceScaleFactor: 1, mobile: false });
const taken = [];
for (const shot of SHOTS) {
const url = base + shot.path;
try {
// A fresh load per shot: mark the old page, so a page that has not been replaced yet does not count.
await page.evaluate("window.__ianitorShotsOld = true").catch(() => {});
await page.send("Page.navigate", { url });
await until(`${url} to load`, () => page.evaluate("!window.__ianitorShotsOld && document.readyState === 'complete'"));
for (const sel of shot.click ?? []) {
const q = JSON.stringify(sel);
await until(`${sel} to click`, () => page.evaluate(`(() => { const e = document.querySelector(${q}); if (!e) return false; e.click(); return true; })()`));
}
const w = JSON.stringify(shot.wait);
await until(shot.wait, () => page.evaluate(`!!document.querySelector(${w})`));
await page.evaluate("document.fonts.ready.then(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r(true)))))");
await sleep(400);
} catch (e) {
try {
const failed = await page.send("Page.captureScreenshot", { format: "png" });
writeFileSync(join(out, `aula-${shot.name}-failed.png`), Buffer.from(failed.data, "base64"));
} catch {
/* nothing to save */
}
throw new Error(`shot ${shot.name}: ${e.message}; the page was ${url}; what it showed is aula-${shot.name}-failed.png`);
}
const png = Buffer.from((await page.send("Page.captureScreenshot", { format: "png" })).data, "base64");
const { width, height } = pngSize(png);
const file = `aula-${shot.name}.png`;
writeFileSync(join(out, file), png);
taken.push({ name: shot.name, title: shot.title, file, width, height, sha256: createHash("sha256").update(png).digest("hex") });
log(`${file} ${width}x${height}`);
}
writeFileSync(join(out, "aula.json"), `${JSON.stringify({ v: 1, shots: taken })}\n`);
log(`${taken.length} shots and aula.json in ${out}`);
}
let code = 0;
try {
await main();
} catch (e) {
console.error(`shots: ${e?.message ?? e}`);
code = 1;
} finally {
await cleanup();
}
process.exit(code);
+1 -18
View File
@@ -10,24 +10,7 @@ import { cleanup, render, waitFor } from "@testing-library/svelte";
import { afterEach, describe, expect, it } from "vitest"; import { afterEach, describe, expect, it } from "vitest";
import App from "../src/App.svelte"; import App from "../src/App.svelte";
import { app } from "../src/lib/app.svelte"; import { app } from "../src/lib/app.svelte";
import { SHOTS, demoApi } from "./demo"; import { SHOTS, demoApi, realLooking } from "./demo";
const ALLOWED_TLDS = new Set(["test", "example", "invalid"]);
const DOC_NETS = ["192.0.2.", "198.51.100.", "203.0.113."];
const FORBIDDEN = ["mark", "marek", "novak", "flowers", "esp32", "hyperv"];
/** What in a text could be real: addresses outside the documentation ranges, names outside .test. */
function realLooking(text: string): string[] {
const found: string[] = [];
for (const m of text.matchAll(/(?<![\w.])\d{1,3}(?:\.\d{1,3}){3}(?![\w.])/g)) {
if (m[0] !== "127.0.0.1" && !DOC_NETS.some((n) => m[0].startsWith(n))) found.push(m[0]);
}
for (const m of text.matchAll(/(?<![\w.-])(?:[a-z0-9-]+\.)+([a-z][a-z0-9-]*)(?![\w-])/gi)) {
if (!ALLOWED_TLDS.has(m[1].toLowerCase())) found.push(m[0]);
}
for (const w of FORBIDDEN) if (new RegExp(`\\b${w}\\b`, "i").test(text)) found.push(w);
return found;
}
let served: { status: number; path: string; text: string | null }[] = []; let served: { status: number; path: string; text: string | null }[] = [];
+62 -7
View File
@@ -9,7 +9,7 @@
// and felix, made-up commits and fingerprints. demo.test.ts renders every shot from it and fails // and felix, made-up commits and fingerprints. demo.test.ts renders every shot from it and fails
// on any other name or address. // on any other name or address.
import { apply, host, mockRoutes, newMock, respond, type Route } from "./mockApi"; import { apply, host, mockRoutes, newMock, nowMs, respond, type Route } from "./mockApi";
/** One screenshot: the page, the selectors clicked in order, and the selector that means "drawn". */ /** One screenshot: the page, the selectors clicked in order, and the selector that means "drawn". */
export interface Shot { export interface Shot {
@@ -34,7 +34,7 @@ export const SHOTS: Shot[] = [
type Json = Record<string, unknown>; type Json = Record<string, unknown>;
const DAY = 86_400; const DAY = 86_400;
const at = (s: number) => new Date(Date.now() + s * 1000).toISOString(); const at = (s: number) => new Date(nowMs() + s * 1000).toISOString();
interface Health { interface Health {
state: string; state: string;
@@ -97,8 +97,8 @@ function intermediate(): Json {
return { state: "ok", subject: "Demo Intermediate CA", not_after: at(212 * DAY), days_left: 212, renewal: null, banner: null }; return { state: "ok", subject: "Demo Intermediate CA", not_after: at(212 * DAY), days_left: 212, renewal: null, banner: null };
} }
function overview(): Json { function overview(added: Json[] = []): Json {
const list = hosts(); const list = [...hosts(), ...added];
const count = (s: string) => list.filter((h) => (h.health as Json).state === s).length; const count = (s: string) => list.filter((h) => (h.health as Json).state === s).length;
return { return {
counts: { hosts: list.length, healthy: count("healthy"), degraded: count("degraded"), down: count("down"), unknown: count("unknown") }, counts: { hosts: list.length, healthy: count("healthy"), degraded: count("degraded"), down: count("down"), unknown: count("unknown") },
@@ -213,10 +213,47 @@ function certs(): Json {
}; };
} }
/** The demo's own answers, first; the smoke test's stand-in answers the rest. */ /** The demo's own answers, first; the smoke test's stand-in answers the rest. A host added in the
* demo (the e2e suite's Add host flow) is listed from then on, healthy, with the upstream it was
* given; a device certificate request carries the name it was asked with. */
export function demoRoutes(): Route[] { export function demoRoutes(): Route[] {
const m = newMock();
const added: Json[] = [];
let device = "";
const request = (state: "waiting" | "approved"): Json => ({
request_id: "pr_dev",
kind: "device",
state,
match_code: "47 19 83",
created_at: at(-5),
expires_at: at(600),
approved_at: state === "approved" ? at(0) : null,
device_id: state === "approved" ? "dv_1" : null,
name: device,
csr_pem: null,
not_after: state === "approved" ? at(365 * DAY) : null,
message_code: state === "approved" ? "pki.issued" : "pki.waiting.manual",
message: state === "approved" ? `${device} has a certificate.` : "Approve it on the server with the match code.",
approve_command: state === "approved" ? null : "ianitor-control pki approve 47 19 83",
problem: null,
});
return [ return [
["GET", /^\/overview$/, () => [200, overview()]], ["GET", /^\/overview$/, () => [200, overview(added)]],
["POST", /^\/hosts$/, (_, b) => {
const h = b.host as Json;
const name = String(h.hostname);
m.state.hostsAdded.push(name);
const ups = Array.isArray(h.upstreams) ? h.upstreams.map(String) : [];
added.push(demoHost(name, ups, { state: "healthy", latency: 11 }, { added_at: at(0) }));
return [202, { apply: apply("ch_new", "queued", `Added ${name}`, [name]) }];
}],
["POST", /^\/certs\/devices$/, (_, b) => {
device = String(b.name ?? "");
return [202, request("waiting")];
}],
["GET", /^\/pki-requests\/pr_dev$/, () => [200, request("approved")]],
// A share link whose token cannot be read as a name (the stand-in's `ish1.abc` would be).
["POST", /^\/hosts\/([^/]+)\/share-links$/, (mm) => [201, { id: "sl_demo", url: `https://${decodeURIComponent(mm[1])}/?share=ish1.4f9c2a7e1b0d`, expires_at: at(7 * DAY), path_prefix: "/", has_password: false, warning: null }]],
["GET", /^\/hosts\/([^/?]+)$/, (mm) => { ["GET", /^\/hosts\/([^/?]+)$/, (mm) => {
const s = spec(decodeURIComponent(mm[1])); const s = spec(decodeURIComponent(mm[1]));
return s ? [200, { host: s, rev: "rev-demo-8" }] : [404, { error: { code: "host.not_found", message: "There is no such host.", field: null, params: {}, retry_after_s: null, detail: null }, errors: [], request_id: "demo" }]; return s ? [200, { host: s, rev: "rev-demo-8" }] : [404, { error: { code: "host.not_found", message: "There is no such host.", field: null, params: {}, retry_after_s: null, detail: null }, errors: [], request_id: "demo" }];
@@ -225,7 +262,7 @@ export function demoRoutes(): Route[] {
["GET", /^\/history\/([^/]+)\/restore-preview$/, (mm) => [200, restorePreview(decodeURIComponent(mm[1]))]], ["GET", /^\/history\/([^/]+)\/restore-preview$/, (mm) => [200, restorePreview(decodeURIComponent(mm[1]))]],
["GET", /^\/certs$/, () => [200, certs()]], ["GET", /^\/certs$/, () => [200, certs()]],
["GET", /^\/settings$/, () => [200, { repo: { name: "home-routes", last_push_at: at(-2 * 3600) }, watch_seconds: 60 }]], ["GET", /^\/settings$/, () => [200, { repo: { name: "home-routes", last_push_at: at(-2 * 3600) }, watch_seconds: 60 }]],
...mockRoutes(newMock()), ...mockRoutes(m),
]; ];
} }
@@ -234,3 +271,21 @@ export function demoApi(): (method: string, path: string, body: Json) => { statu
const routes = demoRoutes(); const routes = demoRoutes();
return (method, path, body) => respond(routes, method.toUpperCase(), path, body); return (method, path, body) => respond(routes, method.toUpperCase(), path, body);
} }
// What the demo may show (demo.test.ts, and the e2e suite on every page it visits).
const ALLOWED_TLDS = new Set(["test", "example", "invalid"]);
const DOC_NETS = ["192.0.2.", "198.51.100.", "203.0.113."];
const FORBIDDEN = ["mark", "marek", "novak", "flowers", "esp32", "hyperv"];
/** What in a text could be real: addresses outside the documentation ranges, names outside .test. */
export function realLooking(text: string): string[] {
const found: string[] = [];
for (const m of text.matchAll(/(?<![\w.])\d{1,3}(?:\.\d{1,3}){3}(?![\w.])/g)) {
if (m[0] !== "127.0.0.1" && !DOC_NETS.some((n) => m[0].startsWith(n))) found.push(m[0]);
}
for (const m of text.matchAll(/(?<![\w.-])(?:[a-z0-9-]+\.)+([a-z][a-z0-9-]*)(?![\w-])/gi)) {
if (!ALLOWED_TLDS.has(m[1].toLowerCase())) found.push(m[0]);
}
for (const w of FORBIDDEN) if (new RegExp(`\\b${w}\\b`, "i").test(text)) found.push(w);
return found;
}
+5 -2
View File
@@ -20,8 +20,11 @@ export interface Mock {
}; };
} }
const now = () => new Date().toISOString(); /** The stand-in's clock: the real one, or a fixed instant (the e2e suite's, so two takes of a screen match). */
const later = (s: number) => new Date(Date.now() + s * 1000).toISOString(); export const clock: { fixed: number | null } = { fixed: null };
export const nowMs = () => clock.fixed ?? Date.now();
const now = () => new Date(nowMs()).toISOString();
const later = (s: number) => new Date(nowMs() + s * 1000).toISOString();
export function host(hostname: string, share: boolean) { export function host(hostname: string, share: boolean) {
return { return {
+8
View File
@@ -76,6 +76,14 @@ keep the comparison honest, not to choose an engine.
| Ianitor | 144 passed, 1 skipped, **0 failed** | A+; TLS 1.2 and 1.3; no server cipher order (rustls follows the client) | | Ianitor | 144 passed, 1 skipped, **0 failed** | A+; TLS 1.2 and 1.3; no server cipher order (rustls follows the client) |
| Caddy 2.11.7 | 140 passed, 1 skipped, **4 failed** | A+; TLS 1.2 and 1.3; server cipher order; session tickets valid 7 days (LOW) | | Caddy 2.11.7 | 140 passed, 1 skipped, **4 failed** | A+; TLS 1.2 and 1.3; server cipher order; session tickets valid 7 days (LOW) |
Slow clients (QC phase 4, `tests/support/probes`, rerun 2026-11-22 with Caddy's version now read from its build
info, `conformance/run.json`):
| | A TLS handshake that never starts | An HTTP/2 header block, one CONTINUATION byte every 0.5 s |
| :-- | :-- | :-- |
| Ianitor | closed after 60 s | closed after 2.5 s (GOAWAY, ENHANCE_YOUR_CALM) |
| Caddy 2.11.7 | closed after 60 s | **still open** after 75 s (the probe's limit; QC saw 150 s) |
Caddy's four h2spec failures (Go's HTTP/2 server): HEADERS larger than SETTINGS_MAX_FRAME_SIZE (4.2/3), several Caddy's four h2spec failures (Go's HTTP/2 server): HEADERS larger than SETTINGS_MAX_FRAME_SIZE (4.2/3), several
SETTINGS_INITIAL_WINDOW_SIZE values (6.5.3/1), a connection-specific header field and a `TE` other than SETTINGS_INITIAL_WINDOW_SIZE values (6.5.3/1), a connection-specific header field and a `TE` other than
`trailers` (8.1.2.2/1 and 2). The two HIGH findings testssl.sh reports for both engines belong to the throwaway test `trailers` (8.1.2.2/1 and 2). The two HIGH findings testssl.sh reports for both engines belong to the throwaway test
+1 -1
View File
@@ -310,5 +310,5 @@ Hypertext Transfer Protocol Version 2 (HTTP/2)
Connection closed Connection closed
Actual: DATA Frame (length:53, flags:0x01, stream_id:1) Actual: DATA Frame (length:53, flags:0x01, stream_id:1)
Finished in 19.5550 seconds Finished in 20.7059 seconds
145 tests, 140 passed, 1 skipped, 4 failed 145 tests, 140 passed, 1 skipped, 4 failed
+1
View File
@@ -0,0 +1 @@
h2 22513: STILL OPEN after 75s; frames [(4, 0, '0005001000000003'), (8, 0, '000f0001'), (4, 1, '')]
+1
View File
@@ -0,0 +1 @@
idle 22513: closed after 60.0s (b'')
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -1,5 +1,5 @@
Start 2026-11-18 18:02:54 -->> 127.0.0.1:30028 (localhost) <<-- Start 2026-11-22 19:16:53 -->> 127.0.0.1:22513 (localhost) <<--
A record via: supplied IP "127.0.0.1" A record via: supplied IP "127.0.0.1"
rDNS (127.0.0.1): localhost. kubernetes.docker.internal. rDNS (127.0.0.1): localhost. kubernetes.docker.internal.
@@ -82,15 +82,15 @@ TLSv1.3 (no server order, thus listed by strength)
Server key size EC 256 bits (curve P-256) Server key size EC 256 bits (curve P-256)
Server key usage Digital Signature Server key usage Digital Signature
Server extended key usage TLS Web Server Authentication Server extended key usage TLS Web Server Authentication
Serial 29F7BED5DF8BBC472F523278F287E910BD19DC07 (OK: length 20) Serial 4FACDAB031F57BFDD07B95B92D64D3DD961BBE52 (OK: length 20)
Fingerprints SHA1 76D4AE2FBE2B32E3C3380B7FAFFC515CF672FE23 Fingerprints SHA1 CCC98BD66BED804F5229E746BD9A063FCB608008
SHA256 0D5E04B7C6D8AD0D952CD17CE75AF5B0263F167F8179214877C8B1D58A7B54AA SHA256 8890533F47576EDA7B8F9E56E317548BF3C583318FF4A2B2971F79223D640691
Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates) Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates)
subjectAltName (SAN) localhost subjectAltName (SAN) localhost
Trust (hostname) Ok via SAN and CN (SNI mandatory) Trust (hostname) Ok via SAN and CN (SNI mandatory)
Chain of trust Ok Chain of trust Ok
EV cert (experimental) no EV cert (experimental) no
Certificate Validity (UTC) 755730 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00) Certificate Validity (UTC) 755726 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
>= 10 years is way too long >= 10 years is way too long
ETS/"eTLS", visibility info not present ETS/"eTLS", visibility info not present
Certificate Revocation List -- Certificate Revocation List --
@@ -192,6 +192,6 @@ TLSv1.3 (no server order, thus listed by strength)
Final Score 96 Final Score 96
Overall Grade A+ Overall Grade A+
Done 2026-11-18 18:05:17 [ 150s] -->> 127.0.0.1:30028 (localhost) <<-- Done 2026-11-22 19:18:22 [ 95s] -->> 127.0.0.1:22513 (localhost) <<--
+1 -1
View File
@@ -257,5 +257,5 @@ HPACK: Header Compression for HTTP/2
6.3. Dynamic Table Size Update 6.3. Dynamic Table Size Update
1: Sends a dynamic table size update larger than the value of SETTINGS_HEADER_TABLE_SIZE ✔ 1: Sends a dynamic table size update larger than the value of SETTINGS_HEADER_TABLE_SIZE 1: Sends a dynamic table size update larger than the value of SETTINGS_HEADER_TABLE_SIZE ✔ 1: Sends a dynamic table size update larger than the value of SETTINGS_HEADER_TABLE_SIZE
Finished in 0.4058 seconds Finished in 0.6470 seconds
145 tests, 144 passed, 1 skipped, 0 failed 145 tests, 144 passed, 1 skipped, 0 failed
+1
View File
@@ -0,0 +1 @@
h2 28753: closed after 2.5s; frames from server [(4, 0, '0003000000640006'), (4, 1, ''), (7, 0, '000000000000000b')]
+1
View File
@@ -0,0 +1 @@
idle 28753: closed after 60.0s (b'')
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -1,5 +1,5 @@
Start 2026-11-18 18:00:21 -->> 127.0.0.1:24056 (localhost) <<-- Start 2026-11-22 19:13:48 -->> 127.0.0.1:28753 (localhost) <<--
A record via: supplied IP "127.0.0.1" A record via: supplied IP "127.0.0.1"
rDNS (127.0.0.1): localhost. kubernetes.docker.internal. rDNS (127.0.0.1): localhost. kubernetes.docker.internal.
@@ -81,15 +81,15 @@ TLSv1.3 (no server order, thus listed by strength)
Server key size EC 256 bits (curve P-256) Server key size EC 256 bits (curve P-256)
Server key usage Digital Signature Server key usage Digital Signature
Server extended key usage TLS Web Server Authentication Server extended key usage TLS Web Server Authentication
Serial 29F7BED5DF8BBC472F523278F287E910BD19DC07 (OK: length 20) Serial 4FACDAB031F57BFDD07B95B92D64D3DD961BBE52 (OK: length 20)
Fingerprints SHA1 76D4AE2FBE2B32E3C3380B7FAFFC515CF672FE23 Fingerprints SHA1 CCC98BD66BED804F5229E746BD9A063FCB608008
SHA256 0D5E04B7C6D8AD0D952CD17CE75AF5B0263F167F8179214877C8B1D58A7B54AA SHA256 8890533F47576EDA7B8F9E56E317548BF3C583318FF4A2B2971F79223D640691
Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates) Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates)
subjectAltName (SAN) localhost subjectAltName (SAN) localhost
Trust (hostname) Ok via SAN and CN (SNI mandatory) Trust (hostname) Ok via SAN and CN (SNI mandatory)
Chain of trust Ok Chain of trust Ok
EV cert (experimental) no EV cert (experimental) no
Certificate Validity (UTC) 755730 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00) Certificate Validity (UTC) 755726 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
>= 10 years is way too long >= 10 years is way too long
ETS/"eTLS", visibility info not present ETS/"eTLS", visibility info not present
Certificate Revocation List -- Certificate Revocation List --
@@ -191,6 +191,6 @@ TLSv1.3 (no server order, thus listed by strength)
Final Score 96 Final Score 96
Overall Grade A+ Overall Grade A+
Done 2026-11-18 18:02:27 [ 131s] -->> 127.0.0.1:24056 (localhost) <<-- Done 2026-11-22 19:15:25 [ 103s] -->> 127.0.0.1:28753 (localhost) <<--
+1 -1
View File
@@ -1 +1 @@
{"build":"release","caddy_version":"unknown","edge_threads":2} {"build":"release","caddy_version":"v2.11.7 (go install; /root/go/bin/caddy: go1.26.8)","edge_threads":2}
+32 -12
View File
@@ -678,6 +678,25 @@ impl Control {
errors: fe, errors: fe,
} }
})?; })?;
self.policy(&model)?;
Ok(Plan {
kind,
verb: host_verb(kind),
summary,
hosts,
target,
model,
attempted,
undo_of,
restore_of,
effect,
})
}
/// What control allows beyond core's schema, for every tree it applies and for the live
/// tree at start: the UI proof only on the [ui] host, a socket upstream only there and only
/// to control's own UI socket.
fn policy(&self, model: &ianitor_core::Model) -> Result<(), Fail> {
// The UI proof belongs to the [ui] host only (core already demands forward-auth for it). // The UI proof belongs to the [ui] host only (core already demands forward-auth for it).
let ui_host = self.cfg.ui.as_ref().and_then(|u| u.hostname.as_deref()); let ui_host = self.cfg.ui.as_ref().and_then(|u| u.hostname.as_deref());
// A socket upstream likewise: only the [ui] host, and only control's own UI socket (a // A socket upstream likewise: only the [ui] host, and only control's own UI socket (a
@@ -738,18 +757,7 @@ impl Control {
}); });
} }
} }
Ok(Plan { Ok(())
kind,
verb: host_verb(kind),
summary,
hosts,
target,
model,
attempted,
undo_of,
restore_of,
effect,
})
} }
fn compile(&self, model: &ianitor_core::Model) -> Result<(String, String), Fail> { fn compile(&self, model: &ianitor_core::Model) -> Result<(String, String), Fail> {
@@ -1794,6 +1802,18 @@ impl Control {
return; return;
} }
}; };
// A tree kept under an earlier control.toml may break today's rules (a changed [ui]
// hostname or socket): it is not written to the engines, and the reason is logged; the
// engines keep the last files written. The next apply is refused for the same reason.
if let Err(f) = self.policy(&model) {
let detail = f
.errors
.first()
.map(|e| e.message.clone())
.unwrap_or_else(|| f.reason.message.clone());
log::error!(target: "ianitor::control", "the routes repository breaks control's rules ({detail}); the engines keep the files they have");
return;
}
let Ok((edge_text, caddy_text)) = self.compile(&model) else { let Ok((edge_text, caddy_text)) = self.compile(&model) else {
return; return;
}; };
+54
View File
@@ -385,6 +385,60 @@ url = \"{}\"
assert!(r.text().contains("\"hosts\""), "{}", r.text()); assert!(r.text().contains("\"hosts\""), "{}", r.text());
} }
/// QC phase 4 (nit): a tree kept under one `[ui] socket` and read at start under another
/// is not written to the engines; the reason is logged.
#[tokio::test(flavor = "multi_thread")]
async fn a_kept_socket_upstream_that_breaks_a_changed_config_is_not_written_at_start() {
let auth = MockAuthelia::start().await;
let site = format!(
"secrets = [\"ui-proof\"]
[forward_auth]
url = \"{}\"
",
auth.url()
);
let (mut env, sock) = socket_env(site, "a.test").await;
let host = json!({"host": {
"hostname": "a.test", "upstreams": [format!("unix:{}", sock.display())],
"tls": "domi", "auth": "forward-auth",
"request_headers": [{"action": "set", "name": "X-Ianitor-Proof", "secret": "ui-proof"}]
}});
let rec = env.apply("POST", "/api/v1/hosts", Some(host)).await;
assert_eq!(
rec["state"],
"kept",
"{rec}
{}",
env.control_log()
);
env.kill_control();
// A marker in place of edge.json: a start that writes the tree to the engines replaces it.
let before = b"{\"marker\": \"left by the test\"}\n".to_vec();
std::fs::write(env.dir.join("edge/edge.json"), &before).unwrap();
let moved = env.dir.join("ui-moved.sock");
let text = std::fs::read_to_string(env.config_path())
.unwrap()
.replace(&sock.display().to_string(), &moved.display().to_string());
std::fs::write(env.config_path(), text).unwrap();
env.start_control(None);
for _ in 0..100 {
if env.control_log().contains("breaks control's rules") {
break;
}
tokio::time::sleep(std::time::Duration::from_millis(50)).await;
}
assert!(
env.control_log().contains("breaks control's rules"),
"{}",
env.control_log()
);
assert_eq!(
std::fs::read(env.dir.join("edge/edge.json")).unwrap(),
before,
"the tree was not written to the engines"
);
}
/// QC: signed in at Authelia (alice) but the client also sends a proof guess: edge must /// QC: signed in at Authelia (alice) but the client also sends a proof guess: edge must
/// replace, not append, the proof; and Remote-User must be Authelia's. /// replace, not append, the proof; and Remote-User must be Authelia's.
#[tokio::test(flavor = "multi_thread")] #[tokio::test(flavor = "multi_thread")]
+45 -2
View File
@@ -130,12 +130,28 @@ impl Resolver {
.spawn({ .spawn({
let key = key.clone(); let key = key.clone();
move || { move || {
// Removes the name's entry and frees the thread's place on every way out, a
// panic in the resolver included: the next request for the name starts a
// new lookup instead of joining a dead one.
struct Done {
inflight: Arc<Inflight>,
key: (String, u16),
_permit: OwnedSemaphorePermit,
}
impl Drop for Done {
fn drop(&mut self) {
lock(&self.inflight).remove(&self.key);
}
}
let _done = Done {
inflight,
key: key.clone(),
_permit: permit,
};
let answer = lookup(&key.0, key.1) let answer = lookup(&key.0, key.1)
.map(Arc::new) .map(Arc::new)
.map_err(|e| (e.kind(), e.to_string())); .map_err(|e| (e.kind(), e.to_string()));
let _ = tx.send(Some(answer)); let _ = tx.send(Some(answer));
lock(&inflight).remove(&key);
drop(permit);
} }
}); });
if let Err(e) = spawned { if let Err(e) = spawned {
@@ -258,6 +274,33 @@ mod tests {
assert_eq!(started.load(Ordering::SeqCst), 1); assert_eq!(started.load(Ordering::SeqCst), 1);
} }
/// QC phase 4 (nit): a lookup thread that panics must not leave its name stuck on a dead
/// lookup; the next request for it starts a new one.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn a_panicking_lookup_does_not_poison_its_name() {
let calls = Arc::new(AtomicUsize::new(0));
let c = calls.clone();
let r = Resolver::new(1, move |_, port| {
if c.fetch_add(1, Ordering::SeqCst) == 0 {
panic!("resolver library bug");
}
Ok(vec![SocketAddr::from(([127, 0, 0, 1], port))])
});
assert!(r.resolve("flaky.test", 80, SHORT).await.is_err());
let mut got = None;
for _ in 0..50 {
match r.resolve("flaky.test", 80, SHORT).await {
Ok(a) => {
got = Some(a);
break;
}
Err(_) => tokio::time::sleep(Duration::from_millis(20)).await,
}
}
assert_eq!(got.unwrap(), vec![SocketAddr::from(([127, 0, 0, 1], 80))]);
assert_eq!(calls.load(Ordering::SeqCst), 2);
}
#[tokio::test] #[tokio::test]
async fn literals_empty_answers_and_errors() { async fn literals_empty_answers_and_errors() {
let r = Resolver::new(1, |host, _| match host { let r = Resolver::new(1, |host, _| match host {
+2 -1
View File
@@ -163,7 +163,8 @@ in
a Unix socket (${proxySocket}, 0660, group ianitor-proxy) on which edge (or the Caddy a Unix socket (${proxySocket}, 0660, group ianitor-proxy) on which edge (or the Caddy
fallback) serves the HTTPS hosts in plain HTTP to a front proxy that terminated TLS, fallback) serves the HTTPS hosts in plain HTTP to a front proxy that terminated TLS,
such as Caddy beside Ianitor. Only that group can connect, so its X-Forwarded-For is such as Caddy beside Ianitor. Only that group can connect, so its X-Forwarded-For is
believed; no loopback TCP port is involved''; believed; no loopback TCP port is involved. Edge sends X-Forwarded-Proto: https for every
request on it, so it is for a front proxy that serves HTTPS only'';
users = mkOption { users = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
+63 -1
View File
@@ -165,11 +165,73 @@ Identity gate, tunnel, Domi templates, ACME server, HTTP/3, migrating public sit
| 1 Core and engine | Done | Merged to main 2026-11-07. Tests run in WSL2; ACME checked only against Pebble. The Let's Encrypt staging check moved to phase 3 (Mark, 2026-11-07). | | 1 Core and engine | Done | Merged to main 2026-11-07. Tests run in WSL2; ACME checked only against Pebble. The Let's Encrypt staging check moved to phase 3 (Mark, 2026-11-07). |
| 2 Control plane | Done | Merged to main 2026-11-07 (PR 3): routes repo, journaled apply with trial/watch/revert, undo, restore, share links, API tokens, REST API + OpenAPI, `--dev`. Four QC rounds; every finding fixed or listed in Handover. Real Gitea, systemd credentials and Authelia not exercised. | | 2 Control plane | Done | Merged to main 2026-11-07 (PR 3): routes repo, journaled apply with trial/watch/revert, undo, restore, share links, API tokens, REST API + OpenAPI, `--dev`. Four QC rounds; every finding fixed or listed in Handover. Real Gitea, systemd credentials and Authelia not exercised. |
| 3 Web UI, PKI, NixOS | Built and merged; Done criteria pending Mark | Merged to main 2026-11-08 (PR 5): web UI (murex palette), Domi CA and device mTLS, UI sign-in behind Authelia, runtime engine switch with changes under Caddy, NixOS flake, module and VM tests. Click smoke test green. Not yet done: VM tests run on a KVM host, Mark's nixos-rebuild on the staging mirror, deploy/test-access.sh there, the LE staging check. | | 3 Web UI, PKI, NixOS | Built and merged; Done criteria pending Mark | Merged to main 2026-11-08 (PR 5): web UI (murex palette), Domi CA and device mTLS, UI sign-in behind Authelia, runtime engine switch with changes under Caddy, NixOS flake, module and VM tests. Click smoke test green. Not yet done: VM tests run on a KVM host, Mark's nixos-rebuild on the staging mirror, deploy/test-access.sh there, the LE staging check. |
| 4 Hardening and release | Started: the release kit | A `v*` tag's Gitea release carries the notes and screenshots of the web UI under a signed SHA256SUMS (docs/release.md, 2026-11-09). The rest of phase 4 is not started; known gaps carried here: see Handover. | | 4 Hardening and release | Built and merged; Done criteria pending Mark | Merged to main 2026-11-22 (PR 13): hardening backlog (header deadline, own resolver, pipelining, proxy socket for edge beside Caddy, control UI socket), all five test layers runnable (fuzz, h2spec/testssl, bench vs Caddy committed as data), Artifex `layers` and `verify-nix` pipelines, a release pin that cannot name other code, README, support.md, launch drafts; with the release kit and Fabrica onboarding (source archive, Aula page, Playwright e2e, 2026-11-19). Not yet done: the first Nix pin and the VM tests (need a machine with Nix and KVM), a pipeline run, signed v1.0.0, the GitHub mirror (later), the two-week run beside Caddy. |
## 10. Handover ## 10. Handover
(Rewritten at the end of every session: what changed, what was not verified, which build is deployed, the next step.) (Rewritten at the end of every session: what changed, what was not verified, which build is deployed, the next step.)
**2026-11-22: Phase 4, hardening and release.**
- **Changed:**
- Edge: a 60 s header deadline (slowloris), lookups on its own bounded resolver threads with one lookup per name, pipelining on both listeners, a proxy socket (`/run/ianitor-proxy/edge.sock`, sticky 3770) on which edge trusts Caddy's X-Forwarded-For, and `unix:` upstreams with a strict charset.
- Control: the UI API also on `/run/ianitor-control/ui.sock` (G14 option b); the UI proof is honoured only there. A route may use a socket upstream only as the `[ui]` host on control's own socket; checked at every change and at start.
- Test layers: tests/fuzz (5 cargo-fuzz targets, crashes replayed in cargo test), scripts/conformance.sh (h2spec, testssl.sh, slow-client probes), scripts/bench.sh with results in bench/; `ianitor-pair` runs both engines side by side.
- Fabrica: `layers.yaml` (all five layers, NixOS runner with KVM), `verify-nix.yaml`, and a release `pin` step: `nix-pin.sh` records the commit, its source tree and nixpkgs; the release refuses a pin whose source differs from the tag's, and verifiers build the tagged commit (docs/verify.md).
- README, docs/support.md (Adopt a red panda; RPN route pending Mark, §8.7), docs/launch/ drafts, the GitHub mirror steps for later (docs/release.md). CLAUDE.md: WSL is Ubuntu now, and the disk rule (never C: or D:).
- Results (WSL2 Ubuntu, release build): h2spec Ianitor 144/145, 0 failed (Caddy 2.11.7: 4 failed); testssl.sh A+ both; HTTP/2 slow header block closed by edge after 2.5 s, still open on Caddy at 75 s; fuzz 5x60 s, no crash. Load (one noisy run): Caddy ahead on HTTP/1.1 under load (about 2x with all cores), new TLS connections and the redirect; Ianitor ahead on HTTP/2 at 1 and 64 connections and on memory.
- Tests: core 108, edge 71, control 78, diff 4, fuzz 4, testkit 2 (267); release-pin node test 7; vitest 21; svelte-check clean; hook self-test 55. Two QC rounds; every finding fixed.
- **Deployed:** nothing. The server is unchanged.
- **Not verified:**
- The first Nix pin (`scripts/nix-pin.sh`, needs Nix; the Nix installer was refused in WSL). Until it exists, the release refuses every tag.
- The VM tests, now five with `vm-sockets` (no KVM); the module changes (`edge.proxySocket`, `ui.socket`, sticky directory, `proxySocket.services`) were never evaluated.
- Caddy from nixpkgs (the suites ran against a `go install` build of v2.11.7); NixOS's Caddy restarting when its groups change.
- The Artifex pipelines (never run; the NixOS runner's host needs nested KVM).
- The domi-release key id in docs/verify.md, against Custos.
- **Known gaps:** a kept tree that a changed `[ui]` config breaks is reported only in the log at start; X-Forwarded-Proto on the proxy socket is always https (HTTPS fronts only); the old `apply_sequence` flake did not recur in 18 runs, cause unknown.
- **Needs Mark:** confirm §8.7 (RPN route; e-mail RPN about a receipt for a non-US donor before the first remittance); install Nix in WSL or run `scripts/nix-pin.sh` on a machine with Nix; a KVM machine for `nix flake check`; the Phase 3 staging deploy; approve the proposed app icon and decide on the PWA (design canvas "Ianitor Domi - All screens"); delete F:\fab-ro (a clean Fabrica clone left by the build).
- **Next step:** Mark's staging deploy and the first Nix pin; then the `layers` pipeline, then tag v1.0.0.
**2026-11-19: Ianitor onboarded to Fabrica (docs/fabrica.md; Fabrica docs/36_app_onboarding.md).**
- **Changed:**
- `.fabrica/app.yaml` has `aula: true` and `tagPrefix: v`, with one server part.
- The release pipeline publishes the source archive (`scripts/pack-source.mjs`, the Aula download), the notes,
five `file:` shots and `aula-page.json`.
- `.fabrica/aula.yaml`, `.fabrica/aula/brief.md`, `AULA.md`, `.fabrica/notes/0.2.0.md`.
- `.fabrica/tests.yaml` (target `web`) and `.fabrica/artifex/e2e.yaml` (`windows-e2e`).
- A Playwright suite in apps/web (`e2e/`, `playwright.config.ts`): the six §4 flows with their clicks counted, each
recorded as a video, and the five Aula shots. It runs on the built UI and the demo control plane, at a fixed
instant, with every page checked for real-looking names.
- `apps/web/scripts/shots.mjs` is removed.
- The demo keeps the hosts it is given and names device requests by what was asked.
- Version 0.2.0.
- Pensum: `#jd3x1h` (the videos on Aula, when Fabrica's `videos:` lands) and `#j4yav1` (the visual gate against
v0.2.0).
- **Decided:**
- Canalis does not apply (docs/fabrica.md part 4).
- There is no android target: no Android build.
- The visual gate waits one release, because v0.1.0's shots were taken at a moving clock.
- **Verified on this PC (Windows, Edge):**
- Playwright: web 6/6 and aula 5/5, under heavy load (the slowest flow took 72 s).
- vitest 21 (smoke 15, demo 6); svelte-check: 0 errors.
- `fabrica artifex check`: 0 problems (3 pipelines, app.yaml, aula.yaml, tests.yaml, brief). `fabrica pensum check`:
0 problems. `fabrica preflight ianitor`: 0 blockers.
- `fabrica aula shots` (5 × 1440×900), `fabrica notes`, `fabrica aula page`. Each PNG was looked at.
- No Rust file changed.
- **Not verified:**
- The `e2e` pipeline on the `windows-e2e` runner.
- The Linux suites and the Nix build (as in the 2026-11-17 entry).
- **Merged:** PR #11 as 7aa8b0e. Tag `v0.2.0` points at it.
- **Release:** hub run `rydgfrtcygvhb` (runner record `20261119-020531-s018`) at `v0.2.0`.
- Every step up to `page` passed on the Windows runner: e2e 6/6, pictures 5/5, source 551,770 bytes, notes,
shots, page.
- It is parked at the approval. It waits for Mark's Custos card (code 774 398), then the `domi-release`
signature of `SHA256SUMS`.
- Nothing is published until then.
- **Deployed:** nothing. The deploy is separate: Apps → Ianitor → Deploy.
- **Next step:**
- Mark answers the card and signs.
- Check the Gitea release `v0.2.0`: the files listed in docs/release.md, Handover step 5.
- Configuration_Server adds the Aula entry (docs/fabrica.md, Handover).
**2026-11-17: The Domi CA moved to the shared crate domi-pki (Fabrica docs/32_coherence.md, T3a).** **2026-11-17: The Domi CA moved to the shared crate domi-pki (Fabrica docs/32_coherence.md, T3a).**
- **Changed:** `crates/core/src/pki.rs` is now Ianitor's view of [domi-pki](https://gitea.marek-novak.cz/mnovak/domi-pki) - **Changed:** `crates/core/src/pki.rs` is now Ianitor's view of [domi-pki](https://gitea.marek-novak.cz/mnovak/domi-pki)
v1.0.0 (git tag in Cargo.toml): the same public API, the same error messages and the same encrypted-key format v1.0.0 (git tag in Cargo.toml): the same public API, the same error messages and the same encrypted-key format
+231
View File
@@ -0,0 +1,231 @@
# Ianitor in Fabrica: release, Aula page, updates, showcase, tests
Mark, 2026-11-19: every Domi app is released and updated through Fabrica. Each app gets its own Aula Domi page,
updates in its own way, gets Canalis, gets showcase screenshots and videos from its e2e tests with demo data, and is
tested on Fabrica's Playwright runner.
This page says what each of those means for Ianitor. The checklist is Fabrica `docs/36_app_onboarding.md`. The
formats are in Fabrica core `docs/FORMATS.md`, and Calenda's `.fabrica/` is the reference app.
docs/release.md describes the release pipeline step by step.
## Why
Ianitor is a server app. What runs is built by Nix on the server and switched in by the `deploy` pipeline. Its only
screens are the web UI, served by control on loopback behind edge and Authelia.
Three of the six items fit an app like that. Three do not:
- Ianitor has no installer and no updater.
- It has no Canalis, because Canalis is for apps on one device.
- It has no phone build.
Each item below says which case it is and why.
## The six items
| # | Item | Ianitor | Where |
| :-- | :-- | :-- | :-- |
| 1 | Fabrica app | `app.yaml` with `aula: true`. One `server` part (pipeline `deploy`, flake input `ianitor`). A `release` pipeline started by a `v*` tag. | `.fabrica/app.yaml`, `.fabrica/artifex/{release,deploy}.yaml` |
| 2 | Aula page | `AULA.md`, the brief, the shots, the release's highlights. The release publishes the source archive (the page's download), `aula-*.png`, `aula.json`, `aula-page.json` and the notes under a `SHA256SUMS` signed by `domi-release`. | `AULA.md`, `.fabrica/aula/brief.md`, `.fabrica/aula.yaml`, `.fabrica/notes/<version>.md` |
| 3 | Auto-update | `fabrica-deploy@ianitor` on the server (part 3). | `.fabrica/artifex/deploy.yaml` |
| 4 | Canalis | Not applicable (part 4). | this page |
| 5 | Showcase | A Playwright suite on the built UI and the demo control plane, at a fixed instant. It takes the Aula screenshots and records a video of each main flow. The videos wait for Fabrica's `videos:` (part 5). | `apps/web/e2e/`, `apps/web/playwright.config.ts` |
| 6 | Test targets | `tests.yaml` with the `web` target, and the `e2e` pipeline on Fabrica's `windows-e2e` runner. No `android` target, because Ianitor has no Android build. | `.fabrica/tests.yaml`, `.fabrica/artifex/e2e.yaml` |
## 1. The Fabrica app
`.fabrica/app.yaml` has:
- `name`, `icon` and `color` (the murex accent);
- `aula: true` and `tagPrefix: v`;
- one part, `server: {pipeline: deploy, input: ianitor}`.
**No `desktop` part.** A desktop part's Deploy bumps the version, tags and pushes, and that tag starts an installer
release. Ianitor has no installer. Fabrica allows `aula: true` on an app with a server part only (FORMATS, *Fabrica:
the app*).
**The release comes from a tag.** The version is changed by hand (`[repo] Release: X.Y.Z`, checked by
`scripts/check-version.mjs`). Then the `vX.Y.Z` tag is pushed and the hub is asked for a run of `release` at that
tag (`POST /api/runs`, `ref: vX.Y.Z`). No Gitea webhook reaches the hub yet.
`fabrica artifex check` checks every file of this page except `AULA.md`. `fabrica preflight ianitor` checks the
server part's pipeline: the hub and the NixOS runner. The release pipeline runs on the Windows runner, which runs
its own preflight before each run (Fabrica `docs/23_preflight.md`).
## 2. The Aula page
- **`AULA.md`**: the project's text, as Calenda's: what Ianitor is, for whom, what it does, how it is installed (the
NixOS module, not a download), and what the release's files are.
- **`.fabrica/aula/brief.md`**: the card's line, a short about, and one caption per shot. `fabrica aula page` turns it
into `aula-page.json`.
- **`.fabrica/aula.yaml`**: five `file:` shots, the PNGs the e2e suite took (part 5). `fabrica aula shots` checks each
one (a PNG, at most 2560 × 1600 and 3 MB) and writes `target/aula/aula-<name>.png` and `aula.json`. It starts no
browser for them.
- **`.fabrica/notes/<version>.md`**: the highlights a person writes. `fabrica notes` adds the merges since the
previous tag.
**What Aula shows.** Aula's server config lists each project with:
- its download globs;
- whether it must be signed.
That config is `modules/aula.nix` on the server, owned by the Configuration_Server session. Aula publishes a release
only when a file matches the download globs. So Ianitor's download is the source archive of the tag
(`ianitor-<version>-src.tar.gz`, `scripts/pack-source.mjs`). Ianitor's entry is in the Handover below.
v0.1.0 is already a signed release with the shots and the notes. It has no `aula-page.json`, because `aula: true`
came later. Aula keeps a file only when it is in the verified `SHA256SUMS`.
## 3. Updates: `fabrica-deploy`
Ianitor updates the way a server part does (Fabrica docs/36 part 3, "a server only: `deploy.yaml`"):
1. Fabrica's Apps → Ianitor → Deploy, or `fabrica deploy ianitor`, starts the `deploy` pipeline on the NixOS runner.
2. Mark approves it on his Custos card.
3. `fabrica-deploy@ianitor` fast-forwards the server's clone, updates the flake input `ianitor`, switches the system,
and asks the health check.
4. If the health check does not answer, it rolls the switch back.
That is the right way for Ianitor because:
- The code that runs is whatever the server's flake builds. A downloaded binary would be a second, unsigned path
around the Nix build.
- The web UI is part of the same Nix package (`.#ianitor-web`), served by control. A deploy replaces it with the
binaries, so there is nothing for a browser-side updater to do.
- A service worker would cache an admin UI that sits behind Authelia and must never be served stale. The UI has
none, on purpose.
A release does not deploy, and a deploy does not need a release. The deploy takes the server's chosen commit; the
release is the signed record of a version, with its pictures and notes. After a deploy, `deploy/test-access.sh` is
run from a LAN machine (CLAUDE.md).
## 4. Canalis: not applicable
Canalis is Fundamentum's layer for app-to-app calls **on one device** (Fundamentum `docs/CANALIS.md`):
- A caller and a target are both local processes. They are authenticated by Tessera subkeys and signed manifests,
and connected over a Noise channel.
- Part A registers `domi-<app-id>://open` with the operating system, under the user's own classes.
- Part B serves capabilities behind the app's own consent prompt, in the app's window.
- The template is for a Tauri 2 + Rust desktop app (a .NET one for Tabula).
Ianitor has none of the pieces this needs:
- No process on Mark's PC or phone.
- No window to show a consent prompt in.
- No scheme to register.
- No Tessera identity.
Its UI is a page served by a server, reached through the browser behind Authelia. Its control API listens on the
server's loopback only and never serves public traffic (CLAUDE.md), so no app on a device can reach it.
A capability another app could want ("give this new service a host") would be a call from a device to a server.
That is a remote API with its own authentication (control's API tokens, docs/api.md), not Canalis.
So Ianitor stops before Part A. If a Domi app ever needs to ask Ianitor for something, the answer is a scoped API
token and a documented call, written in its own design doc.
## 5. Showcase: the e2e suite, screenshots and videos
`apps/web/playwright.config.ts`, `apps/web/e2e/`:
**The server.** The suite's global setup (`e2e/serve.ts`):
- builds the UI (Vite, production) into a fresh temporary folder;
- serves it on `127.0.0.1` at a free port, with `/api/v1` answered by the demo control plane (`tests/demo.ts`: hosts
under `.test`, addresses in the documentation ranges, people *ada* and *felix*);
- sends any other path to `index.html`, as production does.
`POST /__demo/reset` starts the demo over. Every test starts from the same invented server.
**The clock.** The instant is `2026-11-16T09:30:00+01:00`, a Monday in `Europe/Prague`, with locale `en-GB`. Two
things read it:
- the demo's answers (`tests/mockApi.ts` `clock`);
- the page's `Date` (`page.clock.setFixedTime`).
So "2 h ago", "today 07:30" and every expiry date read the same in every take. This is what Fabrica's visual
comparison needs (docs/28).
**The checks on every page.** After each test, every text, field and link the page shows is checked with
`realLooking` (tests/demo.ts), which the vitest demo test already uses. A name outside `.test`, an address outside the
documentation ranges, or a forbidden word fails the test.
**The browser.** On Windows it is the installed Edge (`PW_CHANNEL` names another), so nothing is downloaded.
Elsewhere it is Playwright's own Chromium. Video recording needs Playwright's ffmpeg in `PLAYWRIGHT_BROWSERS_PATH`,
which is on F: on Mark's PC and never on C:.
**The projects.**
| Project | Command | What it does | Writes |
| :-- | :-- | :-- | :-- |
| `web` | `pnpm --filter web test:e2e` | The main flows of ROADMAP §4, with the clicks counted as in the smoke test: Add a host (2), Undo (1), Restore (3), Share link (3), Switch engine (2), Device certificate (3). Each is recorded at 1440 × 900. | `target/e2e/videos/<flow>.webm` |
| `aula` | `pnpm --filter web aula:shots` | The five screenshots of `tests/demo.ts` SHOTS at 1440 × 900, scale 1, once nothing is busy and the fonts and two frames are in. | `target/e2e/aula/<name>.png` |
**Videos.** The flows' recordings are WebM, a few seconds each. Fabrica's `videos:` in `aula.yaml` is planned (its
docs/36, docs/37) but not on Fabrica `main`, where the key still fails as unknown. Until it lands:
- the release publishes the screenshots only;
- the videos are artifacts of the e2e run;
- Pensum ticket "Publish the showcase videos on Aula" holds the change. That change is a `videos:` list in
`aula.yaml` naming `target/e2e/videos/*.webm`, and the release's file globs.
**The visual gate waits one release.** Fabrica's `visual` step compares the shots with the last signed release's.
v0.1.0's shots were taken by the old DevTools script at a moving clock, so every shot would differ, and the first
release would stop for an approval of a change that is only the clock. So:
- this release (v0.2.0) publishes the fixed-clock shots;
- the `visual` step comes with the next release, against v0.2.0;
- Pensum ticket "Turn on the visual gate against v0.2.0" holds it.
`apps/web/scripts/shots.mjs` is removed: the suite takes the same five pictures, and `fabrica aula shots` writes
`aula.json`.
## 6. Test targets
- **`.fabrica/tests.yaml`**: `dir: apps/web`, one target `web` (kind `web`, project `web`), which is also the merge
gate. `fabrica tests run --target web` runs it off-screen, and the record, traces and videos go under
`.fabrica/runs/tests/`. The Playwright config passes `FABRICA_TESTS_DEVTOOLS` to the browser for the Tests page's
live view.
- **`.fabrica/artifex/e2e.yaml`**: Fabrica's own e2e pipeline with `fabrica` for `cargo run`. It is manual, on
`windows-e2e`, and runs `pnpm install --frozen-lockfile` then `fabrica tests run --target web`, with
`.fabrica/runs/tests/**` as the artifacts.
- **No `android` target.** Ianitor has no Android build. Its UI on a phone is the same page in the phone's browser,
which a `web` target with a phone viewport would test. That is a gap (below), not a phone queue item.
- **The Rust suites** (core, edge, control, diff) are not Playwright. They run in WSL2 and in the Nix build
(ROADMAP §8.3). Edge, diff and ACME are Linux-only and need caddy and pebble, which the Windows e2e runner does
not have.
## Risks
| Risk | Answer |
| :-- | :-- |
| A picture or video shows Mark's network | The UI talks only to the demo control plane. `realLooking` checks every page every test visits. The PNGs are looked at in the review. |
| The demo server is reachable from the LAN | It listens on `127.0.0.1` only, at a free port, for the length of the run. |
| A secret reaches the browser | The demo serves no token, key or certificate. The demo API token answer is the stand-in's invented `ian_tk1_…`, which no flow shows. |
| Two takes of a screen differ | A fixed instant and zone, the demo reset before each test, fonts and two frames awaited, animations disabled in the screenshot. |
| A video grows too large | Each flow is under 15 s at 1440 × 900. docs/37's limits (8 MiB, 60 s, 6 videos) are checked when `videos:` lands. |
| The release is held by the visual gate on the clock change | The gate comes one release later (part 5). |
## Gaps
- The videos are not on Aula until Fabrica's `videos:` is on `main` (Pensum ticket).
- There is no visual gate in v0.2.0 (Pensum ticket).
- There are no phone-width shots or tests, and no tests in WebKit or Firefox.
- The `e2e` pipeline has not run on the `windows-e2e` runner from this repo. The suite was run here, with Playwright
directly and with `fabrica tests run`.
- There is no Canalis (part 4).
## Handover
**Aula entry** for the server's `modules/aula.nix` (the Configuration_Server session adds it). `files` lists the
downloads only. Aula reads the kit (`aula-*.png`, `aula.json`, `aula-page.json`, `release-notes.md`) by itself and
never offers it as a download.
Aula publishes no release that has no file matching `files` (Aula `src/aula_sync.py`). That is why v0.1.0, with the
default `*-setup.exe`, shows nothing. v0.2.0 is the first release with a download.
```nix
{
name = "Ianitor";
repo = "mnovak/ianitor";
files = [ "ianitor-*-src.tar.gz" ];
signed = true;
}
```
**Releasing 0.2.0** (docs/release.md, "Handover"):
1. `[repo] Release: 0.2.0` on main.
2. Tag `v0.2.0` and push it.
3. Start `release` at `v0.2.0` on the hub.
4. Mark approves on the Custos card, then signs `SHA256SUMS` with `domi-release`.
+1 -1
View File
@@ -38,7 +38,7 @@ how it is run, not for a number.
## Verifiable, and signed ## Verifiable, and signed
Every release is a `SHA256SUMS` signed through Custos with my release key, over the notes, screenshots of the UI, Every release is a `SHA256SUMS` signed through Custos with my release key, over the notes, screenshots of the UI,
and the NAR hashes of the Nix build. Rebuild the pinned commit and compare (docs/verify.md tells you how). and the NAR hashes of the Nix build. Rebuild the tagged commit and compare (docs/verify.md tells you how).
[Before posting: say "reproducible" only once two independent builds have matched; until then, what is checked is [Before posting: say "reproducible" only once two independent builds have matched; until then, what is checked is
one rebuild of the output derivations, with dependencies from the binary cache.] one rebuild of the output derivations, with dependencies from the binary cache.]
+75 -67
View File
@@ -1,79 +1,80 @@
# Releases: notes and screenshots on the Gitea release # Releases: the source, the notes and the Aula page on the Gitea release
Ianitor is server-only: what runs is built by Nix on the server and switched in by the `deploy` pipeline 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 (`.fabrica/artifex/deploy.yaml`, `fabrica-deploy@ianitor`).
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" A release adds what a deploy does not leave behind: a Gitea release for the `vX.Y.Z` tag with these files, all under
and "Fabrica: the Aula page"). Ianitor uses it as it is, with one difference: Fabrica's `fabrica aula shots` a `SHA256SUMS` signed by `domi-release`:
drives a built Windows WebView2 exe, which Ianitor does not have, so a repo script takes the same files from the - the source archive of the tag;
web UI in a headless browser. - the release notes;
- the screenshots of the web UI;
- the Aula landing page.
The release ships no binary, and the deploy stays the deploy. docs/fabrica.md says how the six Fabrica items (Aula,
updates, Canalis, showcase, tests) fit Ianitor.
The release kit is Fabrica's (Fabrica `docs/12_release_kit.md`, `docs/19_web_shots.md`; core `docs/FORMATS.md`,
"Fabrica: release notes" and "Fabrica: the Aula page"). The screenshots are `file:` shots, PNGs taken by the web UI's
own Playwright suite. `fabrica aula shots` checks them and writes `aula.json`.
## The pipeline: `.fabrica/artifex/release.yaml` ## 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 `on: tag "v*"` and `manual: true`, on the Windows runner. That is the Fabrica app on Mark's PC: `fabrica`, node and
are on every step's PATH). pnpm are on every step's PATH.
| Step | Does | Produces | | 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' | | | `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` | | | `install` | `pnpm install --frozen-lockfile` | |
| `check`, `test` | `svelte-check` and the vitest click smoke test of the web UI the shots show | | | `check`, `test` | `svelte-check` and vitest (the click smoke test and the demo data test) | |
| `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` | | `e2e` | `pnpm --filter web test:e2e`: the main flows in Edge on the built UI and the demo control plane, each recorded (docs/fabrica.md part 5) | `target/e2e/videos/*.webm` (not published yet) |
| `shots` | `node apps/web/scripts/shots.mjs` (below) | `target/aula/aula-<name>.png`, `aula.json` | | `pictures` | `pnpm --filter web aula:shots`: the five screens from the same suite | `target/e2e/aula/<name>.png` |
| `pin` | `node scripts/release-pin.mjs <version> <tag> <commit>`: the Nix pin committed before the tag (`.fabrica/nix/pin.json`, by `scripts/nix-pin.sh` on Linux); refuses a missing pin, a pin of another version, and one made from other code than the tag's; publishes the pinned commit | `target/nix/ianitor-nix.json` | | `source` | `node scripts/pack-source.mjs <version>`: `git archive` of the tag | `target/release/ianitor-<version>-src.tar.gz` |
| `notes` | `fabrica notes`: the range since the previous `v*` tag | `target/notes/release-notes.md`, `release-notes.json` |
| `shots` | `fabrica aula shots`: checks the five PNGs (`.fabrica/aula.yaml`) and copies them | `target/aula/aula-<name>.png`, `aula.json` |
| `page` | `fabrica aula page`: the brief (`.fabrica/aula/brief.md`), the shots and the notes | `target/aula/aula-page.json` |
| `pin` | `node scripts/release-pin.mjs <version> <tag> <commit>`: the Nix pin committed before the tag (`.fabrica/nix/pin.json`, by `scripts/nix-pin.sh` on Linux); refuses a missing pin, a pin of another version, one made from other code than the tag's, and one naming a present commit of other code; publishes the tagged commit as the build reference | `target/nix/ianitor-nix.json` |
| `approve` | the run's Custos approval, before anything is published | | | `approve` | the run's Custos approval, before anything is published | |
| `publish` | the Gitea release of the tag: the notes, the shots, `aula.json` and `ianitor-nix.json`; `sums: domi-release` adds `SHA256SUMS` and `SHA256SUMS.minisig`; `release-notes.md` becomes the release's text | | | `publish` | the Gitea release of the tag with the files above, `ianitor-nix.json` included. `sums: domi-release` adds `SHA256SUMS` and `SHA256SUMS.minisig`. `release-notes.md` becomes the release's text. | |
**The Nix build is pinned, not shipped.** The Windows runner has no Nix and Fabrica's `SHA256SUMS` covers only the **The Nix build is pinned, not shipped.** The Windows runner has no Nix and Fabrica's `SHA256SUMS` covers only the
files of one `publish` step, so the release cannot carry a build made by the NixOS runner. It carries the build's files of one `publish` step, so the release cannot carry a build made by the NixOS runner. It carries the build's
NAR hashes instead (`ianitor-nix.json`, under the signed `SHA256SUMS`): anyone rebuilds the pinned commit and NAR hashes instead (`ianitor-nix.json`, under the signed `SHA256SUMS`): anyone rebuilds the tagged commit and
compares ([verify.md](verify.md)), and the `verify-nix` pipeline does that on every `v*` tag on the NixOS runner. compares ([verify.md](verify.md)), and the `verify-nix` pipeline does that on every `v*` tag on the NixOS runner.
The `pin` step refuses a pin made from other code than the tag's (its source tree must match), which is the gate: The `pin` step refuses a pin made from other code than the tag's (its source tree must match), which is the gate:
Fabrica pipelines cannot depend on one another, so `publish` cannot wait for `verify-nix`. What "reproducible" Fabrica pipelines cannot depend on one another, so `publish` cannot wait for `verify-nix`. What "reproducible"
covers so far: the output derivations are rebuilt once and compared; their dependencies come from the binary covers so far: the output derivations are rebuilt once and compared; their dependencies come from the binary
cache. Nothing of it has run yet (no machine with Nix in phase 4); the first pin needs one. cache. Nothing of it has run yet (no machine with Nix in phase 4); the first pin needs one.
The Rust tests are not in it: the edge, diff and ACME tests are Linux-only (ROADMAP §8.3) and the release builds 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. 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 **The download.** Aula offers a project's release only when it has a file to download, and kit files (the shots,
`aula: true`. Turning Aula on later is two lines: `aula: true` in `app.yaml` and a `page` step (`fabrica aula the notes, the page) never count. Ianitor's download is its source archive. The archive is every tracked file at the
page`, after `notes` and `shots`) whose `aula-page.json` is published; a brief (`.fabrica/aula/brief.md`) is tag, under `ianitor-<version>/`. `git archive` of one tree gives the same bytes every time.
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 **app.yaml** has `aula: true` and one `server` part. There is no desktop part: a desktop part's Deploy bumps the
bumps and pushes, with installers) and `server` (a deploy pipeline). Ianitor has no installer and no version bump to version and pushes a tag for an installer release, and Ianitor has no installer. The release is started by its tag.
make, so it keeps its one `server` part; the release is started by its tag.
## Release notes ## Release notes
`fabrica notes` writes them from the first-parent commit subjects, the Pensum tickets done (Ianitor has none) and `fabrica notes` writes them from:
`.fabrica/notes/<version>.md`, the highlights a person writes. The merges of PR 3 to 5 predate the - the first-parent commit subjects;
`[repo] Merge: <branch> (<title>, PR #n)` form and come out as bare "PR #n" lines; history is not rewritten, so - the Pensum tickets done;
`.fabrica/notes/0.1.0.md` says in a few sentences what 0.1.0 is, and goes first. - `.fabrica/notes/<version>.md`, the highlights a person writes.
## Screenshots: `apps/web/scripts/shots.mjs` The highlights go first.
`node apps/web/scripts/shots.mjs [--out <dir>]` (default `target/aula` at the repo root): ## Screenshots
1. empties the output folder of `aula-*.png` and `aula.json`; `apps/web/e2e/specs/aula.spec.ts`, project `aula` of `apps/web/playwright.config.ts` (docs/fabrica.md part 5). For
2. builds the web UI (Vite, production) into a fresh temporary folder; each shot of `apps/web/tests/demo.ts` SHOTS, it:
3. serves it on `127.0.0.1` (a free port), with `/api/v1` answered by the demo control plane 1. loads the page at 1440 × 900, scale 1, at the suite's fixed instant;
(`apps/web/tests/demo.ts`), and every other path falling back to `index.html` as in production; 2. clicks the shot's selectors;
4. starts headless Microsoft Edge (or Chrome; `IANITOR_SHOTS_BROWSER` names another) with a fresh profile in the 3. waits for its selector, for no `aria-busy` element, for the fonts, two frames and 400 ms;
temporary folder, its DevTools port on loopback only, and a cleared environment (the system variables and the 4. saves `target/e2e/aula/<name>.png`.
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; The suite's global setup builds the UI and serves it on `127.0.0.1` with `/api/v1` answered by the demo control plane.
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 | | Name | Page | Shows |
| :-- | :-- | :-- | | :-- | :-- | :-- |
@@ -88,26 +89,29 @@ test's stand-in (`apps/web/tests/mockApi.ts`: the same host and apply shapes and
replace). Its data is invented: hostnames under `.test`, upstream addresses in the documentation ranges 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 (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 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. hostname or address, and the e2e suite checks every page it visits the same way (`realLooking`), so a real name
cannot slip in through a later fixture.
## Risks ## Risks
| Risk | Answer | | 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. | | A screenshot or video shows Mark's network | The UI talks only to the demo control plane. The demo data test and the e2e suite's `realLooking` check refuse 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. | | The browser reaches out | It loads only `127.0.0.1`, and the UI's own CSP allows no outside requests. Playwright's profile is temporary. |
| A secret reaches the browser | Its environment is cleared to the system variables. The demo serves no token, key or certificate. | | A secret reaches the browser | 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. | | A forged screenshot, note or archive | 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). | | The source archive is not the tag | It is `git archive` of the run's HEAD, the tag's commit in the run's clean worktree. Anyone can repeat it and compare the SHA-256. |
| 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. | | A shot of a half-drawn screen | Each `wait` selector exists only once the screen's data is there. The page has no `aria-busy` element, and the fonts and two frames are awaited. |
## Gaps ## Gaps
- Windows and Edge or Chrome only as tested; the script is plain Node and DevTools, so Linux with Chromium should - Tested on Windows with Edge only. The suite is plain Playwright and should work in Chromium on Linux, but that is
work, untested. untested.
- One size (desktop); no phone layout shot. - One size (desktop). There is no phone layout shot.
- The release does not run the Rust tests (see above); the `layers` pipeline does, on the NixOS runner. - The release does not run the Rust tests (see above); the `layers` pipeline does, on the NixOS runner.
- No `[repo] Release:` bump: the version in `Cargo.toml` and the `package.json`s is changed by hand before tagging. - No `[repo] Release:` step: the version in `Cargo.toml`, `Cargo.lock` and the `package.json`s is changed by hand
before tagging.
- The flows' videos are not published yet (docs/fabrica.md part 5).
## GitHub mirror (later) ## GitHub mirror (later)
@@ -127,13 +131,17 @@ discovery (ROADMAP §1.9). When it is time:
looks; releases stay on Gitea, where the signed `SHA256SUMS` is. looks; releases stay on Gitea, where the signed `SHA256SUMS` is.
5. When the token expires, Gitea's mirror shows the error; renew it in Custos and in the mirror settings. 5. When the token expires, Gitea's mirror shows the error; renew it in Custos and in the mirror settings.
## Handover: releasing 0.1.0 ## Handover: releasing a version
0. Once phase 4 is merged (the `pin` step exists), before every tag: run `scripts/nix-pin.sh` on Linux at the commit to tag and commit `.fabrica/nix/pin.json` 1. On main, set the version in `Cargo.toml`, `Cargo.lock` and both `package.json`s. `node scripts/check-version.mjs
([verify.md](verify.md)); the `pin` step refuses a missing or stale pin. X.Y.Z` must pass. Write `.fabrica/notes/X.Y.Z.md`. Commit.
1. On main: `git tag v0.1.0 && git push origin v0.1.0`. 1a. Pin: run `scripts/nix-pin.sh` on Linux with Nix at that clean commit and commit `.fabrica/nix/pin.json`
2. Start the `release` pipeline at `v0.1.0` from Fabrica (no Gitea webhook to the hub yet: the hub's ([verify.md](verify.md)). The `pin` step refuses a missing pin and one made from other code than the tag's.
`POST /api/runs`, ref `v0.1.0`). Approve on the Custos card, then sign `SHA256SUMS` on Custos (`domi-release`). 2. Tag and push: `git tag vX.Y.Z && git push origin vX.Y.Z`.
3. The Gitea release `v0.1.0` has the notes as its text and `release-notes.md`, `release-notes.json`, five 3. Start the `release` pipeline at `vX.Y.Z` from Fabrica. No Gitea webhook reaches the hub yet, so use the hub's
`aula-*.png`, `aula.json`, `SHA256SUMS` and `SHA256SUMS.minisig`. `POST /api/runs` with ref `vX.Y.Z`.
4. Deploy as before: Fabrica's *Apps* → Ianitor → *Deploy*, then deploy/test-access.sh from a LAN machine. 4. Approve on the Custos card, then sign `SHA256SUMS` on Custos (`domi-release`).
5. Check the Gitea release `vX.Y.Z`. Its text is the notes. Its files are `ianitor-X.Y.Z-src.tar.gz`,
`release-notes.md`, `release-notes.json`, five `aula-*.png`, `aula.json`, `aula-page.json`, `ianitor-nix.json`, `SHA256SUMS` and
`SHA256SUMS.minisig`.
6. Deploy as before: Fabrica's *Apps* → Ianitor → *Deploy*, then run deploy/test-access.sh from a LAN machine.
+9 -6
View File
@@ -3,7 +3,7 @@
Every Ianitor release on Gitea (`vX.Y.Z`) carries `SHA256SUMS` and `SHA256SUMS.minisig`, signed through Custos by Every Ianitor release on Gitea (`vX.Y.Z`) carries `SHA256SUMS` and `SHA256SUMS.minisig`, signed through Custos by
the `domi-release` key, and among the files that `SHA256SUMS` lists, `ianitor-nix.json`: the commit the build was the `domi-release` key, and among the files that `SHA256SUMS` lists, `ianitor-nix.json`: the commit the build was
made from and the NAR hash of every Nix output (`.#ianitor`, the two binaries; `.#ianitor-web`, the built UI). made from and the NAR hash of every Nix output (`.#ianitor`, the two binaries; `.#ianitor-web`, the built UI).
Ianitor ships no binary download: you build that commit yourself (or your server does, through the NixOS module) Ianitor ships no binary download: you build the tagged commit yourself (or your server does, through the NixOS module)
and check that you got exactly the bytes the release vouches for. and check that you got exactly the bytes the release vouches for.
What is checked, and what is not yet: `scripts/nix-pin.sh` builds each output, then rebuilds the output derivation itself once more (`nix build --rebuild`) and refuses to pin it if the two differ; the dependencies come from the binary cache and are not rebuilt. The `verify-nix` pipeline does the same on the NixOS What is checked, and what is not yet: `scripts/nix-pin.sh` builds each output, then rebuilds the output derivation itself once more (`nix build --rebuild`) and refuses to pin it if the two differ; the dependencies come from the binary cache and are not rebuilt. The `verify-nix` pipeline does the same on the NixOS
@@ -32,8 +32,11 @@ sha256sum -c --ignore-missing SHA256SUMS # every downloaded file: OK
## 2. The build ## 2. The build
`ianitor-nix.json` names the commit the hashes were built from (`commit`; the tag's own commit, `taggedCommit`, `ianitor-nix.json` names the commit to build, `taggedCommit` (also in `flake`), the nixpkgs revision of its
differs from it at most by the pin file), the nixpkgs revision of its flake.lock, and the hashes: flake.lock, and the hashes. `commit` is where `nix-pin.sh` ran, for the record: the release checks that the tagged
commit holds the same source (they differ at most by the pin file, which no package's source contains), and that
`commit` does too when it is present (`commitChecked`); a pin naming a commit that no longer exists is published
with `commitChecked: false`, and that is fine, because you build `taggedCommit`:
```json ```json
{ "version": "1.0.0", "commit": "<40 hex>", "taggedCommit": "<40 hex>", "nixpkgs": "<40 hex>", "system": "x86_64-linux", { "version": "1.0.0", "commit": "<40 hex>", "taggedCommit": "<40 hex>", "nixpkgs": "<40 hex>", "system": "x86_64-linux",
@@ -43,7 +46,7 @@ differs from it at most by the pin file), the nixpkgs revision of its flake.lock
Build that commit and compare (Linux with Nix and flakes; nothing from Ianitor's own caches is needed): Build that commit and compare (Linux with Nix and flakes; nothing from Ianitor's own caches is needed):
```sh ```sh
c=$(jq -r .commit ianitor-nix.json) c=$(jq -r .taggedCommit ianitor-nix.json)
for a in ianitor ianitor-web; do for a in ianitor ianitor-web; do
p=$(nix build "git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=$c#$a" --no-link --print-out-paths) p=$(nix build "git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=$c#$a" --no-link --print-out-paths)
got=$(nix path-info --json "$p" | jq -r 'if type == "array" then .[0].narHash else .[].narHash end') got=$(nix path-info --json "$p" | jq -r 'if type == "array" then .[0].narHash else .[].narHash end')
@@ -57,13 +60,13 @@ hash is the content. `nix build --rebuild` builds once more locally and fails if
On a server that uses the NixOS module, the running build is `services.ianitor.package`, normally On a server that uses the NixOS module, the running build is `services.ianitor.package`, normally
`ianitor.packages.x86_64-linux.ianitor` from the flake input pinned in the server's `flake.lock`: if that input's `ianitor.packages.x86_64-linux.ianitor` from the flake input pinned in the server's `flake.lock`: if that input's
`rev` is the release's commit, `nix path-info --json $(readlink -f /run/current-system/sw/bin/ianitor-edge | sed 's#/bin/.*##')` `rev` is the release's `taggedCommit`, `nix path-info --json $(readlink -f /run/current-system/sw/bin/ianitor-edge | sed 's#/bin/.*##')`
gives the same NAR hash. gives the same NAR hash.
## What this does and does not prove ## What this does and does not prove
- **Proves:** the release's notes, screenshots and pin are the ones Mark approved and Custos signed; the code at the - **Proves:** the release's notes, screenshots and pin are the ones Mark approved and Custos signed; the code at the
pinned commit builds to exactly the pinned bytes, on any machine with the same nixpkgs (the flake.lock is part of tagged commit builds to exactly the pinned bytes, on any machine with the same nixpkgs (the flake.lock is part of
the commit). the commit).
- **Does not prove:** that the code is good (that is the five test layers' job, ROADMAP §5), nor anything about the - **Does not prove:** that the code is good (that is the five test layers' job, ROADMAP §5), nor anything about the
Nix binary cache you build with: a substituted dependency is trusted as Nix trusts it. `nix build --rebuild` and Nix binary cache you build with: a substituted dependency is trusted as Nix trusts it. `nix build --rebuild` and
+2
View File
@@ -49,6 +49,8 @@
oha oha
nodejs_22 nodejs_22
pnpm_11 pnpm_11
# the slow-client probes (tests/support/probes)
python3
]; ];
}; };
}); });
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@ianitor/ui", "name": "@ianitor/ui",
"version": "0.1.0", "version": "0.2.0",
"private": true, "private": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"description": "The shared dark Domi theme (murex palette) and its Svelte components.", "description": "The shared dark Domi theme (murex palette) and its Svelte components.",
+80 -25
View File
@@ -14,18 +14,24 @@ importers:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/ui version: link:../../packages/ui
devDependencies: devDependencies:
'@playwright/test':
specifier: 1.56.1
version: 1.56.1
'@sveltejs/vite-plugin-svelte': '@sveltejs/vite-plugin-svelte':
specifier: ^5.0.3 specifier: ^5.0.3
version: 5.1.1(svelte@5.57.3)(vite@6.4.5) version: 5.1.1(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5))
'@testing-library/svelte': '@testing-library/svelte':
specifier: ^5.2.6 specifier: ^5.2.6
version: 5.4.2(svelte@5.57.3)(vite@6.4.5)(vitest@3.2.7(jsdom@26.1.0)) version: 5.4.2(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5))(vitest@3.2.7(@types/node@22.20.5)(jsdom@26.1.0))
'@testing-library/user-event': '@testing-library/user-event':
specifier: ^14.6.1 specifier: ^14.6.1
version: 14.6.8(@testing-library/dom@10.4.2) version: 14.6.8(@testing-library/dom@10.4.2)
'@tsconfig/svelte': '@tsconfig/svelte':
specifier: ^5.0.4 specifier: ^5.0.4
version: 5.0.8 version: 5.0.8
'@types/node':
specifier: ^22.20.5
version: 22.20.5
jsdom: jsdom:
specifier: ^26.0.0 specifier: ^26.0.0
version: 26.1.0 version: 26.1.0
@@ -40,10 +46,10 @@ importers:
version: 5.9.3 version: 5.9.3
vite: vite:
specifier: ^6.1.0 specifier: ^6.1.0
version: 6.4.5 version: 6.4.5(@types/node@22.20.5)
vitest: vitest:
specifier: ^3.0.5 specifier: ^3.0.5
version: 3.2.7(jsdom@26.1.0) version: 3.2.7(@types/node@22.20.5)(jsdom@26.1.0)
packages/ui: packages/ui:
dependencies: dependencies:
@@ -286,6 +292,11 @@ packages:
'@jridgewell/trace-mapping@0.3.31': '@jridgewell/trace-mapping@0.3.31':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
'@playwright/test@1.56.1':
resolution: {integrity: sha512-vSMYtL/zOcFpvJCW71Q/OEGQb7KYBPAdKh35WNSkaZA75JlAO8ED8UN6GUNTm3drWomcbcqRPFqQbLae8yBTdg==}
engines: {node: '>=18'}
hasBin: true
'@rollup/rollup-android-arm-eabi@4.68.0': '@rollup/rollup-android-arm-eabi@4.68.0':
resolution: {integrity: sha512-Ta2n0ntLfzP0LqwwcXOIh2z0mnHjlxMS+h4Y9lo+w33Quyf9KFKEi9QZ2IKqeEBKr0qxNpXc/DQjz5KVIs8AEA==} resolution: {integrity: sha512-Ta2n0ntLfzP0LqwwcXOIh2z0mnHjlxMS+h4Y9lo+w33Quyf9KFKEi9QZ2IKqeEBKr0qxNpXc/DQjz5KVIs8AEA==}
cpu: [arm] cpu: [arm]
@@ -484,6 +495,9 @@ packages:
'@types/estree@1.0.10': '@types/estree@1.0.10':
resolution: {integrity: sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==} resolution: {integrity: sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==}
'@types/node@22.20.5':
resolution: {integrity: sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==}
'@vitest/expect@3.2.7': '@vitest/expect@3.2.7':
resolution: {integrity: sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==} resolution: {integrity: sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==}
@@ -642,6 +656,11 @@ packages:
picomatch: picomatch:
optional: true optional: true
fsevents@2.3.2:
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
fsevents@2.3.3: fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@@ -736,6 +755,16 @@ packages:
resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
engines: {node: '>=12'} engines: {node: '>=12'}
playwright-core@1.56.1:
resolution: {integrity: sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==}
engines: {node: '>=18'}
hasBin: true
playwright@1.56.1:
resolution: {integrity: sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==}
engines: {node: '>=18'}
hasBin: true
postcss@8.5.32: postcss@8.5.32:
resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==} resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==}
engines: {node: ^10 || ^12 || >=14} engines: {node: ^10 || ^12 || >=14}
@@ -847,6 +876,9 @@ packages:
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
undici-types@6.21.0:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
vite-node@3.2.4: vite-node@3.2.4:
resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
@@ -1119,6 +1151,10 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2 '@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.6.0 '@jridgewell/sourcemap-codec': 1.6.0
'@playwright/test@1.56.1':
dependencies:
playwright: 1.56.1
'@rollup/rollup-android-arm-eabi@4.68.0': '@rollup/rollup-android-arm-eabi@4.68.0':
optional: true optional: true
@@ -1203,25 +1239,25 @@ snapshots:
'@sveltejs/load-config@0.2.3': {} '@sveltejs/load-config@0.2.3': {}
'@sveltejs/vite-plugin-svelte-inspector@4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.57.3)(vite@6.4.5))(svelte@5.57.3)(vite@6.4.5)': '@sveltejs/vite-plugin-svelte-inspector@4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5)))(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5))':
dependencies: dependencies:
'@sveltejs/vite-plugin-svelte': 5.1.1(svelte@5.57.3)(vite@6.4.5) '@sveltejs/vite-plugin-svelte': 5.1.1(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5))
debug: 4.4.3 debug: 4.4.3
svelte: 5.57.3 svelte: 5.57.3
vite: 6.4.5 vite: 6.4.5(@types/node@22.20.5)
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
'@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.57.3)(vite@6.4.5)': '@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5))':
dependencies: dependencies:
'@sveltejs/vite-plugin-svelte-inspector': 4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.57.3)(vite@6.4.5))(svelte@5.57.3)(vite@6.4.5) '@sveltejs/vite-plugin-svelte-inspector': 4.0.1(@sveltejs/vite-plugin-svelte@5.1.1(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5)))(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5))
debug: 4.4.3 debug: 4.4.3
deepmerge: 4.3.1 deepmerge: 4.3.1
kleur: 4.1.5 kleur: 4.1.5
magic-string: 0.30.21 magic-string: 0.30.21
svelte: 5.57.3 svelte: 5.57.3
vite: 6.4.5 vite: 6.4.5(@types/node@22.20.5)
vitefu: 1.1.3(vite@6.4.5) vitefu: 1.1.3(vite@6.4.5(@types/node@22.20.5))
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@@ -1240,14 +1276,14 @@ snapshots:
dependencies: dependencies:
svelte: 5.57.3 svelte: 5.57.3
'@testing-library/svelte@5.4.2(svelte@5.57.3)(vite@6.4.5)(vitest@3.2.7(jsdom@26.1.0))': '@testing-library/svelte@5.4.2(svelte@5.57.3)(vite@6.4.5(@types/node@22.20.5))(vitest@3.2.7(@types/node@22.20.5)(jsdom@26.1.0))':
dependencies: dependencies:
'@testing-library/dom': 10.4.2 '@testing-library/dom': 10.4.2
'@testing-library/svelte-core': 1.1.3(svelte@5.57.3) '@testing-library/svelte-core': 1.1.3(svelte@5.57.3)
svelte: 5.57.3 svelte: 5.57.3
optionalDependencies: optionalDependencies:
vite: 6.4.5 vite: 6.4.5(@types/node@22.20.5)
vitest: 3.2.7(jsdom@26.1.0) vitest: 3.2.7(@types/node@22.20.5)(jsdom@26.1.0)
'@testing-library/user-event@14.6.8(@testing-library/dom@10.4.2)': '@testing-library/user-event@14.6.8(@testing-library/dom@10.4.2)':
dependencies: dependencies:
@@ -1266,6 +1302,10 @@ snapshots:
'@types/estree@1.0.10': {} '@types/estree@1.0.10': {}
'@types/node@22.20.5':
dependencies:
undici-types: 6.21.0
'@vitest/expect@3.2.7': '@vitest/expect@3.2.7':
dependencies: dependencies:
'@types/chai': 5.2.3 '@types/chai': 5.2.3
@@ -1274,13 +1314,13 @@ snapshots:
chai: 5.3.3 chai: 5.3.3
tinyrainbow: 2.0.0 tinyrainbow: 2.0.0
'@vitest/mocker@3.2.7(vite@6.4.5)': '@vitest/mocker@3.2.7(vite@6.4.5(@types/node@22.20.5))':
dependencies: dependencies:
'@vitest/spy': 3.2.7 '@vitest/spy': 3.2.7
estree-walker: 3.0.3 estree-walker: 3.0.3
magic-string: 0.30.21 magic-string: 0.30.21
optionalDependencies: optionalDependencies:
vite: 6.4.5 vite: 6.4.5(@types/node@22.20.5)
'@vitest/pretty-format@3.2.7': '@vitest/pretty-format@3.2.7':
dependencies: dependencies:
@@ -1419,6 +1459,9 @@ snapshots:
optionalDependencies: optionalDependencies:
picomatch: 4.0.7 picomatch: 4.0.7
fsevents@2.3.2:
optional: true
fsevents@2.3.3: fsevents@2.3.3:
optional: true optional: true
@@ -1515,6 +1558,14 @@ snapshots:
picomatch@4.0.7: {} picomatch@4.0.7: {}
playwright-core@1.56.1: {}
playwright@1.56.1:
dependencies:
playwright-core: 1.56.1
optionalDependencies:
fsevents: 2.3.2
postcss@8.5.32: postcss@8.5.32:
dependencies: dependencies:
nanoid: 3.3.20 nanoid: 3.3.20
@@ -1655,13 +1706,15 @@ snapshots:
typescript@5.9.3: {} typescript@5.9.3: {}
vite-node@3.2.4: undici-types@6.21.0: {}
vite-node@3.2.4(@types/node@22.20.5):
dependencies: dependencies:
cac: 6.7.14 cac: 6.7.14
debug: 4.4.3 debug: 4.4.3
es-module-lexer: 1.7.0 es-module-lexer: 1.7.0
pathe: 2.0.3 pathe: 2.0.3
vite: 6.4.5 vite: 6.4.5(@types/node@22.20.5)
transitivePeerDependencies: transitivePeerDependencies:
- '@types/node' - '@types/node'
- jiti - jiti
@@ -1676,7 +1729,7 @@ snapshots:
- tsx - tsx
- yaml - yaml
vite@6.4.5: vite@6.4.5(@types/node@22.20.5):
dependencies: dependencies:
esbuild: 0.25.12 esbuild: 0.25.12
fdir: 6.5.0(picomatch@4.0.7) fdir: 6.5.0(picomatch@4.0.7)
@@ -1685,17 +1738,18 @@ snapshots:
rollup: 4.68.0 rollup: 4.68.0
tinyglobby: 0.2.17 tinyglobby: 0.2.17
optionalDependencies: optionalDependencies:
'@types/node': 22.20.5
fsevents: 2.3.3 fsevents: 2.3.3
vitefu@1.1.3(vite@6.4.5): vitefu@1.1.3(vite@6.4.5(@types/node@22.20.5)):
optionalDependencies: optionalDependencies:
vite: 6.4.5 vite: 6.4.5(@types/node@22.20.5)
vitest@3.2.7(jsdom@26.1.0): vitest@3.2.7(@types/node@22.20.5)(jsdom@26.1.0):
dependencies: dependencies:
'@types/chai': 5.2.3 '@types/chai': 5.2.3
'@vitest/expect': 3.2.7 '@vitest/expect': 3.2.7
'@vitest/mocker': 3.2.7(vite@6.4.5) '@vitest/mocker': 3.2.7(vite@6.4.5(@types/node@22.20.5))
'@vitest/pretty-format': 3.2.7 '@vitest/pretty-format': 3.2.7
'@vitest/runner': 3.2.7 '@vitest/runner': 3.2.7
'@vitest/snapshot': 3.2.7 '@vitest/snapshot': 3.2.7
@@ -1713,10 +1767,11 @@ snapshots:
tinyglobby: 0.2.17 tinyglobby: 0.2.17
tinypool: 1.1.1 tinypool: 1.1.1
tinyrainbow: 2.0.0 tinyrainbow: 2.0.0
vite: 6.4.5 vite: 6.4.5(@types/node@22.20.5)
vite-node: 3.2.4 vite-node: 3.2.4(@types/node@22.20.5)
why-is-node-running: 2.3.0 why-is-node-running: 2.3.0
optionalDependencies: optionalDependencies:
'@types/node': 22.20.5
jsdom: 26.1.0 jsdom: 26.1.0
transitivePeerDependencies: transitivePeerDependencies:
- jiti - jiti
+13 -1
View File
@@ -18,7 +18,7 @@ set -euo pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
out="$root/bench/conformance" out="$root/bench/conformance"
mkdir -p "$out" mkdir -p "$out"
for tool in caddy h2spec jq; do for tool in caddy h2spec jq; do # and python3 for the slow-client probes, when present
command -v "$tool" >/dev/null || { echo "missing: $tool" >&2; exit 2; } command -v "$tool" >/dev/null || { echo "missing: $tool" >&2; exit 2; }
done done
testssl=$(command -v testssl.sh || command -v testssl || true) testssl=$(command -v testssl.sh || command -v testssl || true)
@@ -60,6 +60,18 @@ for engine in ianitor caddy; do
grade=$(jq -r '[.[] | select(.id=="overall_grade")][0].finding // "n/a"' "$out/$engine-testssl.json" 2>/dev/null || echo n/a) grade=$(jq -r '[.[] | select(.id=="overall_grade")][0].finding // "n/a"' "$out/$engine-testssl.json" 2>/dev/null || echo n/a)
bad=$(jq -r '[.[] | select(.severity=="HIGH" or .severity=="CRITICAL")] | length' "$out/$engine-testssl.json" 2>/dev/null || echo "?") bad=$(jq -r '[.[] | select(.severity=="HIGH" or .severity=="CRITICAL")] | length' "$out/$engine-testssl.json" 2>/dev/null || echo "?")
printf '%-10s %-8s %s\n' "$engine" testssl "grade $grade, $bad findings HIGH or CRITICAL" printf '%-10s %-8s %s\n' "$engine" testssl "grade $grade, $bad findings HIGH or CRITICAL"
# Slow clients (QC phase 4, tests/support/probes): a TLS handshake that never starts, and an
# HTTP/2 header block that never ends; how long each engine keeps them open (75 s at most).
if command -v python3 >/dev/null; then
probes="$root/tests/support/probes"
python3 "$probes/slow.py" 127.0.0.1 "$p" idle 75 localhost >"$out/$engine-slow-idle.txt" 2>&1 &
a=$!
python3 "$probes/h2slow.py" 127.0.0.1 "$p" 75 localhost >"$out/$engine-slow-h2.txt" 2>&1 &
b=$!
wait $a $b || true
printf '%-10s %-8s %s\n' "$engine" slow "$(cut -d';' -f1 "$out/$engine-slow-idle.txt" | head -1); $(cut -d';' -f1 "$out/$engine-slow-h2.txt" | head -1)"
fi
done done
# A case Caddy passes and Ianitor fails is a regression against the fallback. # A case Caddy passes and Ianitor fails is a regression against the fallback.
+35
View File
@@ -0,0 +1,35 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
// The release's one download (docs/release.md): the source of the commit being released, as
// target/release/ianitor-X.Y.Z-src.tar.gz (every file git tracks, under ianitor-X.Y.Z/)
// Ianitor ships no binary: the server builds it with Nix (docs/fabrica.md part 3). The archive is
// listed in the release's SHA256SUMS, signed by domi-release, so the source a version names can be
// checked. `git archive` of one tree gives the same bytes every time.
// node scripts/pack-source.mjs X.Y.Z
// Exit codes: 0 written, 1 git failed, 2 usage.
import { spawnSync } from "node:child_process";
import { mkdirSync, readdirSync, rmSync, statSync } from "node:fs";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const repo = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const version = process.argv[2];
if (process.argv.length !== 3 || !/^\d+\.\d+\.\d+$/.test(version)) {
console.error("usage: node scripts/pack-source.mjs X.Y.Z");
process.exit(2);
}
const out = join(repo, "target", "release");
mkdirSync(out, { recursive: true });
for (const n of readdirSync(out)) if (/^ianitor-.*-src\.tar\.gz$/.test(n)) rmSync(join(out, n), { force: true });
const file = join(out, `ianitor-${version}-src.tar.gz`);
const git = spawnSync("git", ["archive", "--format=tar.gz", `--prefix=ianitor-${version}/`, "-o", file, "HEAD"], { cwd: repo, stdio: "inherit" });
if (git.error || git.status !== 0) {
console.error(`pack-source: git archive failed${git.error ? `: ${git.error.message}` : ` (exit ${git.status})`}`);
process.exit(1);
}
console.log(`pack-source: ${file} (${statSync(file).size} bytes)`);
+28 -6
View File
@@ -9,8 +9,12 @@
// The pin is a claim about the code it was built from, so it is refused unless the tagged commit // The pin is a claim about the code it was built from, so it is refused unless the tagged commit
// holds exactly that code: its source tree (every tracked file except pin.json itself) must be // holds exactly that code: its source tree (every tracked file except pin.json itself) must be
// the one the pin recorded. That is `git diff --name-only <pinned> <tag>` being empty or only // the one the pin recorded. That is `git diff --name-only <pinned> <tag>` being empty or only
// pin.json, checked without the pinned commit's history (a runner's clone is shallow). The // pin.json, checked without the pinned commit's history (a runner's clone is shallow).
// published file names the commit the hashes were built from, not the tag's. //
// The build reference verifiers use is the tagged commit: it has the pinned source by that check,
// and it surely exists. The commit the pin names is kept for the record only; when its objects
// are here it must hold the recorded source tree too (a forged commit is refused), and when they
// are not (a shallow clone, or a commit rebased away) it is published unchecked.
// //
// node scripts/release-pin.mjs <X.Y.Z> <tag> <commit> write target/nix/ianitor-nix.json // node scripts/release-pin.mjs <X.Y.Z> <tag> <commit> write target/nix/ianitor-nix.json
// node scripts/release-pin.mjs --source-tree <commit> print that commit's source-tree hash // node scripts/release-pin.mjs --source-tree <commit> print that commit's source-tree hash
@@ -86,15 +90,31 @@ if (here !== pin.sourceTree) {
); );
} }
let commitChecked = false;
try {
git("cat-file", "-e", `${pin.commit}^{commit}`);
commitChecked = true;
} catch {
// Not here: informational only.
}
if (commitChecked && sourceTree(pin.commit) !== pin.sourceTree) {
fail(
`${PIN} names ${pin.commit}, which does not hold the source tree it records: ` +
`the pin was edited by hand; run scripts/nix-pin.sh again`,
);
}
const out = { const out = {
name: "Ianitor Domi", name: "Ianitor Domi",
version, version,
tag, tag,
// The commit the hashes were built from; the tag's own commit differs at most by pin.json. // Build this one (docs/verify.md): the tagged commit, whose source the pin is of.
commit: pin.commit,
taggedCommit: commit, taggedCommit: commit,
flake: `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=${commit}`,
// The commit nix-pin.sh ran at, for the record; checked against the source tree when present.
commit: pin.commit,
commitChecked,
sourceTree: pin.sourceTree, sourceTree: pin.sourceTree,
flake: `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=${pin.commit}`,
nixpkgs: pin.nixpkgs ?? null, nixpkgs: pin.nixpkgs ?? null,
system: pin.system, system: pin.system,
outputs: pin.outputs, outputs: pin.outputs,
@@ -102,4 +122,6 @@ const out = {
}; };
mkdirSync(join(repo, "target/nix"), { recursive: true }); mkdirSync(join(repo, "target/nix"), { recursive: true });
writeFileSync(join(repo, "target/nix/ianitor-nix.json"), JSON.stringify(out, null, 2) + "\n"); writeFileSync(join(repo, "target/nix/ianitor-nix.json"), JSON.stringify(out, null, 2) + "\n");
console.log(`target/nix/ianitor-nix.json: ${version}, built from ${pin.commit}, tagged at ${commit}`); console.log(
`target/nix/ianitor-nix.json: ${version} at ${commit} (pinned at ${pin.commit}, ${commitChecked ? "checked" : "not here, unchecked"})`,
);
+45 -3
View File
@@ -94,7 +94,7 @@ test("a pin from an older commit, with code changed since: refused", () => {
} }
}); });
test("a pin from the parent where only pin.json changed: accepted, and the pinned commit is published", () => { test("a pin from the parent where only pin.json changed: accepted; the tagged commit is the build reference", () => {
const r = repo(); const r = repo();
try { try {
r.write("crates/a.rs", "fn a() {}\n"); r.write("crates/a.rs", "fn a() {}\n");
@@ -104,10 +104,52 @@ test("a pin from the parent where only pin.json changed: accepted, and the pinne
const out = run(r, b); const out = run(r, b);
assert.equal(out.status, 0, out.stdout + out.stderr); assert.equal(out.status, 0, out.stdout + out.stderr);
const published = JSON.parse(readFileSync(join(r.dir, "target/nix/ianitor-nix.json"), "utf8")); const published = JSON.parse(readFileSync(join(r.dir, "target/nix/ianitor-nix.json"), "utf8"));
assert.equal(published.commit, a, "the pin names the commit it was built from"); assert.equal(published.commit, a, "the commit the pin was made at, for the record");
assert.equal(published.commitChecked, true, "its objects are here, so its tree was checked");
assert.equal(published.taggedCommit, b); assert.equal(published.taggedCommit, b);
assert.equal(published.tag, "v1.0.0"); assert.equal(published.tag, "v1.0.0");
assert.match(published.flake, new RegExp(`rev=${a}`)); // Verifiers build the tagged commit: the same source by construction, and it surely exists.
assert.equal(published.flake, `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=${b}`);
} finally {
r.done();
}
});
test("a forged commit (present, but another source tree): refused", () => {
const r = repo();
try {
r.write("crates/a.rs", "fn other() {}\n");
const x = r.commit("other code at X");
r.write("crates/a.rs", "fn a() {}\n");
const a = r.commit("code at A");
const pin = JSON.parse(pinFor(r, a));
pin.commit = x; // the tree is A's, the commit named is X
r.write(".fabrica/nix/pin.json", JSON.stringify(pin));
const b = r.commit("pin");
const out = run(r, b);
assert.equal(out.status, 1, out.stdout + out.stderr);
assert.match(out.stderr, /does not hold the source tree/);
} finally {
r.done();
}
});
test("a commit rebased away (absent): accepted, the tagged commit is the build reference", () => {
const r = repo();
try {
r.write("crates/a.rs", "fn a() {}\n");
const a = r.commit("code at A");
const pin = JSON.parse(pinFor(r, a));
pin.commit = "f".repeat(40); // no such object here (rebased away, or a shallow clone)
r.write(".fabrica/nix/pin.json", JSON.stringify(pin));
const b = r.commit("pin");
const out = run(r, b);
assert.equal(out.status, 0, out.stdout + out.stderr);
const published = JSON.parse(readFileSync(join(r.dir, "target/nix/ianitor-nix.json"), "utf8"));
assert.equal(published.taggedCommit, b);
assert.equal(published.commit, "f".repeat(40));
assert.equal(published.commitChecked, false);
assert.equal(published.flake, `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git?rev=${b}`);
} finally { } finally {
r.done(); r.done();
} }
+29 -5
View File
@@ -95,6 +95,34 @@ mod unix {
} }
} }
/// `caddy version`, or, for a `go install`ed Caddy that says "unknown", its module version
/// from the binary's build info (`go version -m`).
fn caddy_version(caddy: &std::path::Path) -> String {
let out = |cmd: &mut std::process::Command| {
cmd.output()
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())
.unwrap_or_default()
};
let v = out(std::process::Command::new(caddy).arg("version"));
if !v.is_empty() && v != "unknown" {
return v;
}
let info = out(std::process::Command::new("go")
.args(["version", "-m"])
.arg(caddy));
info.lines()
.map(|l| l.split_whitespace().collect::<Vec<_>>())
.find(|f| f.len() >= 3 && f[0] == "mod" && f[1] == "github.com/caddyserver/caddy/v2")
.map(|f| {
format!(
"{} (go install; {})",
f[2],
info.lines().next().unwrap_or("").trim()
)
})
.unwrap_or(v)
}
fn addrs(t: &Target) -> serde_json::Value { fn addrs(t: &Target) -> serde_json::Value {
json!({ "http": t.http.to_string(), "https": t.https.to_string() }) json!({ "http": t.http.to_string(), "https": t.https.to_string() })
} }
@@ -158,11 +186,7 @@ mod unix {
&caddy2_cfg, &caddy2_cfg,
&[("GOMAXPROCS", "2")], &[("GOMAXPROCS", "2")],
); );
let caddy_version = std::process::Command::new(&caddy) let caddy_version = caddy_version(&caddy);
.arg("version")
.output()
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())
.unwrap_or_default();
println!( println!(
"{}", "{}",
+2 -1
View File
@@ -105,7 +105,8 @@ fn compile_checked(site: &str, hosts: &[(String, String)]) {
fn creds_dir() -> &'static PathBuf { fn creds_dir() -> &'static PathBuf {
static DIR: OnceLock<PathBuf> = OnceLock::new(); static DIR: OnceLock<PathBuf> = OnceLock::new();
DIR.get_or_init(|| { DIR.get_or_init(|| {
let d = std::env::temp_dir().join(format!("ianitor-fuzz-creds-{}", std::process::id())); // One fixed folder, rewritten by every run: nothing piles up in the temp folder.
let d = std::env::temp_dir().join("ianitor-fuzz-creds");
std::fs::create_dir_all(&d).unwrap(); std::fs::create_dir_all(&d).unwrap();
std::fs::write(d.join("api_key"), b"fuzz-secret-value\n").unwrap(); std::fs::write(d.join("api_key"), b"fuzz-secret-value\n").unwrap();
std::fs::write(d.join("ui-proof"), b"fuzz-proof-value\n").unwrap(); std::fs::write(d.join("ui-proof"), b"fuzz-proof-value\n").unwrap();