Skip to main content

max / makenotwork

Add a script to run the server suite on astra
Author: Max Johnson <me@maxj.phd> · 2026-08-12 14:02 UTC
Signed with PGP, not checked
Commit: f6fdde0b7d5184a244824f86b68020c3f068203a
Parent: 6ac794c
3 files changed, +192 insertions, -7 deletions
@@ -10683,11 +10683,11 @@
10683 10683 ]
10684 10684
10685 10685 [[patch.unused]]
10686 - name = "quasi-store"
10686 + name = "kberg"
10687 10687 version = "0.1.0"
10688 10688
10689 10689 [[patch.unused]]
10690 - name = "quasi-tauri"
10690 + name = "painhours"
10691 10691 version = "0.1.0"
10692 10692
10693 10693 [[patch.unused]]
@@ -10699,9 +10699,9 @@
10699 10699 version = "0.2.0"
10700 10700
10701 10701 [[patch.unused]]
10702 - name = "kberg"
10702 + name = "quasi-store"
10703 10703 version = "0.1.0"
10704 10704
10705 10705 [[patch.unused]]
10706 - name = "painhours"
10706 + name = "quasi-tauri"
10707 10707 version = "0.1.0"
@@ -177,9 +177,6 @@
177 177 [[package]]
178 178 name = "subst"
179 179 version = "0.1.0"
180 - dependencies = [
181 - "regex-lite",
182 - ]
183 180
184 181 [[package]]
185 182 name = "syn"
@@ -270,3 +267,51 @@
270 267 version = "1.0.4"
271 268 source = "registry+https://github.com/rust-lang/crates.io-index"
272 269 checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
270 +
271 + [[patch.unused]]
272 + name = "docengine"
273 + version = "0.5.0"
274 +
275 + [[patch.unused]]
276 + name = "kberg"
277 + version = "0.1.0"
278 +
279 + [[patch.unused]]
280 + name = "painhours"
281 + version = "0.1.0"
282 +
283 + [[patch.unused]]
284 + name = "tagtree"
285 + version = "0.4.0"
286 +
287 + [[patch.unused]]
288 + name = "synckit-client"
289 + version = "0.8.0"
290 +
291 + [[patch.unused]]
292 + name = "synckit-config"
293 + version = "0.2.0"
294 +
295 + [[patch.unused]]
296 + name = "quasi-axum"
297 + version = "0.1.0"
298 +
299 + [[patch.unused]]
300 + name = "quasi-http"
301 + version = "0.1.0"
302 +
303 + [[patch.unused]]
304 + name = "quasi-router"
305 + version = "0.1.0"
306 +
307 + [[patch.unused]]
308 + name = "quasi-store"
309 + version = "0.1.0"
310 +
311 + [[patch.unused]]
312 + name = "quasi-tauri"
313 + version = "0.1.0"
314 +
315 + [[patch.unused]]
316 + name = "quasi-webview"
317 + version = "0.1.0"
@@ -1,0 +1,140 @@
1 + #!/bin/bash
2 + # Run the server's expensive suites on astra instead of on fw13.
3 + #
4 + # fw13 is 12 cores against 14 GB, and `~/Code/.cargo/config.toml` caps cargo at
5 + # `jobs = 6` because a heavy crate costs rustc ~3 GB and the box swaps rather
6 + # than compiles above that. astra is 96 cores and 125 GB, usually idle outside
7 + # the 03:20 sweep. The server's integration suite is the one workload where that
8 + # difference is worth a round trip: ~1,340 tests and a build of the largest crate
9 + # in the tree.
10 + #
11 + # **This is for the expensive runs only.** A filtered local run beats this every
12 + # time: `cargo test --test integration described_screens` answers in seconds,
13 + # where anything here pays a sync plus a build. Reach for this when the question
14 + # is "is the whole suite green", not "did my change work".
15 + #
16 + # WHAT IT SYNCS, AND WHY IT IS NOT JUST THE SERVER. The point of the script is
17 + # testing work that is *not committed yet* -- astra's own checkout only ever has
18 + # what has been pushed, which is exactly what made it useless for a day of
19 + # editing quasi and the server together. So it rsyncs the working trees, and it
20 + # has to send every repo the local `[patch]` block redirects, or astra silently
21 + # builds the published quasi against your edited server and reports green on a
22 + # combination that does not exist. That is worse than no script.
23 + #
24 + # CAVEAT THAT DOES NOT GO AWAY: astra is aarch64. Green here is not green on
25 + # x86_64. It catches logic, not size, alignment or intrinsics assumptions.
26 + #
27 + # Usage:
28 + # scripts/test-on-astra.sh # the integration suite
29 + # scripts/test-on-astra.sh --lib # or any cargo test args
30 + # scripts/test-on-astra.sh --test integration described_screens
31 + #
32 + # Environment:
33 + # ASTRA_HOST ssh host (default: astra)
34 + # ASTRA_DIR remote directory, under $HOME (default: mnw-test)
35 + # ASTRA_THREADS test threads (default: 16, see the note below)
36 +
37 + set -u
38 + set -o pipefail
39 +
40 + HOST="${ASTRA_HOST:-astra}"
41 + DEST="${ASTRA_DIR:-mnw-test}"
42 + # Postgres, not cores, is what bounds this suite: every test takes a
43 + # `CREATE DATABASE ... TEMPLATE` clone, and astra's cluster is one instance like
44 + # any other. Memory note `reference_astra_tests` records ~9/734 workflow tests
45 + # hitting "connection slots reserved for SUPERUSER" under an unbounded run. So
46 + # this is deliberately nowhere near 96, and raising it trades wall-clock for
47 + # flakes that look like real failures.
48 + THREADS="${ASTRA_THREADS:-16}"
49 +
50 + ROOT="$(cd "$(dirname "$0")/../.." && pwd)" # ~/Code/MNW
51 + CODE="$(cd "$ROOT/.." && pwd)" # ~/Code
52 + CARGO_CONFIG="$CODE/.cargo/config.toml"
53 +
54 + # Every repo that has to travel. MNW carries the server and the `shared/*` path
55 + # dependencies; the rest are what `[patch]` redirects. Keep in step with
56 + # `$CARGO_CONFIG` -- the check below fails the run if they drift.
57 + REPOS=(MNW quasi synckit Libraries/docengine)
58 +
59 + say() { printf '%s\n' "$*" >&2; }
60 + die() { say "test-on-astra: $*"; exit 1; }
61 +
62 + [ -f "$CARGO_CONFIG" ] || die "no $CARGO_CONFIG; nothing says where the siblings are"
63 +
64 + # Drift guard. A `[patch]` entry pointing outside the synced set would build on
65 + # astra from the published crate instead of the working tree, and the run would
66 + # be green about code nobody has.
67 + missing=""
68 + while read -r patched; do
69 + covered=""
70 + for repo in "${REPOS[@]}"; do
71 + case "$patched" in "$repo"/*|"$repo") covered=1; break;; esac
72 + done
73 + [ -n "$covered" ] || missing="$missing $patched"
74 + done < <(grep -oP '(?<=path = ")[^"]+' "$CARGO_CONFIG" | sort -u)
75 + [ -z "$missing" ] || die "these patched paths are not in REPOS:$missing"
76 +
77 + say "test-on-astra: syncing to $HOST:~/$DEST"
78 + for repo in "${REPOS[@]}"; do
79 + [ -d "$CODE/$repo" ] || die "$CODE/$repo does not exist"
80 + ssh "$HOST" "mkdir -p ~/$DEST/$(dirname "$repo")" || die "cannot reach $HOST"
81 + # --delete so a file removed locally is removed there; without it a deleted
82 + # test keeps passing on astra forever. target/ and .git are excluded and
83 + # therefore untouched by it, which is what keeps the remote build
84 + # incremental across runs.
85 + # `mutants.out/` is 218 MB of cargo-mutants detritus in synckit-client alone,
86 + # which is twice everything else here put together.
87 + rsync -a --delete \
88 + --exclude 'target/' --exclude '.git/' --exclude 'node_modules/' \
89 + --exclude 'mutants.out/' \
90 + "$CODE/$repo/" "$HOST:$DEST/$repo/" \
91 + || die "rsync of $repo failed"
92 + done
93 +
94 + # The patch block, verbatim, because its paths are relative to the config file's
95 + # own parent and the layout above mirrors ~/Code exactly. `[build]` and
96 + # `[profile.*]` are dropped: `jobs = 6` is a statement about fw13's 14 GB and
97 + # would leave 90 of astra's cores idle.
98 + awk '
99 + /^\[/ { keep = ($0 !~ /^\[build\]/ && $0 !~ /^\[profile/) }
100 + keep { print }
101 + ' "$CARGO_CONFIG" | ssh "$HOST" "mkdir -p ~/$DEST/.cargo && cat > ~/$DEST/.cargo/config.toml" \
102 + || die "could not write the remote cargo config"
103 +
104 + # `--features fast-tests` is not an optimisation to argue about: it swaps argon2
105 + # from production parameters (46 MiB, 2 iterations, ~600ms) to test ones (8 MiB,
106 + # 1 iteration, ~10ms), and the suite performs ~874 hashes between signup, login
107 + # and admin setup. That is ~9 CPU-minutes of key derivation proving nothing. It
108 + # is the only thing the feature gates; see the note on `hash_password`.
109 + ARGS=("$@")
110 + [ ${#ARGS[@]} -gt 0 ] || ARGS=(--test integration)
111 +
112 + say "test-on-astra: building and running ($THREADS threads, aarch64)"
113 + ssh "$HOST" bash -s -- "$DEST" "$THREADS" "${ARGS[@]}" <<'REMOTE'
114 + set -u
115 + DEST="$1"; shift
116 + THREADS="$1"; shift
117 +
118 + cd "$HOME/$DEST/MNW/server" || exit 1
119 + # rustup's toolchain, not the distro's: /usr/bin/rustc is older than the
120 + # dependency tree's floor and fails with a resolver error that names a crate
121 + # rather than the compiler.
122 + export PATH="$HOME/.cargo/bin:$PATH"
123 + # The default 1024 is exhausted by the per-test database pool.
124 + ulimit -n 65536
125 + # Socket form, no host: astra's postgres has no TCP listener, and the harness's
126 + # `replace_db_name` splits on the last `/`, so a `?host=` query string is
127 + # mangled rather than honoured.
128 + export TEST_DATABASE_URL=postgres:///postgres
129 + # Verify against the committed `.sqlx` metadata rather than a live database.
130 + # astra's `makenotwork` has drifted from the schema in the tree, and pointing
131 + # the compile-time macros at it fails the build with errors that read like code
132 + # faults. Drift in the metadata is itself a finding.
133 + export SQLX_OFFLINE=true
134 +
135 + started=$(date +%s)
136 + cargo test --features fast-tests "$@" -- --test-threads="$THREADS"
137 + status=$?
138 + echo "test-on-astra: $(( $(date +%s) - started ))s wall on astra, aarch64" >&2
139 + exit $status
140 + REMOTE