From 36ba15f5638123a74c3c20f3b648cc77050d4c5b Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 24 Nov 2026 21:45:56 +0000 Subject: [PATCH 1/8] Show every failed test's Catch2 output in CI failure reports (ADR-0877) Each job's "Catch2 failure report" printed the last 300 lines of testlog.txt without runtime log lines. Meson writes tests in the order they finish, so an early failure such as integration shard 1 was pushed out of that window by the smoke tests that finished after it, and the asan-ubsan run 44948590233 said "1 failed" with no assertion shown. scripts/catch2-failure-report.sh prints the section of each test whose result is neither exit status 0 nor 77 (a skip), without runtime log lines, capped per test and overall. POSIX sh and awk without interval expressions, so the BSD VMs and every container run it unchanged. All twelve report steps in ci.yml, coverage.yml and sanitizers.yml use it, and the tsan job gets the report it lacked. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 65 ++---- .github/workflows/coverage.yml | 5 +- .github/workflows/sanitizers.yml | 10 +- CHANGELOG.md | 2 + ...-each-failed-test-not-a-tail-of-the-log.md | 60 +++++ docs/adr/index.md | 1 + docs/testing-standards.md | 5 +- scripts/AGENTS.md | 1 + scripts/catch2-failure-report.sh | 140 +++++++++++ tests/meson.build | 6 + tests/tooling/test_catch2_failure_report.py | 218 ++++++++++++++++++ 11 files changed, 452 insertions(+), 61 deletions(-) create mode 100644 docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md create mode 100755 scripts/catch2-failure-report.sh create mode 100755 tests/tooling/test_catch2_failure_report.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c33eb4372..0f217b4c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,16 +102,10 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - # The unit test binary emits thousands of structured runtime log - # lines (timestamp + + module:) that bury Catch2's own - # failure report. Drop those so what remains is Catch2 section - # headers, FAILED assertions, and the test-case summary — i.e. the - # failing test name + file:line. Mirrors the NetBSD job's inline - # equivalent below. - if [ -f build/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build/meson-logs/testlog.txt \ - | tail -n 300 - fi + # Prints each failed test's Catch2 output (scenario, file:line, + # FAILED:, expansion) with the runtime log lines that bury it + # removed. Every job's report runs the same script (ADR-0877). + sh scripts/catch2-failure-report.sh build/meson-logs/testlog.txt - name: Conformance gate run: sh scripts/check-conformance-gate.sh build @@ -213,10 +207,7 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - if [ -f build-ubuntu-interim/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build-ubuntu-interim/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build-ubuntu-interim/meson-logs/testlog.txt - name: Conformance gate run: sh scripts/check-conformance-gate.sh build-ubuntu-interim @@ -328,10 +319,7 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - if [ -f build-hardened/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build-hardened/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build-hardened/meson-logs/testlog.txt # -- Fedora / Red Hat family ----------------------------------------------- fedora-suite: @@ -397,10 +385,7 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - if [ -f build-fedora/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build-fedora/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build-fedora/meson-logs/testlog.txt - name: Conformance gate run: sh scripts/check-conformance-gate.sh build-fedora @@ -485,10 +470,7 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - if [ -f build-debian/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build-debian/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build-debian/meson-logs/testlog.txt - name: Conformance gate run: sh scripts/check-conformance-gate.sh build-debian @@ -576,10 +558,7 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - if [ -f build-rhel/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build-rhel/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build-rhel/meson-logs/testlog.txt - name: Conformance gate run: sh scripts/check-conformance-gate.sh build-rhel @@ -697,10 +676,7 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - if [ -f "${BUILDDIR}/meson-logs/testlog.txt" ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' "${BUILDDIR}/meson-logs/testlog.txt" \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh "${BUILDDIR}/meson-logs/testlog.txt" - name: Conformance gate run: sh scripts/check-conformance-gate.sh "${BUILDDIR}" @@ -750,10 +726,7 @@ jobs: pkg install -y meson ninja llvm catch2 pkgconf git perl5 bison flex gmake openssl libsodium postgresql17-client curl png libjpeg-turbo if ! sh scripts/build-bsd.sh --builddir build --skip-job freebsd; then echo "::group::FreeBSD Catch2 failure report (runtime logs filtered out)" - if [ -f build/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build/meson-logs/testlog.txt echo "::endgroup::" # The report above drops runtime log lines to keep Catch2's output # readable, which also hides why a runtime refused to start. List @@ -812,10 +785,7 @@ jobs: run: | if ! sh scripts/build-bsd.sh --builddir build --skip-job openbsd; then echo "::group::OpenBSD Catch2 failure report (runtime logs filtered out)" - if [ -f build/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build/meson-logs/testlog.txt echo "::endgroup::" # The report above drops runtime log lines to keep Catch2's output # readable, which also hides why a runtime refused to start. List @@ -983,16 +953,7 @@ jobs: rm -rf netbsd-packages if ! sh scripts/build-bsd.sh --builddir build --skip-job netbsd; then echo "::group::NetBSD Catch2 failure report (runtime logs filtered out)" - if [ -f build/meson-logs/testlog.txt ]; then - # The unit test binary emits thousands of structured runtime - # log lines (timestamp + + module:) that bury Catch2's - # own failure report. Drop those and the [netbsd-diag] markers - # so what remains is Catch2 section headers, FAILED assertions, - # and the test-case summary — i.e. the failing test name + file:line. - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build/meson-logs/testlog.txt \ - | grep -vE '^\[netbsd-diag\]' \ - | tail -n 150 - fi + sh scripts/catch2-failure-report.sh --exclude '^\[netbsd-diag\]' build/meson-logs/testlog.txt echo "::endgroup::" echo "::group::NetBSD core backtraces" for core in $(find build -name '*.core' 2>/dev/null); do diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 62e67a512..02d18d84f 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -210,10 +210,7 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - if [ -f build-coverage/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build-coverage/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build-coverage/meson-logs/testlog.txt - name: Generate coverage reports id: reports diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.yml index 769c6e5a1..7d6331071 100644 --- a/.github/workflows/sanitizers.yml +++ b/.github/workflows/sanitizers.yml @@ -71,10 +71,7 @@ jobs: - name: Catch2 failure report (runtime logs filtered out) if: failure() run: | - if [ -f build/meson-logs/testlog.txt ]; then - grep -vE '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+ \+[0-9]{4} <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>' build/meson-logs/testlog.txt \ - | tail -n 300 - fi + sh scripts/catch2-failure-report.sh build/meson-logs/testlog.txt tsan: runs-on: ubuntu-latest @@ -134,6 +131,11 @@ jobs: shell: bash run: sh scripts/build-linux.sh --builddir build-tsan --buildtype debug --sanitize thread --skip-job tsan 2>&1 | tee tsan-ci-log.txt + - name: Catch2 failure report (runtime logs filtered out) + if: failure() + run: | + sh scripts/catch2-failure-report.sh build-tsan/meson-logs/testlog.txt + - name: Upload TSan logs if: always() uses: actions/upload-artifact@v7 diff --git a/CHANGELOG.md b/CHANGELOG.md index 411d439ac..d11483a1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -197,6 +197,8 @@ Changes before 1.0.0 are in [CHANGELOG-pre-release.md](CHANGELOG-pre-release.md) gone), and a tooling test fails when that list and the modules the sources name differ (ADR-0872). * The TURN log calls mark GCC's cleanup of their braced field lists excluded from coverage, a compiler path no test can reach; the testing standards say when such a marker is allowed (ADR-0874). +* A CI failure report shows every failed test's Catch2 output, however early it ran; a tail of the log lost it behind + later tests. The `tsan` job gets a report too (ADR-0877). ## Release notes diff --git a/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md b/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md new file mode 100644 index 000000000..8479913bf --- /dev/null +++ b/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md @@ -0,0 +1,60 @@ +# CI failure reports print each failed test's section of the Meson log, not a tail of the whole log + +* Status: accepted +* Date: 2026-11-24 + +Technical Story: an `asan-ubsan` run on the presence-flood pull request (run 44948590233, job 136981278297) said +"1 failed" and showed no failed assertion anywhere. + +## Context and Problem Statement + +When `meson test` fails, each CI job's "Catch2 failure report" step printed `testlog.txt` without the homeserver's +runtime log lines, then the last 300 lines of that (150 on NetBSD). Meson writes tests in the order they finish, so an +early failure, such as `integration-tests-shard-1-of-4`, is followed by every smoke test that finished after it, and +those pushed its Catch2 output out of the window. `--print-errorlogs` shows only the last 100 lines of a failed test, +which were runtime logging. How should a failure report find the failed assertion? + +## Decision Drivers + +* The report must show every failed Catch2 case (scenario, file and line, `FAILED:`, expansion, exception message), + however early the test ran and however much passed after it. +* It must run unchanged on the Ubuntu, Debian, Fedora and AlmaLinux jobs and inside the FreeBSD, OpenBSD and NetBSD + VMs, none of which is sure to have a `python3` on `PATH`. +* A broken run must not print an unbounded log. + +## Considered Options + +1. `scripts/catch2-failure-report.sh`: one POSIX `awk` pass over `testlog.txt` that keeps the section of each test + whose `result:` is neither `exit status 0` nor `exit status 77` (Meson's skip), drops runtime log lines, and caps + each test (first 400 and last 100 lines) and the whole report (4000 lines). +2. Raise the tail (say to 3000 lines). +3. Read `testlog.json` in Python, whose records carry a `result` of `FAIL`, `TIMEOUT` and so on. +4. Fix the order instead (run the integration shards last), or rely on `--print-errorlogs`. + +## Decision Outcome + +Chosen option: 1, run by every report step: `ci.yml`'s Linux and BSD jobs, `coverage.yml`, and both jobs of +`sanitizers.yml` (`tsan` had no report step). NetBSD passes `--exclude '^\[netbsd-diag\]'`. + +* A tail of any length can lose a failure: the number of lines after it depends on what finished later, which changes + with the platform, the sanitizer and the scheduling. +* `testlog.json` would be read more simply in Python, but the BSD VMs install only a versioned Python as Meson's + dependency (see `check_expected_skips.py` in `scripts/AGENTS.md`), and a second implementation for them would drift. + The text log's format is stable: each test opens with a `==== N/M ====` banner and closes with a 78-character rule, + and `result:` holds Meson's `returncode_to_status` text. +* The order of tests is not the report's to fix, and `--print-errorlogs` cannot be told to skip runtime log lines. +* The script uses no `awk` interval expressions (`{4}`), which older releases of `mawk` and the BSDs' `awk` did not + accept, and + reads its patterns from the environment, since `awk -v` would process their backslashes. + +### Negative Consequences + +* A failed test with more than 500 lines of its own output shows its first 400 and last 100; the gap is counted and + the full log stays in `testlog.txt` (uploaded by `tsan`). +* A change to Meson's text log format would make the report find no failed test. It then says so, rather than + printing nothing, and `tests/tooling/test_catch2_failure_report.py` pins the format it reads. + +## Links + +* Covered by `tests/tooling/test_catch2_failure_report.py`, which also checks that every workflow's report runs the + script and tails nothing. diff --git a/docs/adr/index.md b/docs/adr/index.md index 836b538ec..a9a064c94 100644 --- a/docs/adr/index.md +++ b/docs/adr/index.md @@ -750,3 +750,4 @@ * [0874 - A braced log-field list may mark GCC's cleanup branches excluded from coverage](0874-a-braced-log-field-list-may-mark-gcc-s-cleanup-branches-excluded-from-coverage.md) * [0875 - A device syncing online holds its account online against another device syncing unavailable](0875-a-device-syncing-online-holds-its-account-online.md) * [0876 - The first presence change in a five-second window is kept, and every other one in it is dropped](0876-the-first-presence-change-in-a-five-second-window-is-kept.md) +* [0877 - CI failure reports print each failed test's section of the Meson log, not a tail of the whole log](0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md) diff --git a/docs/testing-standards.md b/docs/testing-standards.md index 86ab6c4f6..5e9ec59fa 100644 --- a/docs/testing-standards.md +++ b/docs/testing-standards.md @@ -408,7 +408,10 @@ Never list `MEROVINGIAN_TEST_FEDERATION_WORKER is not defined`: on CI that skip the `asan-ubsan` job (`-Db_sanitize=address,undefined`) catches memory and undefined-behaviour defects, and the `tsan` job (`-Db_sanitize=thread`) catches data races. ThreadSanitizer is the only sanitizer that detects data - races; ASan and UBSan are blind to them. + races; ASan and UBSan are blind to them. When the suite fails, each job's + "Catch2 failure report" step prints every failed test's Catch2 output from + `testlog.txt` (`scripts/catch2-failure-report.sh`, ADR-0877); read it there, + not in the tail of the build step. - Any type shared across threads at runtime must have a test that exercises `perform`/`run`/dispatch concurrently from multiple threads so TSan can check the exercised accesses for data races. A thread-safety claim in a header comment is diff --git a/scripts/AGENTS.md b/scripts/AGENTS.md index fba898011..b271e54a0 100644 --- a/scripts/AGENTS.md +++ b/scripts/AGENTS.md @@ -23,6 +23,7 @@ called by it rather than directly. | `ci-openbsd-pkg-add.sh` | CI only: `ci-openbsd-pkg-add.sh --require "command ..." [--require-pkg-config "module ..."] package ...` installs packages in the vmactions OpenBSD VMs, three tries through `cdn.openbsd.org` then three through `ftp.openbsd.org` (`PKG_PATH` for the VM's release and architecture). Judges each try by whether every `--require` command is on `PATH` and every `--require-pkg-config` module passes `pkg-config --exists`, because `pkg_add` exits 0 having installed nothing; fails naming what is missing (ADR-0650). Both OpenBSD jobs run it from `prepare`, which vmactions runs in the synced checkout. Covered by `tests/tooling/test_ci_workflow.py` against a fake `pkg_add` | | `check-catch2-bdd-tests.sh` | Rejects unit test files that use `TEST_CASE`, use comment-only Given/When/Then markers, or lack any of `SCENARIO`/`GIVEN`/`WHEN`/`THEN` (`test_main.cpp` exempt). One `awk` pass over all files: run per file it timed out on the OpenBSD VM. Covered by `tests/tooling/test_check_catch2_bdd.py` | | `check_expected_skips.py` | CI skip gate (ADR-0546): reads the XML reports the Catch2 binaries write when `MEROVINGIAN_CATCH_REPORT_DIR` is set and fails on any skipped test case that `tests/expected_skips.json` does not list for the `--job`. Exit 0 ok, 1 unexpected skip (or a stale entry with `--strict-stale`), 2 unusable input (no report, truncated report, bad list, unknown job). `` is a key of the `jobs` object in `tests/expected_skips.json`. `build-linux.sh` and `build-bsd.sh` run it after the suite when given `--skip-job `; `build-wsl.sh` has no `--skip-job`, and `build.py vm` passes none, so WSL and VM runs are not skip-gated; `build-bsd.sh` runs it with `python3`, else the interpreter in `meson`'s shebang, else a `python3.N` on `PATH` (FreeBSD and NetBSD install only a versioned Python, as meson's dependency), and fails the gate when it finds none. Covered by `tests/tooling/test_expected_skips.py` | +| `catch2-failure-report.sh` | CI only: `catch2-failure-report.sh [--exclude ERE] TESTLOG` prints, from a Meson `testlog.txt`, the section of each test whose `result:` is neither `exit status 0` nor `exit status 77` (a skip), without the runtime log lines, so each failed Catch2 case shows whatever ran after it; a tail of the whole log lost an early failure (ADR-0877). Each test prints at most its first 400 and last 100 lines, and the report stops adding tests at 4000 lines (`CATCH2_REPORT_HEAD_LINES`, `_TAIL_LINES`, `_TOTAL_LINES`). Says so and exits 0 when there is no log or no failed test; exit 2 for bad arguments. POSIX `sh` and `awk` without interval expressions, so it runs in every Linux container and BSD VM. Every workflow's "Catch2 failure report" runs it; covered by `tests/tooling/test_catch2_failure_report.py`, which also checks that every workflow's report runs it and tails nothing | | `check-conformance-gate.sh` | Runs `meson test conformance-tests --print-errorlogs` in the build directory given as its argument (default `build`) and fails if that suite fails or the directory is missing. It does not detect a removed or commented-out test; CI runs it after each build | | `check-elf-hardening.sh` | Build-time hardening gate: inspects a built ELF binary's headers with `readelf` and fails if PIE (`ET_DYN`), `PT_GNU_RELRO`, `DT_BIND_NOW`, or a non-executable stack (`PT_GNU_STACK` without `E`) is missing; the CI-time counterpart to the runtime self-check in `src/platform/`, since that check can only run inside a live, correctly-privileged `merovingian-server` process. Pass `--static` for the static-PIE binary, which has no `PT_DYNAMIC` section to apply `BIND_NOW` to. Accepts both GNU binutils' and the BSDs' elftoolchain `readelf` output, and uses POSIX ERE only (ADR-0757). Covered by `tests/tooling/test_check_elf_hardening.py` against a fake `readelf` | | `check-startup-hardening-gate.sh` | Runtime counterpart to `check-elf-hardening.sh` for shipped artifacts (audit OPS-5): boots a packaged `merovingian-server` against a throwaway loopback SQLite config with a fresh 0400 master key, and passes only when every `Hardening self-check:` line is `enabled`, their count matches `Startup hardening checks: N`, readiness is `ready=true blockers=0`, the federation worker is spawned and still up `--worker-settle` seconds (3) later, and the server exits 0 on `SIGTERM`. Run it as the unprivileged service user with an empty capability bounding set. Leaves the worker path to the binary's libexec default unless `--federation-worker` is given. Off Linux it sets `federation.worker.apply_hardening=false`, because the worker's in-process sandbox exists only on Linux. Run by the `deb`, `debian-pkg`, `rpm`, `freebsd-pkg` and `docker-image` jobs in `packages.yml`; covered by `tests/tooling/test_startup_hardening_gate.py` | diff --git a/scripts/catch2-failure-report.sh b/scripts/catch2-failure-report.sh new file mode 100755 index 000000000..402500c18 --- /dev/null +++ b/scripts/catch2-failure-report.sh @@ -0,0 +1,140 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-3.0-or-later +# +# catch2-failure-report.sh [--exclude ERE] TESTLOG +# +# Prints, from a Meson testlog.txt, the output of every test that did not pass, +# with the homeserver's runtime log lines removed, so what remains is each +# failed Catch2 case: its scenario header, file and line, FAILED:, the +# expansion and any exception message, then the run's totals. CI runs it when a +# build-and-test step fails (ADR-0877). +# +# A tail of the whole log is not enough: Meson writes tests in the order they +# finish, so the smoke tests that run after an early integration shard push its +# failure out of any fixed number of trailing lines. +# +# Meson starts each test with a "==== N/M ====" banner and ends it with a line +# of exactly 78 "=" (78 "-" in older Meson; Catch2's own rules are 79 wide, so +# neither is mistaken for the other). A test failed unless its +# "result:" is "exit status 0", or "exit status 77", which Meson reads as a +# skip. Each failed test prints at most HEAD_LINES of its filtered output and +# its last TAIL_LINES; the report stops adding tests after TOTAL_LINES lines. +# --exclude drops more lines (an extended regular expression), as the NetBSD +# job does for its [netbsd-diag] markers. POSIX sh and awk only, with no +# interval expressions, so it runs as is on the BSD VMs and in every container. + +set -eu + +exclude='' +while [ $# -gt 0 ]; do + case "$1" in + --exclude) + [ $# -ge 2 ] || { echo "catch2-failure-report.sh: --exclude needs a pattern" >&2; exit 2; } + exclude=$2 + shift 2 + ;; + --) + shift + break + ;; + -*) + echo "catch2-failure-report.sh: unknown option $1" >&2 + exit 2 + ;; + *) + break + ;; + esac +done +if [ $# -ne 1 ]; then + echo "usage: catch2-failure-report.sh [--exclude ERE] TESTLOG" >&2 + exit 2 +fi +testlog=$1 + +if [ ! -f "$testlog" ]; then + printf 'No test log at %s: the build failed before any test ran.\n' "$testlog" + exit 0 +fi + +REPORT_TESTLOG=$testlog \ +EXCLUDE_ERE=$exclude \ +HEAD_LINES=${CATCH2_REPORT_HEAD_LINES:-400} \ +TAIL_LINES=${CATCH2_REPORT_TAIL_LINES:-100} \ +TOTAL_LINES=${CATCH2_REPORT_TOTAL_LINES:-4000} \ + awk ' +function is_rule(line, ch) { + if (length(line) != 78) return 0 + return (ch == "=" && line ~ /^=+$/) || (ch == "-" && line ~ /^-+$/) +} +function is_runtime_log(line) { + # 2026-11-24 10:00:00.123456 +0000 module: message + return line ~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9]+ \+[0-9][0-9][0-9][0-9] <(INFO|WARNING|ERROR|DEBUG|CRITICAL)>/ +} +function out(line) { + print line + printed++ +} +function finish_test( i, first_tail) { + if (!inside) return + inside = 0 + if (result == "exit status 0" || result == "exit status 77") return + failed++ + if (printed >= total_cap) { + unshown++ + return + } + out("") + out("########## FAILED " name " (" result ", " duration ")") + if (command != "") out("command: " command) + if (n <= head_cap + tail_cap) { + for (i = 1; i <= n; i++) out(buf[i]) + } else { + for (i = 1; i <= head_cap; i++) out(buf[i]) + first_tail = n - tail_cap + 1 + out("[... " (first_tail - head_cap - 1) " lines omitted; the full output is in " testlog " ...]") + for (i = first_tail; i <= n; i++) out(buf[i]) + } + out("########## end of " name) +} +BEGIN { + # Read from the environment, not -v, which would process backslash escapes. + testlog = ENVIRON["REPORT_TESTLOG"] + exclude = ENVIRON["EXCLUDE_ERE"] + head_cap = ENVIRON["HEAD_LINES"] + 0 + tail_cap = ENVIRON["TAIL_LINES"] + 0 + total_cap = ENVIRON["TOTAL_LINES"] + 0 + inside = 0; failed = 0; printed = 0; unshown = 0 +} +{ sub(/\r$/, "") } +length($0) == 78 && /^=+ [0-9]+\/[0-9]+ =+$/ { + finish_test() + inside = 1; n = 0; name = "(unnamed test)"; result = ""; duration = ""; command = "" + in_header = 1 + next +} +!inside { next } +is_rule($0, "=") || is_rule($0, "-") { + finish_test() + next +} +in_header && /^test: / { name = substr($0, 15); next } +in_header && /^result: / { result = substr($0, 15); next } +in_header && /^duration: / { duration = substr($0, 15); next } +in_header && /^command: / { command = substr($0, 15); next } +in_header && /^start time: / { next } +/^-+ (stdout|output|stderr) -+$/ { in_header = 0; buf[++n] = $0; next } +is_runtime_log($0) { next } +exclude != "" && $0 ~ exclude { next } +{ buf[++n] = $0 } +END { + finish_test() + if (failed == 0) { + print "No failed test in " testlog "; Meson failed before or outside a test (read the step above)." + } else { + print "" + print failed " failed test(s) in " testlog "." + if (unshown > 0) print unshown " of them not shown: the report reached " total_cap " lines." + } +} +' "$testlog" diff --git a/tests/meson.build b/tests/meson.build index 0f1970d2d..b9b998930 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -34,6 +34,12 @@ shell = find_program('sh') args: [meson.project_source_root() / 'tests' / 'tooling' / 'test_check_unit_test_isolation.py'], ) + test( + 'catch2-failure-report-tooling', + python, + args: [meson.project_source_root() / 'tests' / 'tooling' / 'test_catch2_failure_report.py'], + ) + logger_filter_fixture = executable( 'logger-filter-fixture', 'tooling/logger_filter_fixture.cpp', diff --git a/tests/tooling/test_catch2_failure_report.py b/tests/tooling/test_catch2_failure_report.py new file mode 100755 index 000000000..77ed1f581 --- /dev/null +++ b/tests/tooling/test_catch2_failure_report.py @@ -0,0 +1,218 @@ +#!/usr/bin/env python3 +"""Behaviour of scripts/catch2-failure-report.sh, the CI failure report (ADR-0877). + +The report must show every failed test's Catch2 output, however early the test ran and however much passing +output Meson wrote after it, with the runtime log lines removed; skip a passing or skipped (exit 77) test; cap +its size; and every workflow's failure report must use it rather than a tail of the whole log. +""" +from __future__ import annotations + +import os +import re +import shutil +import subprocess +import tempfile +import unittest +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parents[2] +SCRIPT = REPO_ROOT / "scripts" / "catch2-failure-report.sh" +WORKFLOWS = REPO_ROOT / ".github" / "workflows" +LOG_LINE = "2026-11-24 10:00:00.123456 +0000 <{level}> sync: a runtime line {index}" +CATCH2_FAILURE = """\ +------------------------------------------------------------------------------- +Scenario: presence settles after two devices flip + Given: two devices of one user + When: both report online then offline + Then: one presence change is federated +------------------------------------------------------------------------------- +/src/tests/integration/test_presence_flow.cpp:120 +............................................................................... + +/src/tests/integration/test_presence_flow.cpp:141: FAILED: + REQUIRE( sent.size() == 1 ) +with expansion: + 2 == 1 + +=============================================================================== +test cases: 418 | 417 passed | 1 failed +assertions: 9000 | 8999 passed | 1 failed +""" + + +def banner(number: int, total: int) -> str: + title = f" {number}/{total} " + first = (78 - len(title)) // 2 + return "=" * first + title + "=" * (78 - first - len(title)) + + +def section(number: int, total: int, name: str, result: str, output: str) -> str: + stdout = "-" * 35 + " output " + "-" * 35 + return ( + f"{banner(number, total)}\n" + f"test: {name}\n" + "start time: 10:00:00\n" + "duration: 12.34s\n" + f"result: {result}\n" + f"command: MALLOC_PERTURB_=1 /build/tests/{name}\n" + f"{stdout}\n{output}" + f"{'=' * 78}\n\n" + ) + + +def runtime_lines(count: int) -> str: + levels = ("INFO", "WARNING", "ERROR", "DEBUG", "CRITICAL") + return "".join(LOG_LINE.format(level=levels[i % len(levels)], index=i) + "\n" for i in range(count)) + + +@unittest.skipIf(shutil.which("sh") is None or shutil.which("awk") is None, "needs sh and awk") +class TheFailureReport(unittest.TestCase): + def setUp(self) -> None: + self.directory = tempfile.TemporaryDirectory() + self.testlog = Path(self.directory.name) / "testlog.txt" + + def tearDown(self) -> None: + self.directory.cleanup() + + def run_report(self, *arguments: str, env: dict[str, str] | None = None) -> subprocess.CompletedProcess[str]: + return subprocess.run( + ["sh", str(SCRIPT), *arguments], + capture_output=True, + text=True, + timeout=60, + check=False, + env={**os.environ, **(env or {})}, + ) + + def test_given_an_early_failure_followed_by_many_passing_tests_then_its_catch2_case_is_shown(self) -> None: + # GIVEN integration shard 1 fails first, with its failure among runtime log lines, and 60 smoke tests + # pass after it with hundreds of lines each, as in the asan-ubsan run whose failure no report showed. + failing = runtime_lines(500) + CATCH2_FAILURE + runtime_lines(50) + passing = "".join( + section(n, 61, f"smoke-{n}", "exit status 0", f"line {n}\n" * 400) for n in range(2, 62) + ) + self.testlog.write_text( + "Log of Meson test suite run\n\n" + + section(1, 61, "integration-tests-shard-1-of-4", "exit status 1", failing) + + passing + + "\nSummary of Failures:\n\n 1/61 integration-tests-shard-1-of-4 FAIL\n\nOk: 60\nFail: 1\n", + encoding="utf-8", + ) + + # WHEN the report is printed + completed = self.run_report(str(self.testlog)) + + # THEN it shows the whole Catch2 case of the failed test and nothing of the runtime log or passing tests + self.assertEqual(completed.returncode, 0, completed.stderr) + report = completed.stdout + self.assertIn("FAILED integration-tests-shard-1-of-4 (exit status 1, 12.34s)", report) + for expected in ( + "Scenario: presence settles after two devices flip", + "/src/tests/integration/test_presence_flow.cpp:120", + "/src/tests/integration/test_presence_flow.cpp:141: FAILED:", + " REQUIRE( sent.size() == 1 )", + "with expansion:", + " 2 == 1", + "test cases: 418 | 417 passed | 1 failed", + ): + self.assertIn(expected, report) + self.assertNotIn("a runtime line", report) + self.assertNotIn("smoke-", report) + self.assertIn("1 failed test(s)", report) + + def test_given_a_skipped_test_and_a_crashed_test_then_only_the_crash_is_reported(self) -> None: + # GIVEN a test Meson skipped (exit 77) and one killed by a signal + self.testlog.write_text( + section(1, 2, "postgresql-flow", "exit status 77", "SKIPPED: no PostgreSQL\n") + + section(2, 2, "unit-tests", "killed by signal 6 SIGABRT", "==123==ERROR: AddressSanitizer\n"), + encoding="utf-8", + ) + + # WHEN the report is printed + report = self.run_report(str(self.testlog)).stdout + + # THEN the crash and its sanitizer output are shown and the skip is not + self.assertIn("FAILED unit-tests (killed by signal 6 SIGABRT", report) + self.assertIn("==123==ERROR: AddressSanitizer", report) + self.assertNotIn("postgresql-flow", report) + + def test_given_a_long_failed_output_then_its_head_and_tail_are_kept_within_the_caps(self) -> None: + # GIVEN a failed test with 1000 lines of its own output, and a second failed test after it + output = "".join(f"catch2 line {i}\n" for i in range(1000)) + self.testlog.write_text( + section(1, 2, "first", "exit status 1", output) + section(2, 2, "second", "exit status 1", "x\n"), + encoding="utf-8", + ) + + # WHEN the report runs with 10 head lines, 5 tail lines and a 20-line total + report = self.run_report( + str(self.testlog), + env={ + "CATCH2_REPORT_HEAD_LINES": "10", + "CATCH2_REPORT_TAIL_LINES": "5", + "CATCH2_REPORT_TOTAL_LINES": "20", + }, + ).stdout + + # THEN the first test shows its first and last lines with the gap counted, and the second is counted + # but not shown, because the report had reached its cap + self.assertIn("catch2 line 8\n", report) + self.assertIn("catch2 line 999\n", report) + self.assertNotIn("catch2 line 500\n", report) + self.assertIn("lines omitted", report) + self.assertNotIn("FAILED second", report) + self.assertIn("2 failed test(s)", report) + self.assertIn("1 of them not shown", report) + + def test_given_an_exclude_pattern_then_matching_lines_are_dropped(self) -> None: + # GIVEN a failed test whose output holds NetBSD diagnostic markers + self.testlog.write_text( + section(1, 1, "unit-tests", "exit status 1", "[netbsd-diag] fd 3\nFAILED:\n"), encoding="utf-8" + ) + + # WHEN the report drops them + report = self.run_report("--exclude", r"^\[netbsd-diag\]", str(self.testlog)).stdout + + # THEN only the Catch2 line is left + self.assertIn("FAILED:", report) + self.assertNotIn("netbsd-diag", report) + + def test_given_no_log_or_no_failed_test_then_it_says_so_and_succeeds(self) -> None: + # GIVEN no log, then a log in which every test passed + missing = self.run_report(str(self.testlog)) + self.testlog.write_text(section(1, 1, "unit-tests", "exit status 0", "ok\n"), encoding="utf-8") + passed = self.run_report(str(self.testlog)) + + # THEN each run says why there is nothing to show, and neither fails the step + self.assertEqual((missing.returncode, passed.returncode), (0, 0)) + self.assertIn("No test log at", missing.stdout) + self.assertIn("No failed test in", passed.stdout) + + def test_given_bad_arguments_then_it_refuses(self) -> None: + self.assertEqual(self.run_report().returncode, 2) + self.assertEqual(self.run_report("--exclude").returncode, 2) + self.assertEqual(self.run_report("--bogus", str(self.testlog)).returncode, 2) + + +class TheWorkflows(unittest.TestCase): + def test_every_catch2_failure_report_uses_the_script_and_none_tails_the_whole_log(self) -> None: + # GIVEN every workflow + reports = 0 + for workflow in sorted(WORKFLOWS.glob("*.yml")): + text = workflow.read_text(encoding="utf-8") + # WHEN each Catch2 failure report in it is read + for match in re.finditer(r"Catch2 failure report[^\n]*\n((?:.*\n){0,12})", text): + reports += 1 + # THEN it runs the script and tails nothing, since a tail drops an early test's failure + self.assertIn("scripts/catch2-failure-report.sh", match.group(1), workflow.name) + self.assertNotIn("tail -n", match.group(1), workflow.name) + self.assertGreaterEqual(reports, 12) + + def test_both_sanitizer_jobs_report_their_failures(self) -> None: + workflow = (WORKFLOWS / "sanitizers.yml").read_text(encoding="utf-8") + self.assertIn("sh scripts/catch2-failure-report.sh build/meson-logs/testlog.txt", workflow) + self.assertIn("sh scripts/catch2-failure-report.sh build-tsan/meson-logs/testlog.txt", workflow) + + +if __name__ == "__main__": + unittest.main() From ddd47fabcfc2bb4545139368d7ecf361c3de7ee0 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 24 Nov 2026 21:58:01 +0000 Subject: [PATCH 2/8] Hold the failure report to its total cap and document what the caps omit The 4000-line cap was checked only before a test started, so eight long failed tests printed 4040 lines plus the summary. Each test's output is now fitted to the room left under the cap, summary included, and a test that would get fewer than 10 lines is counted as not shown. The docs, ADR-0877 and the changelog said the report shows every failed test's output; the caps can omit an assertion, so they now say so and point at testlog.txt for the whole output. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 4 +- ...-each-failed-test-not-a-tail-of-the-log.md | 16 ++++---- docs/testing-standards.md | 7 +++- scripts/AGENTS.md | 2 +- scripts/catch2-failure-report.sh | 41 +++++++++++++------ tests/tooling/test_catch2_failure_report.py | 32 ++++++++++++--- 6 files changed, 72 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d11483a1a..71f0a5b54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -197,8 +197,8 @@ Changes before 1.0.0 are in [CHANGELOG-pre-release.md](CHANGELOG-pre-release.md) gone), and a tooling test fails when that list and the modules the sources name differ (ADR-0872). * The TURN log calls mark GCC's cleanup of their braced field lists excluded from coverage, a compiler path no test can reach; the testing standards say when such a marker is allowed (ADR-0874). -* A CI failure report shows every failed test's Catch2 output, however early it ran; a tail of the log lost it behind - later tests. The `tsan` job gets a report too (ADR-0877). +* A CI failure report shows each failed test's Catch2 output, however early it ran, within a 4000-line cap that it + reports; a tail of the log lost it behind later tests. The `tsan` job gets a report too (ADR-0877). ## Release notes diff --git a/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md b/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md index 8479913bf..5ec830e10 100644 --- a/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md +++ b/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md @@ -16,8 +16,8 @@ which were runtime logging. How should a failure report find the failed assertio ## Decision Drivers -* The report must show every failed Catch2 case (scenario, file and line, `FAILED:`, expansion, exception message), - however early the test ran and however much passed after it. +* Where a failed Catch2 case (scenario, file and line, `FAILED:`, expansion, exception message) appears in the report + must not depend on how early its test ran or how much passed after it. * It must run unchanged on the Ubuntu, Debian, Fedora and AlmaLinux jobs and inside the FreeBSD, OpenBSD and NetBSD VMs, none of which is sure to have a `python3` on `PATH`. * A broken run must not print an unbounded log. @@ -26,7 +26,8 @@ which were runtime logging. How should a failure report find the failed assertio 1. `scripts/catch2-failure-report.sh`: one POSIX `awk` pass over `testlog.txt` that keeps the section of each test whose `result:` is neither `exit status 0` nor `exit status 77` (Meson's skip), drops runtime log lines, and caps - each test (first 400 and last 100 lines) and the whole report (4000 lines). + each test (first 400 and last 100 lines) and the whole report (4000 lines, summary included: a test that does + not fit is cut further, or counted as not shown). 2. Raise the tail (say to 3000 lines). 3. Read `testlog.json` in Python, whose records carry a `result` of `FAIL`, `TIMEOUT` and so on. 4. Fix the order instead (run the integration shards last), or rely on `--print-errorlogs`. @@ -44,13 +45,14 @@ Chosen option: 1, run by every report step: `ci.yml`'s Linux and BSD jobs, `cove and `result:` holds Meson's `returncode_to_status` text. * The order of tests is not the report's to fix, and `--print-errorlogs` cannot be told to skip runtime log lines. * The script uses no `awk` interval expressions (`{4}`), which older releases of `mawk` and the BSDs' `awk` did not - accept, and - reads its patterns from the environment, since `awk -v` would process their backslashes. + accept, and reads its patterns from the environment, since `awk -v` would process their backslashes. ### Negative Consequences -* A failed test with more than 500 lines of its own output shows its first 400 and last 100; the gap is counted and - the full log stays in `testlog.txt` (uploaded by `tsan`). +* The caps can leave out failure output, assertions included: a failed test with more than 500 lines of its own + output shows its first 400 and last 100, and once the report nears 4000 lines a test is cut further or not shown. + The report counts every gap and every test left out, and names `testlog.txt`, which holds the whole output: the + `tsan` job uploads it, and elsewhere the failed test is run again locally. * A change to Meson's text log format would make the report find no failed test. It then says so, rather than printing nothing, and `tests/tooling/test_catch2_failure_report.py` pins the format it reads. diff --git a/docs/testing-standards.md b/docs/testing-standards.md index 5e9ec59fa..22a9ac877 100644 --- a/docs/testing-standards.md +++ b/docs/testing-standards.md @@ -409,9 +409,12 @@ Never list `MEROVINGIAN_TEST_FEDERATION_WORKER is not defined`: on CI that skip undefined-behaviour defects, and the `tsan` job (`-Db_sanitize=thread`) catches data races. ThreadSanitizer is the only sanitizer that detects data races; ASan and UBSan are blind to them. When the suite fails, each job's - "Catch2 failure report" step prints every failed test's Catch2 output from + "Catch2 failure report" step prints each failed test's Catch2 output from `testlog.txt` (`scripts/catch2-failure-report.sh`, ADR-0877); read it there, - not in the tail of the build step. + not in the tail of the build step. It caps each test at its first 400 and + last 100 lines and the report at 4000, so it can leave out an assertion: it + says how many lines and tests it left out, and then the whole output is in + `testlog.txt` (uploaded by the `tsan` job; elsewhere, run the test locally). - Any type shared across threads at runtime must have a test that exercises `perform`/`run`/dispatch concurrently from multiple threads so TSan can check the exercised accesses for data races. A thread-safety claim in a header comment is diff --git a/scripts/AGENTS.md b/scripts/AGENTS.md index b271e54a0..822aa2552 100644 --- a/scripts/AGENTS.md +++ b/scripts/AGENTS.md @@ -23,7 +23,7 @@ called by it rather than directly. | `ci-openbsd-pkg-add.sh` | CI only: `ci-openbsd-pkg-add.sh --require "command ..." [--require-pkg-config "module ..."] package ...` installs packages in the vmactions OpenBSD VMs, three tries through `cdn.openbsd.org` then three through `ftp.openbsd.org` (`PKG_PATH` for the VM's release and architecture). Judges each try by whether every `--require` command is on `PATH` and every `--require-pkg-config` module passes `pkg-config --exists`, because `pkg_add` exits 0 having installed nothing; fails naming what is missing (ADR-0650). Both OpenBSD jobs run it from `prepare`, which vmactions runs in the synced checkout. Covered by `tests/tooling/test_ci_workflow.py` against a fake `pkg_add` | | `check-catch2-bdd-tests.sh` | Rejects unit test files that use `TEST_CASE`, use comment-only Given/When/Then markers, or lack any of `SCENARIO`/`GIVEN`/`WHEN`/`THEN` (`test_main.cpp` exempt). One `awk` pass over all files: run per file it timed out on the OpenBSD VM. Covered by `tests/tooling/test_check_catch2_bdd.py` | | `check_expected_skips.py` | CI skip gate (ADR-0546): reads the XML reports the Catch2 binaries write when `MEROVINGIAN_CATCH_REPORT_DIR` is set and fails on any skipped test case that `tests/expected_skips.json` does not list for the `--job`. Exit 0 ok, 1 unexpected skip (or a stale entry with `--strict-stale`), 2 unusable input (no report, truncated report, bad list, unknown job). `` is a key of the `jobs` object in `tests/expected_skips.json`. `build-linux.sh` and `build-bsd.sh` run it after the suite when given `--skip-job `; `build-wsl.sh` has no `--skip-job`, and `build.py vm` passes none, so WSL and VM runs are not skip-gated; `build-bsd.sh` runs it with `python3`, else the interpreter in `meson`'s shebang, else a `python3.N` on `PATH` (FreeBSD and NetBSD install only a versioned Python, as meson's dependency), and fails the gate when it finds none. Covered by `tests/tooling/test_expected_skips.py` | -| `catch2-failure-report.sh` | CI only: `catch2-failure-report.sh [--exclude ERE] TESTLOG` prints, from a Meson `testlog.txt`, the section of each test whose `result:` is neither `exit status 0` nor `exit status 77` (a skip), without the runtime log lines, so each failed Catch2 case shows whatever ran after it; a tail of the whole log lost an early failure (ADR-0877). Each test prints at most its first 400 and last 100 lines, and the report stops adding tests at 4000 lines (`CATCH2_REPORT_HEAD_LINES`, `_TAIL_LINES`, `_TOTAL_LINES`). Says so and exits 0 when there is no log or no failed test; exit 2 for bad arguments. POSIX `sh` and `awk` without interval expressions, so it runs in every Linux container and BSD VM. Every workflow's "Catch2 failure report" runs it; covered by `tests/tooling/test_catch2_failure_report.py`, which also checks that every workflow's report runs it and tails nothing | +| `catch2-failure-report.sh` | CI only: `catch2-failure-report.sh [--exclude ERE] TESTLOG` prints, from a Meson `testlog.txt`, the section of each test whose `result:` is neither `exit status 0` nor `exit status 77` (a skip), without the runtime log lines, so each failed Catch2 case shows whatever ran after it; a tail of the whole log lost an early failure (ADR-0877). Each test prints at most its first 400 and last 100 lines, and the whole report, summary included, at most 4000: a test that does not fit is cut further or counted as not shown (`CATCH2_REPORT_HEAD_LINES`, `_TAIL_LINES`, `_TOTAL_LINES`). The caps can leave out an assertion; the report counts every gap and names the log. Says so and exits 0 when there is no log or no failed test; exit 2 for bad arguments. POSIX `sh` and `awk` without interval expressions, so it runs in every Linux container and BSD VM. Every workflow's "Catch2 failure report" runs it; covered by `tests/tooling/test_catch2_failure_report.py`, which also checks that every workflow's report runs it and tails nothing | | `check-conformance-gate.sh` | Runs `meson test conformance-tests --print-errorlogs` in the build directory given as its argument (default `build`) and fails if that suite fails or the directory is missing. It does not detect a removed or commented-out test; CI runs it after each build | | `check-elf-hardening.sh` | Build-time hardening gate: inspects a built ELF binary's headers with `readelf` and fails if PIE (`ET_DYN`), `PT_GNU_RELRO`, `DT_BIND_NOW`, or a non-executable stack (`PT_GNU_STACK` without `E`) is missing; the CI-time counterpart to the runtime self-check in `src/platform/`, since that check can only run inside a live, correctly-privileged `merovingian-server` process. Pass `--static` for the static-PIE binary, which has no `PT_DYNAMIC` section to apply `BIND_NOW` to. Accepts both GNU binutils' and the BSDs' elftoolchain `readelf` output, and uses POSIX ERE only (ADR-0757). Covered by `tests/tooling/test_check_elf_hardening.py` against a fake `readelf` | | `check-startup-hardening-gate.sh` | Runtime counterpart to `check-elf-hardening.sh` for shipped artifacts (audit OPS-5): boots a packaged `merovingian-server` against a throwaway loopback SQLite config with a fresh 0400 master key, and passes only when every `Hardening self-check:` line is `enabled`, their count matches `Startup hardening checks: N`, readiness is `ready=true blockers=0`, the federation worker is spawned and still up `--worker-settle` seconds (3) later, and the server exits 0 on `SIGTERM`. Run it as the unprivileged service user with an empty capability bounding set. Leaves the worker path to the binary's libexec default unless `--federation-worker` is given. Off Linux it sets `federation.worker.apply_hardening=false`, because the worker's in-process sandbox exists only on Linux. Run by the `deb`, `debian-pkg`, `rpm`, `freebsd-pkg` and `docker-image` jobs in `packages.yml`; covered by `tests/tooling/test_startup_hardening_gate.py` | diff --git a/scripts/catch2-failure-report.sh b/scripts/catch2-failure-report.sh index 402500c18..99a23dfaf 100755 --- a/scripts/catch2-failure-report.sh +++ b/scripts/catch2-failure-report.sh @@ -17,8 +17,10 @@ # of exactly 78 "=" (78 "-" in older Meson; Catch2's own rules are 79 wide, so # neither is mistaken for the other). A test failed unless its # "result:" is "exit status 0", or "exit status 77", which Meson reads as a -# skip. Each failed test prints at most HEAD_LINES of its filtered output and -# its last TAIL_LINES; the report stops adding tests after TOTAL_LINES lines. +# skip. Each failed test prints at most the first HEAD_LINES of its filtered +# output and its last TAIL_LINES, and the whole report at most TOTAL_LINES: a +# test that does not fit is cut further, or counted as not shown. Lines left out +# can hold an assertion, so the report says how many and where the full log is. # --exclude drops more lines (an extended regular expression), as the NetBSD # job does for its [netbsd-diag] markers. POSIX sh and awk only, with no # interval expressions, so it runs as is on the BSD VMs and in every container. @@ -75,24 +77,35 @@ function out(line) { print line printed++ } -function finish_test( i, first_tail) { +function finish_test( i, first_tail, per_test, room, body, head, tail) { if (!inside) return inside = 0 if (result == "exit status 0" || result == "exit status 77") return failed++ - if (printed >= total_cap) { - unshown++ - return + # The lines left for the output of this test once its own markers (a blank line, FAILED, the command and the + # end line) and the closing summary are counted, so the report never passes TOTAL_LINES. + room = total_cap - SUMMARY_LINES - printed - 3 - (command != "" ? 1 : 0) + per_test = head_cap + tail_cap + if (n <= per_test && n <= room) { + head = n + tail = 0 + } else { + # Cut: one line goes to the note that counts what was left out. + body = per_test < room - 1 ? per_test : room - 1 + if (body < MIN_CUT_LINES && body < per_test) { + unshown++ + return + } + head = per_test > 0 ? int(body * head_cap / per_test) : 0 + tail = body - head } out("") out("########## FAILED " name " (" result ", " duration ")") if (command != "") out("command: " command) - if (n <= head_cap + tail_cap) { - for (i = 1; i <= n; i++) out(buf[i]) - } else { - for (i = 1; i <= head_cap; i++) out(buf[i]) - first_tail = n - tail_cap + 1 - out("[... " (first_tail - head_cap - 1) " lines omitted; the full output is in " testlog " ...]") + for (i = 1; i <= head; i++) out(buf[i]) + if (head + tail < n) { + first_tail = n - tail + 1 + out("[... " (first_tail - head - 1) " lines omitted; the full output is in " testlog " ...]") for (i = first_tail; i <= n; i++) out(buf[i]) } out("########## end of " name) @@ -105,6 +118,10 @@ BEGIN { tail_cap = ENVIRON["TAIL_LINES"] + 0 total_cap = ENVIRON["TOTAL_LINES"] + 0 inside = 0; failed = 0; printed = 0; unshown = 0 + # The closing summary: a blank line, the count, and the not-shown count. + SUMMARY_LINES = 3 + # A test cut to fewer lines than this by the total cap is counted as not shown instead. + MIN_CUT_LINES = 10 } { sub(/\r$/, "") } length($0) == 78 && /^=+ [0-9]+\/[0-9]+ =+$/ { diff --git a/tests/tooling/test_catch2_failure_report.py b/tests/tooling/test_catch2_failure_report.py index 77ed1f581..d65654c20 100755 --- a/tests/tooling/test_catch2_failure_report.py +++ b/tests/tooling/test_catch2_failure_report.py @@ -137,25 +137,26 @@ def test_given_a_skipped_test_and_a_crashed_test_then_only_the_crash_is_reported self.assertNotIn("postgresql-flow", report) def test_given_a_long_failed_output_then_its_head_and_tail_are_kept_within_the_caps(self) -> None: - # GIVEN a failed test with 1000 lines of its own output, and a second failed test after it + # GIVEN a failed test with 1000 lines of its own output, and a second with 100 after it output = "".join(f"catch2 line {i}\n" for i in range(1000)) + second = "".join(f"second line {i}\n" for i in range(100)) self.testlog.write_text( - section(1, 2, "first", "exit status 1", output) + section(2, 2, "second", "exit status 1", "x\n"), + section(1, 2, "first", "exit status 1", output) + section(2, 2, "second", "exit status 1", second), encoding="utf-8", ) - # WHEN the report runs with 10 head lines, 5 tail lines and a 20-line total + # WHEN the report runs with 10 head lines, 5 tail lines and a 30-line total report = self.run_report( str(self.testlog), env={ "CATCH2_REPORT_HEAD_LINES": "10", "CATCH2_REPORT_TAIL_LINES": "5", - "CATCH2_REPORT_TOTAL_LINES": "20", + "CATCH2_REPORT_TOTAL_LINES": "30", }, ).stdout - # THEN the first test shows its first and last lines with the gap counted, and the second is counted - # but not shown, because the report had reached its cap + # THEN the first test shows its first and last lines with the gap counted, the second, which would + # take the report past its total, is counted but not shown, and the report stays within 30 lines self.assertIn("catch2 line 8\n", report) self.assertIn("catch2 line 999\n", report) self.assertNotIn("catch2 line 500\n", report) @@ -163,6 +164,25 @@ def test_given_a_long_failed_output_then_its_head_and_tail_are_kept_within_the_c self.assertNotIn("FAILED second", report) self.assertIn("2 failed test(s)", report) self.assertIn("1 of them not shown", report) + self.assertLessEqual(len(report.splitlines()), 30) + + def test_given_many_long_failed_tests_then_the_whole_report_stays_within_its_default_total(self) -> None: + # GIVEN nine failed tests of 1000 lines each, each of which alone fills its 505-line share + output = "".join(f"catch2 line {i}\n" for i in range(1000)) + self.testlog.write_text( + "".join(section(n, 9, f"shard-{n}", "exit status 1", output) for n in range(1, 10)), encoding="utf-8" + ) + + # WHEN the report runs with its default caps + report = self.run_report(str(self.testlog)).stdout + + # THEN the eighth test is cut to fit, the ninth is counted but not shown, and the whole report, + # summary included, is at most 4000 lines + self.assertLessEqual(len(report.splitlines()), 4000) + self.assertIn("FAILED shard-8 ", report) + self.assertNotIn("FAILED shard-9 ", report) + self.assertIn("9 failed test(s)", report) + self.assertIn("1 of them not shown", report) def test_given_an_exclude_pattern_then_matching_lines_are_dropped(self) -> None: # GIVEN a failed test whose output holds NetBSD diagnostic markers From 1ca0baef0030055a4e95e8cec28a413cf7925ed5 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 24 Nov 2026 22:03:03 +0000 Subject: [PATCH 3/8] Refuse report caps the failure report cannot keep With CATCH2_REPORT_TOTAL_LINES=1 the report left out the failed test but still printed its three-line summary, past the cap. A cap that is not a whole number, or a total under 20 lines (the summary plus one test cut to its fewest lines), is now refused with exit 2 before the log is read. A boundary test covers 1, 19, -5, non-numbers and 20. Co-Authored-By: Claude Opus 5.5 --- scripts/AGENTS.md | 2 +- scripts/catch2-failure-report.sh | 24 ++++++++++++++++++--- tests/tooling/test_catch2_failure_report.py | 24 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/scripts/AGENTS.md b/scripts/AGENTS.md index 822aa2552..5cc2e2c7e 100644 --- a/scripts/AGENTS.md +++ b/scripts/AGENTS.md @@ -23,7 +23,7 @@ called by it rather than directly. | `ci-openbsd-pkg-add.sh` | CI only: `ci-openbsd-pkg-add.sh --require "command ..." [--require-pkg-config "module ..."] package ...` installs packages in the vmactions OpenBSD VMs, three tries through `cdn.openbsd.org` then three through `ftp.openbsd.org` (`PKG_PATH` for the VM's release and architecture). Judges each try by whether every `--require` command is on `PATH` and every `--require-pkg-config` module passes `pkg-config --exists`, because `pkg_add` exits 0 having installed nothing; fails naming what is missing (ADR-0650). Both OpenBSD jobs run it from `prepare`, which vmactions runs in the synced checkout. Covered by `tests/tooling/test_ci_workflow.py` against a fake `pkg_add` | | `check-catch2-bdd-tests.sh` | Rejects unit test files that use `TEST_CASE`, use comment-only Given/When/Then markers, or lack any of `SCENARIO`/`GIVEN`/`WHEN`/`THEN` (`test_main.cpp` exempt). One `awk` pass over all files: run per file it timed out on the OpenBSD VM. Covered by `tests/tooling/test_check_catch2_bdd.py` | | `check_expected_skips.py` | CI skip gate (ADR-0546): reads the XML reports the Catch2 binaries write when `MEROVINGIAN_CATCH_REPORT_DIR` is set and fails on any skipped test case that `tests/expected_skips.json` does not list for the `--job`. Exit 0 ok, 1 unexpected skip (or a stale entry with `--strict-stale`), 2 unusable input (no report, truncated report, bad list, unknown job). `` is a key of the `jobs` object in `tests/expected_skips.json`. `build-linux.sh` and `build-bsd.sh` run it after the suite when given `--skip-job `; `build-wsl.sh` has no `--skip-job`, and `build.py vm` passes none, so WSL and VM runs are not skip-gated; `build-bsd.sh` runs it with `python3`, else the interpreter in `meson`'s shebang, else a `python3.N` on `PATH` (FreeBSD and NetBSD install only a versioned Python, as meson's dependency), and fails the gate when it finds none. Covered by `tests/tooling/test_expected_skips.py` | -| `catch2-failure-report.sh` | CI only: `catch2-failure-report.sh [--exclude ERE] TESTLOG` prints, from a Meson `testlog.txt`, the section of each test whose `result:` is neither `exit status 0` nor `exit status 77` (a skip), without the runtime log lines, so each failed Catch2 case shows whatever ran after it; a tail of the whole log lost an early failure (ADR-0877). Each test prints at most its first 400 and last 100 lines, and the whole report, summary included, at most 4000: a test that does not fit is cut further or counted as not shown (`CATCH2_REPORT_HEAD_LINES`, `_TAIL_LINES`, `_TOTAL_LINES`). The caps can leave out an assertion; the report counts every gap and names the log. Says so and exits 0 when there is no log or no failed test; exit 2 for bad arguments. POSIX `sh` and `awk` without interval expressions, so it runs in every Linux container and BSD VM. Every workflow's "Catch2 failure report" runs it; covered by `tests/tooling/test_catch2_failure_report.py`, which also checks that every workflow's report runs it and tails nothing | +| `catch2-failure-report.sh` | CI only: `catch2-failure-report.sh [--exclude ERE] TESTLOG` prints, from a Meson `testlog.txt`, the section of each test whose `result:` is neither `exit status 0` nor `exit status 77` (a skip), without the runtime log lines, so each failed Catch2 case shows whatever ran after it; a tail of the whole log lost an early failure (ADR-0877). Each test prints at most its first 400 and last 100 lines, and the whole report, summary included, at most 4000: a test that does not fit is cut further or counted as not shown (`CATCH2_REPORT_HEAD_LINES`, `_TAIL_LINES`, `_TOTAL_LINES`). The caps can leave out an assertion; the report counts every gap and names the log. Says so and exits 0 when there is no log or no failed test; exit 2 for bad arguments, a cap that is not a whole number, or a total under 20 (the summary and one cut test). POSIX `sh` and `awk` without interval expressions, so it runs in every Linux container and BSD VM. Every workflow's "Catch2 failure report" runs it; covered by `tests/tooling/test_catch2_failure_report.py`, which also checks that every workflow's report runs it and tails nothing | | `check-conformance-gate.sh` | Runs `meson test conformance-tests --print-errorlogs` in the build directory given as its argument (default `build`) and fails if that suite fails or the directory is missing. It does not detect a removed or commented-out test; CI runs it after each build | | `check-elf-hardening.sh` | Build-time hardening gate: inspects a built ELF binary's headers with `readelf` and fails if PIE (`ET_DYN`), `PT_GNU_RELRO`, `DT_BIND_NOW`, or a non-executable stack (`PT_GNU_STACK` without `E`) is missing; the CI-time counterpart to the runtime self-check in `src/platform/`, since that check can only run inside a live, correctly-privileged `merovingian-server` process. Pass `--static` for the static-PIE binary, which has no `PT_DYNAMIC` section to apply `BIND_NOW` to. Accepts both GNU binutils' and the BSDs' elftoolchain `readelf` output, and uses POSIX ERE only (ADR-0757). Covered by `tests/tooling/test_check_elf_hardening.py` against a fake `readelf` | | `check-startup-hardening-gate.sh` | Runtime counterpart to `check-elf-hardening.sh` for shipped artifacts (audit OPS-5): boots a packaged `merovingian-server` against a throwaway loopback SQLite config with a fresh 0400 master key, and passes only when every `Hardening self-check:` line is `enabled`, their count matches `Startup hardening checks: N`, readiness is `ready=true blockers=0`, the federation worker is spawned and still up `--worker-settle` seconds (3) later, and the server exits 0 on `SIGTERM`. Run it as the unprivileged service user with an empty capability bounding set. Leaves the worker path to the binary's libexec default unless `--federation-worker` is given. Off Linux it sets `federation.worker.apply_hardening=false`, because the worker's in-process sandbox exists only on Linux. Run by the `deb`, `debian-pkg`, `rpm`, `freebsd-pkg` and `docker-image` jobs in `packages.yml`; covered by `tests/tooling/test_startup_hardening_gate.py` | diff --git a/scripts/catch2-failure-report.sh b/scripts/catch2-failure-report.sh index 99a23dfaf..d4a3403df 100755 --- a/scripts/catch2-failure-report.sh +++ b/scripts/catch2-failure-report.sh @@ -54,6 +54,24 @@ if [ $# -ne 1 ]; then fi testlog=$1 +head_lines=${CATCH2_REPORT_HEAD_LINES:-400} +tail_lines=${CATCH2_REPORT_TAIL_LINES:-100} +total_lines=${CATCH2_REPORT_TOTAL_LINES:-4000} +for cap in "$head_lines" "$tail_lines" "$total_lines"; do + case "$cap" in + '' | *[!0-9]*) + echo "catch2-failure-report.sh: a line cap must be a whole number, not '$cap'" >&2 + exit 2 + ;; + esac +done +# The smallest total that holds the closing summary (3 lines) and one test cut to +# its fewest lines (10, its 4 markers and the omission note), so no cap is broken. +if [ "$total_lines" -lt 20 ]; then + echo "catch2-failure-report.sh: CATCH2_REPORT_TOTAL_LINES must be at least 20, not $total_lines" >&2 + exit 2 +fi + if [ ! -f "$testlog" ]; then printf 'No test log at %s: the build failed before any test ran.\n' "$testlog" exit 0 @@ -61,9 +79,9 @@ fi REPORT_TESTLOG=$testlog \ EXCLUDE_ERE=$exclude \ -HEAD_LINES=${CATCH2_REPORT_HEAD_LINES:-400} \ -TAIL_LINES=${CATCH2_REPORT_TAIL_LINES:-100} \ -TOTAL_LINES=${CATCH2_REPORT_TOTAL_LINES:-4000} \ +HEAD_LINES=$head_lines \ +TAIL_LINES=$tail_lines \ +TOTAL_LINES=$total_lines \ awk ' function is_rule(line, ch) { if (length(line) != 78) return 0 diff --git a/tests/tooling/test_catch2_failure_report.py b/tests/tooling/test_catch2_failure_report.py index d65654c20..5f6b1a8c5 100755 --- a/tests/tooling/test_catch2_failure_report.py +++ b/tests/tooling/test_catch2_failure_report.py @@ -213,6 +213,30 @@ def test_given_bad_arguments_then_it_refuses(self) -> None: self.assertEqual(self.run_report("--exclude").returncode, 2) self.assertEqual(self.run_report("--bogus", str(self.testlog)).returncode, 2) + def test_given_a_cap_it_cannot_keep_then_it_refuses_before_reading_the_log(self) -> None: + # GIVEN a log with a failed test + self.testlog.write_text(section(1, 1, "unit-tests", "exit status 1", "FAILED:\n"), encoding="utf-8") + + # WHEN a total below the summary and one cut test, or a cap that is not a whole number, is asked for + for variable, value in ( + ("CATCH2_REPORT_TOTAL_LINES", "1"), + ("CATCH2_REPORT_TOTAL_LINES", "19"), + ("CATCH2_REPORT_TOTAL_LINES", "-5"), + ("CATCH2_REPORT_HEAD_LINES", "abc"), + ("CATCH2_REPORT_TAIL_LINES", "1.5"), + ): + with self.subTest(variable=variable, value=value): + completed = self.run_report(str(self.testlog), env={variable: value}) + # THEN it refuses, printing no report + self.assertEqual(completed.returncode, 2) + self.assertEqual(completed.stdout, "") + + # AND the smallest total it accepts holds, summary included + completed = self.run_report(str(self.testlog), env={"CATCH2_REPORT_TOTAL_LINES": "20"}) + self.assertEqual(completed.returncode, 0, completed.stderr) + self.assertIn("FAILED unit-tests", completed.stdout) + self.assertLessEqual(len(completed.stdout.splitlines()), 20) + class TheWorkflows(unittest.TestCase): def test_every_catch2_failure_report_uses_the_script_and_none_tails_the_whole_log(self) -> None: From 287a232a0b4c7247a4bdb8a4aa80e1366e40aa07 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 24 Nov 2026 22:37:32 +0000 Subject: [PATCH 4/8] Dress the documentation in the outlined-toggle brand (ADR-0878) The documentation site and README take OMG Software's outlined-toggle brand package and Merovingian's project icon in place of the angular four-square mark and #ff8954 orange of ADR-0223. - Theme: switch orange #FF761F and charcoal #151515, with neutral greys between them. The light scheme keeps its darker link oranges, since #FF761F on its page is 2.4:1, under WCAG AA. - Marks, copied unchanged from the package: the G knob as the header logo (the guide uses it below about 120 px wide), Merovingian's compact knob as the favicon, its full toggle on the home page with one border-width of clear space, and its charcoal tile in the README. - ADR-0878 records the choices; ADR-0223's colours and marks are marked superseded. test_docs_site.py pins the new marks and palette. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 + README.md | 2 + ...ware-theme-dark-first-with-system-fonts.md | 2 +- ...outlined-toggle-brand-colours-and-marks.md | 56 +++++++++ docs/adr/index.md | 1 + docs/assets/merovingian-compact.svg | 5 + docs/assets/merovingian-icon.svg | 6 + docs/assets/merovingian-logo.svg | 1 - docs/assets/merovingian-toggle-mark.svg | 5 + docs/assets/omg-favicon.svg | 1 - docs/assets/omg-g-knob-orange.svg | 4 + docs/assets/omg-logo.svg | 1 - docs/dev-environment.md | 18 ++- docs/index.md | 2 +- docs/stylesheets/extra.css | 119 +++++++++--------- mkdocs.yml | 9 +- tests/tooling/test_docs_site.py | 66 +++++++--- 17 files changed, 209 insertions(+), 91 deletions(-) create mode 100644 docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md create mode 100644 docs/assets/merovingian-compact.svg create mode 100644 docs/assets/merovingian-icon.svg delete mode 100644 docs/assets/merovingian-logo.svg create mode 100644 docs/assets/merovingian-toggle-mark.svg delete mode 100644 docs/assets/omg-favicon.svg create mode 100644 docs/assets/omg-g-knob-orange.svg delete mode 100644 docs/assets/omg-logo.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 71f0a5b54..5a59a1350 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,8 @@ Changes before 1.0.0 are in [CHANGELOG-pre-release.md](CHANGELOG-pre-release.md) unavailable (error) and no TURN configured (debug), with the user ID and never a credential (ADR-0871). * Tests set a log module's level through one shared helper, `tests/support/ModuleLogLevel.hpp`, instead of a copy per file; the security coding rules state the TURN logging rule and why the username is withheld. +* The documentation site and README use OMG Software's outlined-toggle brand: switch orange and charcoal, the G knob, + and Merovingian's project icon, copied unchanged from the brand package (ADR-0878). ## Security Fixes diff --git a/README.md b/README.md index 1541b9b07..47cd3d26e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +Merovingian icon + # Merovingian **Latest release: [latest](https://github.com/OMG-Software/Merovingian/releases/tag/latest)** · **Documentation: [omg-software.github.io/Merovingian](https://omg-software.github.io/Merovingian/)** diff --git a/docs/adr/0223-the-documentation-site-wears-the-omg-software-theme-dark-first-with-system-fonts.md b/docs/adr/0223-the-documentation-site-wears-the-omg-software-theme-dark-first-with-system-fonts.md index 9604a2540..abf9c28aa 100644 --- a/docs/adr/0223-the-documentation-site-wears-the-omg-software-theme-dark-first-with-system-fonts.md +++ b/docs/adr/0223-the-documentation-site-wears-the-omg-software-theme-dark-first-with-system-fonts.md @@ -1,6 +1,6 @@ # The documentation site wears the OMG Software theme, dark first, with system fonts -* Status: accepted +* Status: accepted; colours and marks superseded by [ADR-0878](0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md) (2026-11-24) * Date: 2026-10-25 Technical Story: match the published documentation site to the OMG Software organisation site (0.12.46). diff --git a/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md b/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md new file mode 100644 index 000000000..50a7060da --- /dev/null +++ b/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md @@ -0,0 +1,56 @@ +# The documentation takes the outlined-toggle brand's colours and marks + +* Status: accepted +* Date: 2026-11-24 + +Technical Story: OMG Software's outlined-toggle brand package and its project icons replace the angular four-square +mark and the `#ff8954` orange the documentation site took from the organisation site in ADR-0223. + +## Context and Problem Statement + +The brand package sets two colours, switch orange `#FF761F` and charcoal `#151515`, a full toggle mark, a standalone G +knob for small sizes, and a project icon for each repository: Merovingian's is the toggle with a server stack cut out of +its knob. Its guide keeps about one border-width of clear space round the toggle and uses the knob below about 120 px +wide; the project icons use their compact knob at 32 px and below. How should the documentation site and the README +take them on? + +## Decision Drivers + +* The marks are the package's own: a reader should see the same shapes and colours as everywhere else OMG Software + shows them. +* ADR-0223 still holds: dark first, system fonts, nothing fetched from another origin, and text and links that meet + WCAG AA in both schemes. + +## Considered Options + +1. Copy the package's SVG files unchanged into `docs/assets/`, choose each by its size as the guide says, and set the + theme's orange and charcoal to the palette's. +2. Show the full OMG toggle as the header logo. +3. Load the marks from the organisation's site. +4. Use `#FF761F` for links in the light scheme too. + +## Decision Outcome + +Chosen option: 1. + +* The header logo, about 24 px high, is the standalone G knob (`omg-g-knob-orange.svg`): the full toggle there would be + about 50 px wide, well under the guide's 120 px. The favicon is Merovingian's compact knob + (`merovingian-compact.svg`), the project icon's design for 32 px and below. The home page shows Merovingian's full + toggle (`merovingian-toggle-mark.svg`), cropped to keep about one border-width of clear space, and the README the + same toggle on its charcoal tile (`merovingian-icon.svg`), which reads on GitHub's light and dark themes alike. +* The files are byte-for-byte the package's, line endings aside; a new version of the package replaces them, and none + is edited by hand. `tests/tooling/test_docs_site.py` checks their outlines and colours and that none can run or + fetch anything. +* `--omg-orange` is `#ff761f` and `--omg-ink` `#151515`; the dark scheme's page, header, footer, links and accent use + them. The greys between them are neutral (`#1f1f1f` panels, `#333333` rules), as charcoal is, where the earlier + theme's were tinted. +* The light scheme keeps its darker oranges for links (`#a8461c`) and their hover (`#8f3a15`): `#FF761F` on its + `#f4f3ee` page is about 2.4:1, under AA's 4.5:1. The brand orange stays for buttons, the eyebrow and focus rings. +* Loading the marks from another origin would report each reader's visit to it, which ADR-0223 rules out. + +This supersedes ADR-0223's colours and marks; the rest of ADR-0223 stands. + +### Negative Consequences + +* The dark scheme's orange is a little deeper than before; its links measure about 6.8:1 on the page and 6.2:1 on + cards, still above AA. diff --git a/docs/adr/index.md b/docs/adr/index.md index a9a064c94..4d0869850 100644 --- a/docs/adr/index.md +++ b/docs/adr/index.md @@ -751,3 +751,4 @@ * [0875 - A device syncing online holds its account online against another device syncing unavailable](0875-a-device-syncing-online-holds-its-account-online.md) * [0876 - The first presence change in a five-second window is kept, and every other one in it is dropped](0876-the-first-presence-change-in-a-five-second-window-is-kept.md) * [0877 - CI failure reports print each failed test's section of the Meson log, not a tail of the whole log](0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md) +* [0878 - The documentation takes the outlined-toggle brand's colours and marks](0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md) diff --git a/docs/assets/merovingian-compact.svg b/docs/assets/merovingian-compact.svg new file mode 100644 index 000000000..df3102e3b --- /dev/null +++ b/docs/assets/merovingian-compact.svg @@ -0,0 +1,5 @@ + + Merovingian icon + + + diff --git a/docs/assets/merovingian-icon.svg b/docs/assets/merovingian-icon.svg new file mode 100644 index 000000000..130e92bd6 --- /dev/null +++ b/docs/assets/merovingian-icon.svg @@ -0,0 +1,6 @@ + + Merovingian icon + + + + diff --git a/docs/assets/merovingian-logo.svg b/docs/assets/merovingian-logo.svg deleted file mode 100644 index ecb21cf65..000000000 --- a/docs/assets/merovingian-logo.svg +++ /dev/null @@ -1 +0,0 @@ -Merovingian diff --git a/docs/assets/merovingian-toggle-mark.svg b/docs/assets/merovingian-toggle-mark.svg new file mode 100644 index 000000000..ac3ea7f1e --- /dev/null +++ b/docs/assets/merovingian-toggle-mark.svg @@ -0,0 +1,5 @@ + + Merovingian icon + + + diff --git a/docs/assets/omg-favicon.svg b/docs/assets/omg-favicon.svg deleted file mode 100644 index 6f11293e1..000000000 --- a/docs/assets/omg-favicon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/assets/omg-g-knob-orange.svg b/docs/assets/omg-g-knob-orange.svg new file mode 100644 index 000000000..1b5056f45 --- /dev/null +++ b/docs/assets/omg-g-knob-orange.svg @@ -0,0 +1,4 @@ + + OMG Software + + diff --git a/docs/assets/omg-logo.svg b/docs/assets/omg-logo.svg deleted file mode 100644 index 85bf4bb97..000000000 --- a/docs/assets/omg-logo.svg +++ /dev/null @@ -1 +0,0 @@ -OMG Software diff --git a/docs/dev-environment.md b/docs/dev-environment.md index 5337f6e9c..490e9b968 100644 --- a/docs/dev-environment.md +++ b/docs/dev-environment.md @@ -539,13 +539,19 @@ What the site expects of each branch: - **The theme is OMG Software's.** Colours live in `docs/stylesheets/extra.css`, not in Material palette names; the site opens dark, uses system fonts and loads nothing from another origin - ([ADR-0223](adr/0223-the-documentation-site-wears-the-omg-software-theme-dark-first-with-system-fonts.md)). + ([ADR-0223](adr/0223-the-documentation-site-wears-the-omg-software-theme-dark-first-with-system-fonts.md), + colours from ADR-0878). `docs-site-tooling` checks text and link contrast in both schemes. -- **Use the published brand marks.** `docs/assets/omg-logo.svg` and - `omg-favicon.svg` reproduce the angular OMG mark and favicon from - [OMG Software](https://omg-software.org/projects/merovingian/index.html). - The home page uses its separate `merovingian-logo.svg` project mark. - These SVG files are local, so readers make no request to the organisation site. +- **Use the brand package's marks, unchanged.** OMG Software's outlined-toggle + brand sets switch orange `#FF761F` and charcoal `#151515` + ([ADR-0878](adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md)). + `docs/assets/` holds verbatim copies of its marks: the header logo is the + standalone G knob (`omg-g-knob-orange.svg`), since the guide uses the knob + below about 120 px wide; the favicon is Merovingian's compact knob + (`merovingian-compact.svg`); the home page shows Merovingian's full toggle + (`merovingian-toggle-mark.svg`) and the README its charcoal tile + (`merovingian-icon.svg`). Replace a file with the package's new version + rather than editing it. They are local, so readers make no request elsewhere. ## Complement diff --git a/docs/index.md b/docs/index.md index abd999752..ba669df68 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@
- +

