From d2b98989b298f082c76d3c7925419ee6b95b3c71 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 15 Sep 2026 11:24:59 +0200 Subject: docs: correct the check count and mirror the statusctl hardening Two corrections to the plan, both found by running it rather than reading it. The test script the plan specifies makes nine assertions; the prose around it claimed eight, in both the task step and the final check. An implementer running it would see a passing suite that disagrees with its own expected output, which reads as a failure of either the test or the plan. My arithmetic. The plan's statusctl also swallowed a failed rename and read the mode file through cat piped into tr, so a write that did not land still reported success and an unreadable file fell back to off by accident of pipeline semantics rather than by intent. Review of the implemented script caught both. The plan now carries the same fixes, so a future run of it does not reintroduce them. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01A7ThHHh5iTYbVfp3rNAkw2 --- docs/superpowers/plans/2026-09-15-status-registry.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'docs/superpowers/plans') 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** -- cgit v1.2.3