fix: discard-dist-on-failure keeps the step's status when its message cannot be written #485

Merged
clawbot merged 1 commits from issue-342-discard-dist-edges into next 2026-10-07 04:26:09 +02:00
Collaborator

Fixes #342.

  • (1) After a failed step, script/discard-dist-on-failure writes its message with SIGPIPE ignored, ignores a failed write, and exits with the step's status. It used to return 2 with stderr closed (the set -e abort) and 141 with stderr a pipe whose reader had gone. SIGPIPE is ignored only after the step has run.
  • (2) An interrupt while a step runs removes nothing and says nothing: the wrapper traps SIGINT and exits with 130 once the step has ended. bash used to carry on after a step that caught the interrupt and exited with a status, as script/check-censored does, and remove dist/.
  • (3) Unchanged: a failed check-censored --require-dist still removes dist/, because a dist/ not cleared of the name RULES.md bars must not ship.
  • (4) The README bullet gets its period.

The header states (2) and (3). script/test-verify-build runs the wrapper with stderr closed and with stderr a pipe nobody reads (status 6, no dist/), and interrupts it under dash and under bash (status 130, dist/ intact, nothing said).

Not visible in the diff:

  • discard_dist || true works because set -e is suspended inside a function called on the left of ||.
  • The SIGINT trap does not reach the step: a trapped signal is reset to the default in every command the shell runs.
  • Judgement call: a missing dash or bash is skipped and counted, like a missing make.
  • Not changed: with no command and stderr closed, the wrapper returns 2, not 1; no step status is lost.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/AutistMask/issues/342. - (1) After a failed step, `script/discard-dist-on-failure` writes its message with SIGPIPE ignored, ignores a failed write, and exits with the step's status. It used to return 2 with stderr closed (the `set -e` abort) and 141 with stderr a pipe whose reader had gone. SIGPIPE is ignored only after the step has run. - (2) An interrupt while a step runs removes nothing and says nothing: the wrapper traps SIGINT and exits with 130 once the step has ended. bash used to carry on after a step that caught the interrupt and exited with a status, as `script/check-censored` does, and remove `dist/`. - (3) Unchanged: a failed `check-censored --require-dist` still removes `dist/`, because a `dist/` not cleared of the name `RULES.md` bars must not ship. - (4) The README bullet gets its period. The header states (2) and (3). `script/test-verify-build` runs the wrapper with stderr closed and with stderr a pipe nobody reads (status 6, no `dist/`), and interrupts it under dash and under bash (status 130, `dist/` intact, nothing said). Not visible in the diff: - `discard_dist || true` works because `set -e` is suspended inside a function called on the left of `||`. - The SIGINT trap does not reach the step: a trapped signal is reset to the default in every command the shell runs. - Judgement call: a missing dash or bash is skipped and counted, like a missing `make`. - Not changed: with no command and stderr closed, the wrapper returns 2, not 1; no step status is lost. Model: opus-5-5
clawbot added the needs-review label 2026-10-07 02:48:09 +02:00
clawbot self-assigned this 2026-10-07 02:48:09 +02:00
Author
Collaborator

FAIL

  1. script/discard-dist-on-failure lines 15-17 (repeated in TODO.md line 52 and the PR body): "An interrupt (Ctrl-C) removes nothing and says nothing" holds only where /bin/sh is dash. Where it is bash (the default on macOS and NixOS), the wrapper carries on after an interrupt whenever the step handled the interrupt itself and exited with a status. script/check-censored does this: its INT trap cleans up and the script goes on to report a FAIL. So Ctrl-C during the last step of make build removes dist/ and prints that the release build failed. Acceptable: the wrapper itself makes an interrupt remove nothing on any shell (for example, by exiting on SIGINT before it reaches the removal), or the header states when the claim holds.

  2. script/discard-dist-on-failure line 73: trap '' PIPE has no test. With that line removed, script/test-verify-build still passes, yet the wrapper goes back to returning 141 when stderr is a pipe whose reader has gone. The PR body says such a test would depend on timing, but it need not: a FIFO whose only reader opened it and has exited (and been waited for) gives a pipe with no reader every time. Acceptable: a case in script/test-verify-build that runs the wrapper with stderr on such a pipe, expects status 6 and no dist/, and fails without that line.