OMG SOFTWARE / MEROVINGIAN

diff --git a/docs/stylesheets/extra.css b/docs/stylesheets/extra.css index c99815058..fffde49e6 100644 --- a/docs/stylesheets/extra.css +++ b/docs/stylesheets/extra.css @@ -1,12 +1,13 @@ -/* The OMG Software theme (ADR-0223): the colours, type and shapes of the - organisation's site, laid over Material for MkDocs. Both schemes keep the - dark OMG header; the dark scheme is the one a first visit opens in. */ +/* The OMG Software theme: the outlined-toggle brand's switch orange (#FF761F) + and charcoal (#151515), with neutral greys between them (ADR-0878), laid + over Material for MkDocs (ADR-0223). Both schemes keep the charcoal header; + the dark scheme is the one a first visit opens in. */ :root { - --omg-orange: #ff8954; - --omg-orange-hover: #ffa170; - --omg-ink: #151616; - --omg-paper: #efeee8; + --omg-orange: #ff761f; + --omg-orange-hover: #ff9149; + --omg-ink: #151515; + --omg-paper: #ffffff; --omg-mono: Consolas, "Courier New", monospace; --omg-sans: Arial, Helvetica, sans-serif; --md-text-font: "Arial"; @@ -14,64 +15,64 @@ } [data-md-color-scheme="slate"] { - --omg-panel: #1b1c1b; - --omg-line: #343632; - --md-hue: 80; - --md-default-bg-color: #151616; - --md-default-bg-color--light: #151616b3; - --md-default-bg-color--lighter: #1516164d; - --md-default-bg-color--lightest: #1516161f; - --md-default-fg-color: #efeee8; - --md-default-fg-color--light: #a6a8a0; - --md-default-fg-color--lighter: #777c73; - --md-default-fg-color--lightest: #343632; - --md-primary-fg-color: #151616; - --md-primary-fg-color--light: #1b1c1b; - --md-primary-fg-color--dark: #101111; - --md-primary-bg-color: #efeee8; - --md-primary-bg-color--light: #a6a8a0; - --md-accent-fg-color: #ff8954; - --md-accent-fg-color--transparent: #ff89541a; - --md-accent-bg-color: #191a17; - --md-typeset-a-color: #ff8954; - --md-typeset-color: #efeee8; - --md-typeset-table-color: #343632; - --md-typeset-table-color--light: #1b1c1b; - --md-code-bg-color: #1b1c1b; - --md-code-fg-color: #e0e0d6; - --md-footer-bg-color: #151616; - --md-footer-bg-color--dark: #101111; - --md-footer-fg-color: #efeee8; - --md-footer-fg-color--light: #a6a8a0; - --md-footer-fg-color--lighter: #777c73; + --omg-panel: #1f1f1f; + --omg-line: #333333; + --md-hue: 23; + --md-default-bg-color: #151515; + --md-default-bg-color--light: #151515b3; + --md-default-bg-color--lighter: #1515154d; + --md-default-bg-color--lightest: #1515151f; + --md-default-fg-color: #ededed; + --md-default-fg-color--light: #a8a8a8; + --md-default-fg-color--lighter: #7a7a7a; + --md-default-fg-color--lightest: #333333; + --md-primary-fg-color: #151515; + --md-primary-fg-color--light: #1f1f1f; + --md-primary-fg-color--dark: #0f0f0f; + --md-primary-bg-color: #ffffff; + --md-primary-bg-color--light: #a8a8a8; + --md-accent-fg-color: #ff761f; + --md-accent-fg-color--transparent: #ff761f1a; + --md-accent-bg-color: #151515; + --md-typeset-a-color: #ff761f; + --md-typeset-color: #ededed; + --md-typeset-table-color: #333333; + --md-typeset-table-color--light: #1f1f1f; + --md-code-bg-color: #1f1f1f; + --md-code-fg-color: #e0e0e0; + --md-footer-bg-color: #151515; + --md-footer-bg-color--dark: #0f0f0f; + --md-footer-fg-color: #ffffff; + --md-footer-fg-color--light: #a8a8a8; + --md-footer-fg-color--lighter: #7a7a7a; } [data-md-color-scheme="default"] { --omg-panel: #e9e8e1; --omg-line: #d6d5cc; --md-default-bg-color: #f4f3ee; - --md-default-fg-color: #151616; + --md-default-fg-color: #151515; --md-default-fg-color--light: #55574f; --md-default-fg-color--lighter: #8a8c83; --md-default-fg-color--lightest: #d6d5cc; - --md-primary-fg-color: #151616; - --md-primary-fg-color--light: #1b1c1b; - --md-primary-fg-color--dark: #101111; - --md-primary-bg-color: #efeee8; - --md-primary-bg-color--light: #a6a8a0; + --md-primary-fg-color: #151515; + --md-primary-fg-color--light: #1f1f1f; + --md-primary-fg-color--dark: #0f0f0f; + --md-primary-bg-color: #ffffff; + --md-primary-bg-color--light: #a8a8a8; --md-accent-fg-color: #8f3a15; --md-accent-fg-color--transparent: #8f3a151a; --md-accent-bg-color: #f4f3ee; --md-typeset-a-color: #a8461c; - --md-typeset-color: #151616; + --md-typeset-color: #151515; --md-typeset-table-color: #d6d5cc; --md-code-bg-color: #e9e8e1; --md-code-fg-color: #2a2b28; - --md-footer-bg-color: #151616; - --md-footer-bg-color--dark: #101111; - --md-footer-fg-color: #efeee8; - --md-footer-fg-color--light: #a6a8a0; - --md-footer-fg-color--lighter: #777c73; + --md-footer-bg-color: #151515; + --md-footer-bg-color--dark: #0f0f0f; + --md-footer-fg-color: #ffffff; + --md-footer-fg-color--light: #a8a8a8; + --md-footer-fg-color--lighter: #7a7a7a; } ::selection { @@ -84,7 +85,7 @@ outline-offset: 3px; } -/* Header and tabs: the OMG site's dark bar with a hairline rule. */ +/* Header and tabs: the charcoal bar with a hairline rule. */ .md-header, .md-tabs { @@ -94,11 +95,11 @@ .md-header { box-shadow: none; - border-bottom: 1px solid #343632; + border-bottom: 1px solid #333333; } .md-tabs { - border-bottom: 1px solid #343632; + border-bottom: 1px solid #333333; } .md-header__topic:first-child { @@ -119,7 +120,7 @@ } .md-footer { - border-top: 1px solid #343632; + border-top: 1px solid #333333; } /* Type: tight, light headings as on the OMG site. */ @@ -166,14 +167,14 @@ .md-typeset .md-button--primary { background-color: var(--omg-orange); border-color: var(--omg-orange); - color: #191a17; + color: var(--omg-ink); } .md-typeset .md-button--primary:focus, .md-typeset .md-button--primary:hover { background-color: var(--omg-orange-hover); border-color: var(--omg-orange-hover); - color: #191a17; + color: var(--omg-ink); } /* Home page hero: the OMG eyebrow label above the strapline. */ @@ -186,10 +187,14 @@ margin-bottom: .25rem; } +/* Merovingian's full toggle. Its square file has wide empty bands above and + below the toggle; the crop keeps about one border-width of clear space round + it, as the brand guide asks. */ .md-typeset .merovingian-mark { display: block; - width: 4.8rem; - height: 4.8rem; + width: 9.6rem; + height: 5.6rem; + object-fit: cover; margin-bottom: 1.2rem; } diff --git a/mkdocs.yml b/mkdocs.yml index 1126a4a6a..0369f1973 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -52,7 +52,7 @@ theme: - content.action.edit # The OMG Software theme: the site opens dark, as the organisation's site # does, whatever the system preference; the toggle offers a light scheme. - # Both take their colours from stylesheets/extra.css (ADR-0223). + # Both take their colours from stylesheets/extra.css (ADR-0223, ADR-0878). palette: - scheme: slate primary: custom @@ -68,8 +68,11 @@ theme: name: Switch to dark mode # System fonts only, so no page view is reported to a font host. font: false - logo: assets/omg-logo.svg - favicon: assets/omg-favicon.svg + # The OMG Software outlined-toggle brand (ADR-0878): the header shows the + # standalone G knob, which the guide uses below about 120 px wide, and the + # browser tab Merovingian's compact knob, its project icon's small size. + logo: assets/omg-g-knob-orange.svg + favicon: assets/merovingian-compact.svg icon: repo: fontawesome/brands/github diff --git a/tests/tooling/test_docs_site.py b/tests/tooling/test_docs_site.py index 8dc5912c3..28fd4477e 100644 --- a/tests/tooling/test_docs_site.py +++ b/tests/tooling/test_docs_site.py @@ -296,31 +296,57 @@ def test_logo_and_favicon_are_inert_svg_files_in_the_site(self) -> None: self.assertTrue(svg.startswith(" None: - # GIVEN the marks published on omg-software.org on 25 October 2026. + def test_site_uses_the_outlined_toggle_brand_marks(self) -> None: + # GIVEN the OMG Software outlined-toggle brand package and its Merovingian project icon (ADR-0878): + # each file's switch-orange shapes, how many there are, and the start of the first outline. + svg = "{http://www.w3.org/2000/svg}" marks = { - "omg-logo.svg": "M32 11 20 4 6 12v16l14 8 14-8v-8H21", - "omg-favicon.svg": "M36 15 24 8 10 16v16l14 8 14-8v-8H25", - "merovingian-logo.svg": "M6 28V12l14 11 14-11v16l-14 8-14-8Z", + # The standalone G knob, for the header logo. + "omg-g-knob-orange.svg": (1, "M1059 369C1140 369 1205 432", None), + # The project's compact knob on a charcoal tile, for the browser tab. + "merovingian-compact.svg": (1, "M64 32A32 32 0 1 1 0 32", "#151515"), + # The project's full toggle, transparent, for the home page. + "merovingian-toggle-mark.svg": (2, "M39 35H89A29 29 0 0 1 89 93H39", None), + # The project's full toggle on a charcoal tile, for the README. + "merovingian-icon.svg": (2, "M39 35H89A29 29 0 0 1 89 93H39", "#151515"), } - for filename, outline in marks.items(): + for filename, (count, outline, tile) in marks.items(): with self.subTest(asset=filename): # WHEN the local image is loaded. - root = ET.parse(DOCS_DIR / "assets" / filename).getroot() - paths = root.findall("{http://www.w3.org/2000/svg}path") - - # THEN it carries the published outline and orange stroke. - self.assertEqual(len(paths), 1) - self.assertEqual(paths[0].get("d"), outline) - self.assertEqual(paths[0].get("stroke"), "#ff8954") - self.assertNotRegex( - (DOCS_DIR / "assets" / filename).read_text(encoding="utf-8"), - r"(?i) None: + # GIVEN the brand palette: switch orange #FF761F and charcoal #151515 (ADR-0878). + # WHEN the stylesheet's own tokens and the dark scheme are read. + dark = scheme_colours(self.stylesheet, "slate") + + # THEN the theme's orange and ink are the brand's, the dark scheme's page, header and links use them, + # and no colour of the earlier OMG theme is left. + self.assertRegex(self.stylesheet, r"--omg-orange:\s*#ff761f;") + self.assertRegex(self.stylesheet, r"--omg-ink:\s*#151515;") + self.assertEqual(dark["--md-default-bg-color"], "#151515") + self.assertEqual(dark["--md-primary-fg-color"], "#151515") + self.assertEqual(dark["--md-typeset-a-color"], "#ff761f") + self.assertNotRegex(self.stylesheet.lower(), r"#ff8954|#151616") def test_text_and_links_are_readable_in_both_schemes(self) -> None: for scheme in ("slate", "default"): From 3a2f18dcbdb193ab478c39d706f4bc8b9c3544f3 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 24 Nov 2026 22:49:12 +0000 Subject: [PATCH 5/8] Keep the brand mark off the README, which is packaged on its own The README is copied without docs/assets/ into the CI artifacts and the RPM, BSD and static packages, so its new docs/assets/merovingian-icon.svg image showed as broken there. Staging the SVG beside every copy is packaging churn for a decoration, so the README shows no mark and its first line still links to the branded site. The unused SVG is removed, ADR-0878 says why, and test_docs_site.py fails on any README image by a relative path. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- README.md | 2 -- ...-takes-the-outlined-toggle-brand-colours-and-marks.md | 9 +++++---- docs/assets/merovingian-icon.svg | 6 ------ docs/dev-environment.md | 4 ++-- tests/tooling/test_docs_site.py | 8 ++++---- 6 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 docs/assets/merovingian-icon.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a59a1350..b154ec5cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,7 +54,7 @@ Changes before 1.0.0 are in [CHANGELOG-pre-release.md](CHANGELOG-pre-release.md) unavailable (error) and no TURN configured (debug), with the user ID and never a credential (ADR-0871). * Tests set a log module's level through one shared helper, `tests/support/ModuleLogLevel.hpp`, instead of a copy per file; the security coding rules state the TURN logging rule and why the username is withheld. -* The documentation site and README use OMG Software's outlined-toggle brand: switch orange and charcoal, the G knob, +* The documentation site uses OMG Software's outlined-toggle brand: switch orange and charcoal, the G knob, and Merovingian's project icon, copied unchanged from the brand package (ADR-0878). ## Security Fixes diff --git a/README.md b/README.md index 47cd3d26e..1541b9b07 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -Merovingian icon - # Merovingian **Latest release: [latest](https://github.com/OMG-Software/Merovingian/releases/tag/latest)** · **Documentation: [omg-software.github.io/Merovingian](https://omg-software.github.io/Merovingian/)** diff --git a/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md b/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md index 50a7060da..b3bd6e7f2 100644 --- a/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md +++ b/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md @@ -11,8 +11,7 @@ mark and the `#ff8954` orange the documentation site took from the organisation The brand package sets two colours, switch orange `#FF761F` and charcoal `#151515`, a full toggle mark, a standalone G knob for small sizes, and a project icon for each repository: Merovingian's is the toggle with a server stack cut out of its knob. Its guide keeps about one border-width of clear space round the toggle and uses the knob below about 120 px -wide; the project icons use their compact knob at 32 px and below. How should the documentation site and the README -take them on? +wide; the project icons use their compact knob at 32 px and below. How should the documentation site take them on? ## Decision Drivers @@ -36,8 +35,10 @@ Chosen option: 1. * The header logo, about 24 px high, is the standalone G knob (`omg-g-knob-orange.svg`): the full toggle there would be about 50 px wide, well under the guide's 120 px. The favicon is Merovingian's compact knob (`merovingian-compact.svg`), the project icon's design for 32 px and below. The home page shows Merovingian's full - toggle (`merovingian-toggle-mark.svg`), cropped to keep about one border-width of clear space, and the README the - same toggle on its charcoal tile (`merovingian-icon.svg`), which reads on GitHub's light and dark themes alike. + toggle (`merovingian-toggle-mark.svg`), cropped to keep about one border-width of clear space. +* The README shows no mark. It is shipped on its own, in the CI artifacts, the RPM, BSD and static packages, where an + image path into `docs/assets/` would show as a broken image, and staging the SVG beside every copy is packaging + churn for a decoration. Its first line links to the site. * The files are byte-for-byte the package's, line endings aside; a new version of the package replaces them, and none is edited by hand. `tests/tooling/test_docs_site.py` checks their outlines and colours and that none can run or fetch anything. diff --git a/docs/assets/merovingian-icon.svg b/docs/assets/merovingian-icon.svg deleted file mode 100644 index 130e92bd6..000000000 --- a/docs/assets/merovingian-icon.svg +++ /dev/null @@ -1,6 +0,0 @@ - - Merovingian icon - - - - diff --git a/docs/dev-environment.md b/docs/dev-environment.md index 490e9b968..2a695c33e 100644 --- a/docs/dev-environment.md +++ b/docs/dev-environment.md @@ -549,8 +549,8 @@ What the site expects of each branch: standalone G knob (`omg-g-knob-orange.svg`), since the guide uses the knob below about 120 px wide; the favicon is Merovingian's compact knob (`merovingian-compact.svg`); the home page shows Merovingian's full toggle - (`merovingian-toggle-mark.svg`) and the README its charcoal tile - (`merovingian-icon.svg`). Replace a file with the package's new version + (`merovingian-toggle-mark.svg`). The README shows no mark, since it is + packaged without `docs/assets/`. Replace a file with the package's new version rather than editing it. They are local, so readers make no request elsewhere. ## Complement diff --git a/tests/tooling/test_docs_site.py b/tests/tooling/test_docs_site.py index 28fd4477e..de23be9a7 100644 --- a/tests/tooling/test_docs_site.py +++ b/tests/tooling/test_docs_site.py @@ -307,8 +307,6 @@ def test_site_uses_the_outlined_toggle_brand_marks(self) -> None: "merovingian-compact.svg": (1, "M64 32A32 32 0 1 1 0 32", "#151515"), # The project's full toggle, transparent, for the home page. "merovingian-toggle-mark.svg": (2, "M39 35H89A29 29 0 0 1 89 93H39", None), - # The project's full toggle on a charcoal tile, for the README. - "merovingian-icon.svg": (2, "M39 35H89A29 29 0 0 1 89 93H39", "#151515"), } for filename, (count, outline, tile) in marks.items(): with self.subTest(asset=filename): @@ -326,13 +324,15 @@ def test_site_uses_the_outlined_toggle_brand_marks(self) -> None: self.assertEqual([rect.get("fill") for rect in tiles], [tile] if tile else []) self.assertNotRegex(text, r"(?i)]*\ssrc=\"(?!https://)") + self.assertNotRegex(readme, r"!\[[^\]]*\]\((?!https://)") def test_the_theme_uses_the_brand_orange_and_charcoal(self) -> None: # GIVEN the brand palette: switch orange #FF761F and charcoal #151515 (ADR-0878). From 184276d487a9ae242816c4c6afd4202cefeafc16 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 24 Nov 2026 22:57:25 +0000 Subject: [PATCH 6/8] Correct two brand notes: where the README links the site, and line endings ADR-0878 said the README's first line links to the site; the link is in its opening lines, after the heading. The changelog said the marks were copied unchanged, while the ADR says only their line endings changed. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 2 +- ...ntation-takes-the-outlined-toggle-brand-colours-and-marks.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b154ec5cf..dba9254cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,7 +55,7 @@ Changes before 1.0.0 are in [CHANGELOG-pre-release.md](CHANGELOG-pre-release.md) * Tests set a log module's level through one shared helper, `tests/support/ModuleLogLevel.hpp`, instead of a copy per file; the security coding rules state the TURN logging rule and why the username is withheld. * The documentation site uses OMG Software's outlined-toggle brand: switch orange and charcoal, the G knob, - and Merovingian's project icon, copied unchanged from the brand package (ADR-0878). + and Merovingian's project icon, copied from the brand package with only line endings changed (ADR-0878). ## Security Fixes diff --git a/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md b/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md index b3bd6e7f2..13bef0fcd 100644 --- a/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md +++ b/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md @@ -38,7 +38,7 @@ Chosen option: 1. toggle (`merovingian-toggle-mark.svg`), cropped to keep about one border-width of clear space. * The README shows no mark. It is shipped on its own, in the CI artifacts, the RPM, BSD and static packages, where an image path into `docs/assets/` would show as a broken image, and staging the SVG beside every copy is packaging - churn for a decoration. Its first line links to the site. + churn for a decoration. Its opening lines link to the site. * The files are byte-for-byte the package's, line endings aside; a new version of the package replaces them, and none is edited by hand. `tests/tooling/test_docs_site.py` checks their outlines and colours and that none can run or fetch anything. From dc054b72d423e40569d37c5dc04c277f64ba449d Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 24 Nov 2026 23:04:59 +0000 Subject: [PATCH 7/8] Drop the failure report from the job that runs no meson test ubuntu-hardened-listener-coverage builds with --no-tests and runs its Catch2 binary in its own step, so it never writes testlog.txt and its report could only print that the build failed, which was wrong. The step is gone, a workflow test fails on a report in any --no-tests job, and the script's no-log message no longer says the build failed. ADR-0878 now says the brand files differ from the package only in their CRLF line endings, made LF as .gitattributes requires, which is what the changelog says. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 5 ----- ...-print-each-failed-test-not-a-tail-of-the-log.md | 4 +++- ...s-the-outlined-toggle-brand-colours-and-marks.md | 6 +++--- scripts/catch2-failure-report.sh | 2 +- tests/tooling/test_catch2_failure_report.py | 13 +++++++++++++ 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f217b4c3..1d58ebffa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -316,11 +316,6 @@ jobs: ./build-hardened/tests/merovingian-integration-tests \ "[startup][binary]" --success - - name: Catch2 failure report (runtime logs filtered out) - if: failure() - run: | - sh scripts/catch2-failure-report.sh build-hardened/meson-logs/testlog.txt - # -- Fedora / Red Hat family ----------------------------------------------- fedora-suite: needs: queue-after-analyses diff --git a/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md b/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md index 5ec830e10..a0e1544da 100644 --- a/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md +++ b/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md @@ -35,7 +35,9 @@ which were runtime logging. How should a failure report find the failed assertio ## Decision Outcome Chosen option: 1, run by every report step: `ci.yml`'s Linux and BSD jobs, `coverage.yml`, and both jobs of -`sanitizers.yml` (`tsan` had no report step). NetBSD passes `--exclude '^\[netbsd-diag\]'`. +`sanitizers.yml` (`tsan` had no report step). NetBSD passes `--exclude '^\[netbsd-diag\]'`. A job that builds with +`--no-tests` (`ubuntu-hardened-listener-coverage`) runs its Catch2 binary in its own step, whose log shows any failure, +and has no report step: it writes no `testlog.txt`. * A tail of any length can lose a failure: the number of lines after it depends on what finished later, which changes with the platform, the sanitizer and the scheduling. diff --git a/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md b/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md index 13bef0fcd..3c3123498 100644 --- a/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md +++ b/docs/adr/0878-the-documentation-takes-the-outlined-toggle-brand-colours-and-marks.md @@ -39,9 +39,9 @@ Chosen option: 1. * The README shows no mark. It is shipped on its own, in the CI artifacts, the RPM, BSD and static packages, where an image path into `docs/assets/` would show as a broken image, and staging the SVG beside every copy is packaging churn for a decoration. Its opening lines link to the site. -* The files are byte-for-byte the package's, line endings aside; a new version of the package replaces them, and none - is edited by hand. `tests/tooling/test_docs_site.py` checks their outlines and colours and that none can run or - fetch anything. +* The files are byte-for-byte the package's, except that the package's CRLF line endings are LF here, as + `.gitattributes` requires; a new version of the package replaces them, and none is edited by hand. + `tests/tooling/test_docs_site.py` checks their outlines and colours and that none can run or fetch anything. * `--omg-orange` is `#ff761f` and `--omg-ink` `#151515`; the dark scheme's page, header, footer, links and accent use them. The greys between them are neutral (`#1f1f1f` panels, `#333333` rules), as charcoal is, where the earlier theme's were tinted. diff --git a/scripts/catch2-failure-report.sh b/scripts/catch2-failure-report.sh index d4a3403df..9cd60ecbf 100755 --- a/scripts/catch2-failure-report.sh +++ b/scripts/catch2-failure-report.sh @@ -73,7 +73,7 @@ if [ "$total_lines" -lt 20 ]; then fi if [ ! -f "$testlog" ]; then - printf 'No test log at %s: the build failed before any test ran.\n' "$testlog" + printf 'No test log at %s: meson test did not run, so read the failed step above.\n' "$testlog" exit 0 fi diff --git a/tests/tooling/test_catch2_failure_report.py b/tests/tooling/test_catch2_failure_report.py index 5f6b1a8c5..33ab73e13 100755 --- a/tests/tooling/test_catch2_failure_report.py +++ b/tests/tooling/test_catch2_failure_report.py @@ -252,6 +252,19 @@ def test_every_catch2_failure_report_uses_the_script_and_none_tails_the_whole_lo self.assertNotIn("tail -n", match.group(1), workflow.name) self.assertGreaterEqual(reports, 12) + def test_a_job_that_runs_no_meson_test_has_no_failure_report(self) -> None: + # GIVEN every job of every workflow + for workflow in sorted(WORKFLOWS.glob("*.yml")): + text = workflow.read_text(encoding="utf-8") + jobs = re.split(r"\n (?=[\w-]+:\n)", text.split("\njobs:\n", 1)[-1]) + for job in jobs: + # WHEN the job builds with --no-tests, so meson test never writes its testlog.txt + if "--no-tests" not in job: + continue + # THEN it has no Catch2 failure report, which would only say there is no log + with self.subTest(workflow=workflow.name, job=job.split(":", 1)[0]): + self.assertNotIn("catch2-failure-report.sh", job) + def test_both_sanitizer_jobs_report_their_failures(self) -> None: workflow = (WORKFLOWS / "sanitizers.yml").read_text(encoding="utf-8") self.assertIn("sh scripts/catch2-failure-report.sh build/meson-logs/testlog.txt", workflow) From cfc947ecc7d027bae2cfc17e28e811a5c7756119 Mon Sep 17 00:00:00 2001 From: James Chapman Date: Tue, 24 Nov 2026 23:16:44 +0000 Subject: [PATCH 8/8] Test that every job with a failure report runs meson test The workflow test forbade a report in any job that builds with --no-tests, but such a job may still run meson test in a later step and write testlog.txt. It now requires each job with a report to run meson test, through a build script called without --no-tests or directly, which still flags the step removed from the hardened-listener job. Co-Authored-By: Claude Opus 5.5 --- ...-print-each-failed-test-not-a-tail-of-the-log.md | 6 +++--- tests/tooling/test_catch2_failure_report.py | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md b/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md index a0e1544da..60f741f47 100644 --- a/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md +++ b/docs/adr/0877-ci-failure-reports-print-each-failed-test-not-a-tail-of-the-log.md @@ -35,9 +35,9 @@ which were runtime logging. How should a failure report find the failed assertio ## Decision Outcome Chosen option: 1, run by every report step: `ci.yml`'s Linux and BSD jobs, `coverage.yml`, and both jobs of -`sanitizers.yml` (`tsan` had no report step). NetBSD passes `--exclude '^\[netbsd-diag\]'`. A job that builds with -`--no-tests` (`ubuntu-hardened-listener-coverage`) runs its Catch2 binary in its own step, whose log shows any failure, -and has no report step: it writes no `testlog.txt`. +`sanitizers.yml` (`tsan` had no report step). NetBSD passes `--exclude '^\[netbsd-diag\]'`. A job that never runs +`meson test` writes no `testlog.txt` and has no report step: `ubuntu-hardened-listener-coverage` builds with +`--no-tests` and runs its Catch2 binary in its own step, whose log shows any failure. * A tail of any length can lose a failure: the number of lines after it depends on what finished later, which changes with the platform, the sanitizer and the scheduling. diff --git a/tests/tooling/test_catch2_failure_report.py b/tests/tooling/test_catch2_failure_report.py index 33ab73e13..83059fc10 100755 --- a/tests/tooling/test_catch2_failure_report.py +++ b/tests/tooling/test_catch2_failure_report.py @@ -252,18 +252,21 @@ def test_every_catch2_failure_report_uses_the_script_and_none_tails_the_whole_lo self.assertNotIn("tail -n", match.group(1), workflow.name) self.assertGreaterEqual(reports, 12) - def test_a_job_that_runs_no_meson_test_has_no_failure_report(self) -> None: + def test_every_job_with_a_failure_report_runs_meson_test(self) -> None: + # A build script runs meson test unless it is given --no-tests; any step may also run it itself. + runs_tests = re.compile(r"scripts/build-(?:linux|bsd)\.sh(?![^\n]*--no-tests)|\bmeson test\b") # GIVEN every job of every workflow for workflow in sorted(WORKFLOWS.glob("*.yml")): text = workflow.read_text(encoding="utf-8") jobs = re.split(r"\n (?=[\w-]+:\n)", text.split("\njobs:\n", 1)[-1]) for job in jobs: - # WHEN the job builds with --no-tests, so meson test never writes its testlog.txt - if "--no-tests" not in job: + # WHEN the job has a Catch2 failure report + if "catch2-failure-report.sh" not in job: continue - # THEN it has no Catch2 failure report, which would only say there is no log + # THEN some step of it runs meson test, which writes the testlog.txt the report reads; without + # one, the report could only say there is no log with self.subTest(workflow=workflow.name, job=job.split(":", 1)[0]): - self.assertNotIn("catch2-failure-report.sh", job) + self.assertRegex(job, runs_tests) def test_both_sanitizer_jobs_report_their_failures(self) -> None: workflow = (WORKFLOWS / "sanitizers.yml").read_text(encoding="utf-8")