diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/superpowers/plans/2026-09-15-status-registry.md | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/docs/superpowers/plans/2026-09-15-status-registry.md b/docs/superpowers/plans/2026-09-15-status-registry.md index 3b95743..5f86de4 100644 --- a/docs/superpowers/plans/2026-09-15-status-registry.md +++ b/docs/superpowers/plans/2026-09-15-status-registry.md @@ -391,7 +391,11 @@ file="$DIR/status.$mode" read_mode() { local v - v="$(cat "$file" 2>/dev/null | tr -d '[:space:]')" + # An unreadable file reads as off, deliberately: a missing mode file is + # the normal state before anything has written one, and the redirect + # makes that fallback explicit rather than a side effect of a pipeline + # swallowing cat's exit status. + v="$(tr -d '[:space:]' < "$file" 2>/dev/null)" [[ "$v" == "1" ]] && printf '1' || printf '0' } @@ -402,7 +406,12 @@ write_mode() { local want="$1" tmp tmp="$(mktemp "$DIR/.status.$mode.XXXXXX")" || exit 1 printf '%s\n' "$want" > "$tmp" - mv -f "$tmp" "$file" + # The temp file is made in the same directory as the target, so this is a + # rename rather than a copy, and therefore atomic. A failure here has to + # be loud: reporting success on a write that did not land would leave the + # caller and the shell disagreeing about the mode, with an orphan temp + # file as the only trace. + mv -f "$tmp" "$file" || { rm -f "$tmp"; exit 1; } } emit() { @@ -464,7 +473,7 @@ chmod +x desktop/modules/status/statusctl bash desktop/modules/status/test-statusctl.sh ``` -Expected: `8 passed, 0 failed`, exit 0. +Expected: `9 passed, 0 failed`, exit 0. - [ ] **Step 5: Commit** @@ -1184,7 +1193,7 @@ bash desktop/modules/kdeconnect/test-kdeconnect-state.sh timeout 8 qs -p ./desktop 2>&1 | grep -E 'ERROR|TypeError|ReferenceError|is not defined|Cannot assign|Unable to assign' && echo "ERRORS ABOVE" || echo "clean" ``` -Expected: statusctl `8 passed, 0 failed`; mail 16 of 16; kdeconnect 5 of 5; `clean`. +Expected: statusctl `9 passed, 0 failed`; mail 16 of 16; kdeconnect 5 of 5; `clean`. - [ ] **Step 4: Confirm the process count** |
