Gate first-run setup as one lifecycle

This commit is contained in:
David Heinemeier Hansson
2026-07-17 07:59:16 -07:00
parent 39756d485d
commit 09aac40eae
6 changed files with 78 additions and 65 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
source "$(dirname "$0")/base-test.sh"
test_tmp=$(mktemp -d)
trap 'rm -rf "$test_tmp"' EXIT
mock_bin="$test_tmp/bin"
mkdir -p "$mock_bin" "$test_tmp/home"
cat >"$mock_bin/omarchy-done" <<'SH'
#!/bin/bash
[[ $1 == "check" && $2 == "first-run-user" ]]
SH
cat >"$mock_bin/omarchy-finalize-user" <<'SH'
#!/bin/bash
touch "$OMARCHY_TEST_FINALIZE_CALLED"
SH
chmod +x "$mock_bin/omarchy-done" "$mock_bin/omarchy-finalize-user"
finalize_called="$test_tmp/finalize-called"
HOME="$test_tmp/home" PATH="$mock_bin:$PATH" OMARCHY_TEST_FINALIZE_CALLED="$finalize_called" \
bash "$ROOT/bin/omarchy-first-run" >"$test_tmp/output"
[[ ! -e $finalize_called ]] || fail "completed first-run exits before any setup step"
grep -F 'First-run already complete' "$test_tmp/output" >/dev/null || fail "completed first-run reports its lifecycle gate"
if grep -F 'user-migration-notify-watch-enabled' "$ROOT/bin/omarchy-first-run" >/dev/null; then
fail "first-run does not track the migration watcher separately"
fi
if grep -F 'skip-first-run-update-notification' "$ROOT/install/user/first-run/wifi.sh" >/dev/null; then
fail "first-run does not track update notifications separately"
fi
pass "first-run uses one lifecycle completion marker"
+5 -6
View File
@@ -5,7 +5,6 @@ set -euo pipefail
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
upgrade_to_quattro="$ROOT/bin/omarchy-upgrade-to-quattro"
first_run_wifi="$ROOT/install/user/first-run/wifi.sh"
snapshot_line=$(grep -n '^create_pre_upgrade_snapshot$' "$upgrade_to_quattro" | cut -d: -f1)
pacman_line=$(grep -n '^configure_pacman_channel$' "$upgrade_to_quattro" | cut -d: -f1)
@@ -27,16 +26,16 @@ grep -F 'dust' "$upgrade_to_quattro" >/dev/null
grep -F 'satty' "$upgrade_to_quattro" >/dev/null
pass "Omarchy 4 upgrade applies packaged migrations"
grep -F 'skip-first-run-update-notification' "$upgrade_to_quattro" >/dev/null
grep -F 'skip-first-run-update-notification' "$first_run_wifi" >/dev/null
grep -F '(( skip_update_notification )) && return 0' "$first_run_wifi" >/dev/null
pass "Omarchy 4 upgrade suppresses the fresh-install update toast"
if grep -F 'skip-first-run-update-notification' "$upgrade_to_quattro" >/dev/null; then
fail "Omarchy 4 upgrade does not use notification-specific first-run state"
fi
pass "Omarchy 4 upgrade completes first-run as one lifecycle"
grep -F '"$root/bin/omarchy-done" mark first-run-user' "$upgrade_to_quattro" >/dev/null
grep -F 'rm -f "$state_dir/first-run-user.done"' "$upgrade_to_quattro" >/dev/null
grep -F '"$root/bin/omarchy-done" mark finalize-user' "$upgrade_to_quattro" >/dev/null
grep -F 'rm -f "$state_dir/finalize-user.done"' "$upgrade_to_quattro" >/dev/null
pass "Omarchy 4 upgrade migrates legacy completion markers"
pass "Omarchy 4 upgrade completes first-run and migrates legacy completion markers"
grep -F 'configure_snapper_policy' "$upgrade_to_quattro" >/dev/null
grep -F '/usr/share/omarchy/install/config/snapper.sh' "$upgrade_to_quattro" >/dev/null