From 89c8a2e9299b9775fdd2b47384940add92f42409 Mon Sep 17 00:00:00 2001 From: Niels Mokkenstorm Date: Tue, 4 Aug 2026 09:49:18 +0200 Subject: [PATCH] ci: pin the gleam toolchain so the formatter check stops drifting --- .tangled/workflows/deploy-microvm.yml | 19 ++++++++++++++++--- .tangled/workflows/deps-canary.yml | 5 +++++ .tangled/workflows/test-postgres.yml | 12 +++++++++--- .tangled/workflows/test.yml | 20 +++++++++++++++++--- server/test/edit_inbox_apply_test.gleam | 4 +--- 5 files changed, 48 insertions(+), 12 deletions(-) diff --git a/.tangled/workflows/deploy-microvm.yml b/.tangled/workflows/deploy-microvm.yml index 057fb36..4e7c960 100644 --- a/.tangled/workflows/deploy-microvm.yml +++ b/.tangled/workflows/deploy-microvm.yml @@ -17,14 +17,20 @@ image: nixos registry: nixpkgs: github:nixos/nixpkgs/nixos-unstable + gleam-pin: github:nixos/nixpkgs/243895692ae2a2fbd08a05141462c0cc0d3ca10f virtualisation: docker: true -# Same reasoning as test.yml/test-postgres.yml's dependency list: the pinned -# nixpkgs release's gleam is too old for our deps and formatter. +# nixpkgs: same reasoning as test.yml/test-postgres.yml's floating packages, +# the pinned nixos release's tools are too old for our deps. +# +# gleam-pin: pinned to a revision, not a channel. The formatter's output +# changes between gleam releases, so a floating channel turns +# `gleam format --check` red with no commit to blame (1.17 -> 1.18 did exactly +# that). This rev is gleam 1.18.0; bump it and reformat in one commit. dependencies: - - gleam + - gleam-pin#gleam - erlang - rebar3 - nodejs @@ -39,6 +45,13 @@ steps: nproc test -e /dev/kvm && echo "kvm: present" || echo "kvm: absent" + # Finished runs keep no logs, so a silent toolchain drift is expensive to + # diagnose after the fact; fail loudly and early instead. + - name: assert toolchain matches the pin + command: | + gleam --version + test "$(gleam --version)" = "gleam 1.18.0" || { echo "gleam is not 1.18.0: the nixpkgs pin moved, so formatting may disagree; repin or reformat" >&2; exit 1; } + # Tests gate the push below: if any of these fail, the pipeline stops # here and no image is ever built or pushed, so a red build can never # reach ghcr.io/latest and the droplet never rolls onto it. diff --git a/.tangled/workflows/deps-canary.yml b/.tangled/workflows/deps-canary.yml index ab96bbf..577784b 100644 --- a/.tangled/workflows/deps-canary.yml +++ b/.tangled/workflows/deps-canary.yml @@ -12,6 +12,11 @@ engine: nixery # whenever the newest allowed atproto_client/atproto_codegen pair regresses, # and that must never block the real test pipeline. # +# nixpkgs-unstable stays floating here on purpose, unlike test.yml/ +# test-postgres.yml/deploy-microvm.yml's pinned gleam: this workflow exists to +# canary upstream drift (gleam and dep versions both), so pinning it would +# defeat its own point. +# # gnused/gnugrep: the nixery image is minimal (no implicit coreutils-adjacent # toolset beyond what's listed here), and scripts/deps-canary.sh shells out to # both `sed -i` (pinning-widen edits) and `grep` (assert_widened, the resolved diff --git a/.tangled/workflows/test-postgres.yml b/.tangled/workflows/test-postgres.yml index 4fd9e5e..fd23987 100644 --- a/.tangled/workflows/test-postgres.yml +++ b/.tangled/workflows/test-postgres.yml @@ -14,13 +14,19 @@ when: engine: microvm image: nixos -# Same reasoning as test.yml's nixery dependencies: the pinned nixos release's -# gleam is too old for our deps and formatter. +# nixpkgs: same reasoning as test.yml's floating packages, the pinned nixos +# release's tools are too old for our deps. +# +# gleam-pin: pinned to a revision, not a channel. The formatter's output +# changes between gleam releases, so a floating channel turns +# `gleam format --check` red with no commit to blame (1.17 -> 1.18 did exactly +# that). This rev is gleam 1.18.0; bump it and reformat in one commit. registry: nixpkgs: github:nixos/nixpkgs/nixos-unstable + gleam-pin: github:nixos/nixpkgs/243895692ae2a2fbd08a05141462c0cc0d3ca10f dependencies: - - gleam + - gleam-pin#gleam - erlang - rebar3 - nodejs diff --git a/.tangled/workflows/test.yml b/.tangled/workflows/test.yml index dac43ac..63a2f96 100644 --- a/.tangled/workflows/test.yml +++ b/.tangled/workflows/test.yml @@ -5,12 +5,19 @@ when: engine: nixery -# nixpkgs-unstable: default nixpkgs gleam is 1.13, too old for our deps and its -# formatter. bun is needed because gleam.toml sets tools.lustre.bin.bun=system. +# gleam is pinned to a revision, not a channel: the formatter's output changes +# between gleam releases, so a floating channel turns `gleam format --check` +# red with no commit to blame (1.17 -> 1.18 did exactly that). This rev is +# gleam 1.18.0; bump it and reformat in one commit. +# +# Everything else stays on nixpkgs-unstable: default nixpkgs gleam is 1.13, +# too old for our deps, but these packages don't share gleam's formatter-drift +# problem. bun is needed because gleam.toml sets tools.lustre.bin.bun=system. # git is needed by `make lexicon-check`, which diffs lexicons/ against origin/main. dependencies: - nixpkgs/nixpkgs-unstable: + nixpkgs/243895692ae2a2fbd08a05141462c0cc0d3ca10f: - gleam + nixpkgs/nixpkgs-unstable: - erlang - rebar3 - nodejs @@ -19,6 +26,13 @@ dependencies: - git steps: + # Finished runs keep no logs, so a silent toolchain drift is expensive to + # diagnose after the fact; fail loudly and early instead. + - name: assert toolchain matches the pin + command: | + gleam --version + test "$(gleam --version)" = "gleam 1.18.0" || { echo "gleam is not 1.18.0: the nixpkgs pin moved, so formatting may disagree; repin or reformat" >&2; exit 1; } + - name: generate codecs + check formatting command: | make gen diff --git a/server/test/edit_inbox_apply_test.gleam b/server/test/edit_inbox_apply_test.gleam index 25804e3..7e8d662 100644 --- a/server/test/edit_inbox_apply_test.gleam +++ b/server/test/edit_inbox_apply_test.gleam @@ -226,9 +226,7 @@ fn deps_with_edit( ) -> Deps { Deps( backlinks: fn(_, _) { panic as "backlinks must not be called by apply" }, - fetch_release: fn(_) { - panic as "fetch_release must not be called by apply" - }, + fetch_release: fn(_) { panic as "fetch_release must not be called by apply" }, fetch_edit: fn(requested) { case requested == uri { True -> Some(#(cid, edit)) -- 2.51.2