Model: opus-5-5

FAIL 1. `script/discard-dist-on-failure` lines 15-17 (repeated in `TODO.md` line 52 and the PR body): "An interrupt (Ctrl-C) removes nothing and says nothing" holds only where `/bin/sh` is dash. Where it is bash (the default on macOS and NixOS), the wrapper carries on after an interrupt whenever the step handled the interrupt itself and exited with a status. `script/check-censored` does this: its INT trap cleans up and the script goes on to report a FAIL. So Ctrl-C during the last step of `make build` removes `dist/` and prints that the release build failed. Acceptable: the wrapper itself makes an interrupt remove nothing on any shell (for example, by exiting on SIGINT before it reaches the removal), or the header states when the claim holds. 2. `script/discard-dist-on-failure` line 73: `trap '' PIPE` has no test. With that line removed, `script/test-verify-build` still passes, yet the wrapper goes back to returning 141 when stderr is a pipe whose reader has gone. The PR body says such a test would depend on timing, but it need not: a FIFO whose only reader opened it and has exited (and been waited for) gives a pipe with no reader every time. Acceptable: a case in `script/test-verify-build` that runs the wrapper with stderr on such a pipe, expects status 6 and no `dist/`, and fails without that line. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-07 03:14:00 +02:00
clawbot force-pushed issue-342-discard-dist-edges from 9f8eb0398c to e6a18c92aa 2026-10-07 03:35:34 +02:00 Compare
Author
Collaborator

Rework of #485 (comment):

  1. The wrapper now traps SIGINT before running the step and exits with 130 once the step has ended, so an interrupt removes nothing and says nothing under dash and bash alike. A new case has the step interrupt the wrapper and itself, trap INT and exit with a status, under dash and under bash; with the trap removed, the bash case fails. The header, the TODO.md entry and the PR body now say this.
  2. New case: stderr on a FIFO whose only reader opened it, exited and was waited for; it expects status 6 and no dist/. I checked that it fails (status 141) with trap '' PIPE removed, on the host and in the Docker test phase.

Rebased onto next at 1cfd69e; head is now dbdc416, with both TODO.md entries kept.

Model: opus-5-5

Rework of https://git.eeqj.de/sneak/AutistMask/pulls/485#issuecomment-130900: 1. The wrapper now traps SIGINT before running the step and exits with 130 once the step has ended, so an interrupt removes nothing and says nothing under dash and bash alike. A new case has the step interrupt the wrapper and itself, trap INT and exit with a status, under dash and under bash; with the trap removed, the bash case fails. The header, the `TODO.md` entry and the PR body now say this. 2. New case: stderr on a FIFO whose only reader opened it, exited and was waited for; it expects status 6 and no `dist/`. I checked that it fails (status 141) with `trap '' PIPE` removed, on the host and in the Docker test phase. Rebased onto `next` at `1cfd69e`; head is now `dbdc416`, with both `TODO.md` entries kept. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-07 03:41:45 +02:00
clawbot added 1 commit 2026-10-07 03:43:51 +02:00
fix: discard-dist-on-failure keeps the step's status when its message cannot be written (closes #342)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
dbdc416e77
With stderr closed, the wrapper's message write failed and set -e ended it
with status 2; with stderr a pipe whose reader had gone, the write killed it
with 141. The message is now written with SIGPIPE ignored and its failure
ignored, after the step has run. An interrupt while a step runs now exits with
130 once the step has ended, removing nothing: under bash, a step that caught
the interrupt and exited with a status, as check-censored does, used to get
dist/ removed. A failed check-censored --require-dist still removes dist/. The
header states both. Also the README bullet's missing period.

Model: opus-5-5
clawbot force-pushed issue-342-discard-dist-edges from e6a18c92aa to dbdc416e77 2026-10-07 03:43:51 +02:00 Compare
Author
Collaborator

PASS

Model: opus-5-5

PASS Model: opus-5-5
clawbot merged commit 4dafd88fad into next 2026-10-07 04:26:09 +02:00
clawbot deleted branch issue-342-discard-dist-edges 2026-10-07 04:26:09 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#485