Rework Omarchy channel detection: dev is a linked checkout, edge is the dev package channel

This commit is contained in:
David Heinemeier Hansson
2026-06-29 11:12:35 -05:00
parent d824c1bd33
commit b034fc1905
4 changed files with 68 additions and 57 deletions
+33 -26
View File
@@ -96,7 +96,7 @@ esac
run_channel() {
: >"$log_file"
OMARCHY_CHANNEL_TEST_LOG="$log_file" \
OMARCHY_EDGE_PATH="${OMARCHY_EDGE_PATH:-}" \
OMARCHY_DEV_PATH="${OMARCHY_DEV_PATH:-}" \
OMARCHY_TEST_GUM_INPUT="${OMARCHY_TEST_GUM_INPUT:-}" \
OMARCHY_PATH="$ROOT" \
HOME="$test_tmp/home" \
@@ -129,33 +129,40 @@ assert_log_line $'sudo\tenv\tOMARCHY_UPDATE_PACMAN=1\tpacman\t-S\t--needed\t--no
assert_log_line 'unlink' "stable restores the package-backed Omarchy path"
assert_log_line $'update\t-y' "stable runs the normal update pipeline"
run_channel dev
assert_log_line $'refresh\tedge' "dev refreshes the edge pacman channel"
assert_log_line $'sudo\tenv\tOMARCHY_UPDATE_PACMAN=1\tpacman\t-S\t--needed\t--noconfirm\t--ask\t4\tomarchy-dev\tomarchy-settings-dev' "dev installs development Omarchy packages"
assert_log_line 'unlink' "dev remains package-backed"
run_channel rc
assert_log_line $'refresh\trc' "rc refreshes the rc pacman channel"
assert_log_line $'sudo\tenv\tOMARCHY_UPDATE_PACMAN=1\tpacman\t-S\t--needed\t--noconfirm\t--ask\t4\tomarchy\tomarchy-settings' "rc installs rc Omarchy packages"
assert_log_line 'unlink' "rc restores the package-backed Omarchy path"
assert_log_line $'update\t-y' "rc runs the normal update pipeline"
checkout="$test_tmp/edge-checkout"
default_checkout="$test_tmp/home/Work/omarchy"
OMARCHY_TEST_GUM_INPUT="$checkout" run_channel edge
assert_numbered_log_line 1 $'gum\tconfirm\t--default=false\tEnable Edge anyway?' "edge warns before changing packages"
assert_numbered_log_line 2 $'gum\tinput\t--value\t'"$default_checkout"$'\t--placeholder\t'"$default_checkout"$'\t--header\tWhere should Edge checkout live? Existing non-checkout paths will not be overwritten.' "edge prompts for the checkout path before changing packages"
assert_log_line $'gum\tconfirm\t--default=false\tEnable Edge anyway?' "edge asks for confirmation"
run_channel edge
assert_log_line $'refresh\tedge' "edge refreshes the edge pacman channel"
assert_log_line $'sudo\tenv\tOMARCHY_UPDATE_PACMAN=1\tpacman\t-S\t--needed\t--noconfirm\t--ask\t4\tomarchy-dev\tomarchy-settings-dev' "edge installs development Omarchy packages"
assert_log_line $'git\tclone\t--branch\tquattro\t--single-branch\thttps://github.com/basecamp/omarchy.git\t'"$checkout" "edge clones the quattro checkout"
assert_log_line $'link\t'"$checkout" "edge links the source checkout"
assert_log_line 'unlink' "edge remains package-backed"
assert_log_line $'update\t-y' "edge runs the normal update pipeline"
checkout="$test_tmp/dev-checkout"
default_checkout="$test_tmp/home/Work/omarchy"
OMARCHY_TEST_GUM_INPUT="$checkout" run_channel dev
assert_numbered_log_line 1 $'gum\tconfirm\t--default=false\tEnable Dev anyway?' "dev warns before changing packages"
assert_numbered_log_line 2 $'gum\tinput\t--value\t'"$default_checkout"$'\t--placeholder\t'"$default_checkout"$'\t--header\tWhere should Dev checkout live? Existing non-checkout paths will not be overwritten.' "dev prompts for the checkout path before changing packages"
assert_log_line $'gum\tconfirm\t--default=false\tEnable Dev anyway?' "dev asks for confirmation"
assert_log_line $'refresh\tedge' "dev refreshes the edge pacman channel"
assert_log_line $'sudo\tenv\tOMARCHY_UPDATE_PACMAN=1\tpacman\t-S\t--needed\t--noconfirm\t--ask\t4\tomarchy-dev\tomarchy-settings-dev' "dev installs development Omarchy packages"
assert_log_line $'git\tclone\t--branch\tquattro\t--single-branch\thttps://github.com/basecamp/omarchy.git\t'"$checkout" "dev clones the quattro checkout"
assert_log_line $'link\t'"$checkout" "dev links the source checkout"
occupied_checkout="$test_tmp/occupied"
mkdir -p "$occupied_checkout"
if OMARCHY_TEST_GUM_INPUT="$occupied_checkout" run_channel edge >"$test_tmp/occupied.out" 2>"$test_tmp/occupied.err"; then
fail "edge refuses to use an occupied non-checkout path"
if OMARCHY_TEST_GUM_INPUT="$occupied_checkout" run_channel dev >"$test_tmp/occupied.out" 2>"$test_tmp/occupied.err"; then
fail "dev refuses to use an occupied non-checkout path"
fi
grep -q "already exists and is not a git checkout" "$test_tmp/occupied.err" || fail "edge explains occupied checkout paths" "$(cat "$test_tmp/occupied.err")"
grep -q "already exists and is not a git checkout" "$test_tmp/occupied.err" || fail "dev explains occupied checkout paths" "$(cat "$test_tmp/occupied.err")"
if grep -Fx $'refresh\tedge' "$log_file" >/dev/null; then
fail "edge validates checkout path before changing packages" "$(cat "$log_file")"
fail "dev validates checkout path before changing packages" "$(cat "$log_file")"
fi
pass "edge refuses occupied non-checkout paths before package changes"
pass "dev refuses occupied non-checkout paths before package changes"
current_channel() {
OMARCHY_TEST_VERSION_CHANNEL="$1" \
@@ -169,16 +176,16 @@ current_channel() {
[[ $(current_channel stable stable) == "stable" ]] || fail "current channel detects stable"
pass "current channel detects stable"
[[ $(current_channel rc dev) == "rc" ]] || fail "current channel detects rc"
[[ $(current_channel rc stable) == "rc" ]] || fail "current channel detects rc"
pass "current channel detects rc"
[[ $(current_channel edge dev /dev/null /usr/share/omarchy) == "dev" ]] || fail "current channel detects package-backed dev"
pass "current channel detects package-backed dev"
[[ $(current_channel edge dev /dev/null /usr/share/omarchy) == "edge" ]] || fail "current channel detects package-backed edge"
pass "current channel detects package-backed edge"
[[ $(current_channel edge dev /dev/null "$test_tmp/edge-checkout") == "edge" ]] || fail "current channel detects edge from OMARCHY_PATH"
pass "current channel detects edge from OMARCHY_PATH"
[[ $(current_channel edge dev /dev/null "$test_tmp/dev-checkout") == "dev" ]] || fail "current channel detects dev from OMARCHY_PATH"
pass "current channel detects dev from OMARCHY_PATH"
conf="$test_tmp/omarchy.conf"
printf 'export OMARCHY_PATH="%s"\n' "$test_tmp/edge-checkout" >"$conf"
[[ $(current_channel edge dev "$conf" /usr/share/omarchy) == "edge" ]] || fail "current channel detects edge from configured path"
pass "current channel detects edge from configured path"
printf 'export OMARCHY_PATH="%s"\n' "$test_tmp/dev-checkout" >"$conf"
[[ $(current_channel edge dev "$conf" /usr/share/omarchy) == "dev" ]] || fail "current channel detects dev from configured path"
pass "current channel detects dev from configured path"