fix(installer): avoid pipefail marker race
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/greenfield-install Pipeline was successful

This commit is contained in:
2026-08-06 12:13:42 -05:00
parent 58ada98d2b
commit 913f00770f
6 changed files with 82 additions and 4 deletions
@@ -0,0 +1,56 @@
# #1050 C1 fix round — Round 8 pipefail-safe expected-set membership
BASE HEAD
- 58ada98d2b430da28c46cf92eebdb6d45b8b1846
- Review 122 (rev-security-02) found expected_names | grep -Fxq could falsely reject valid markers under pipefail when grep closed the pipe after an early match and the producer exited 141.
- Independent canonical-Alpine live-manifest stress reproduced intermittent false failures at the current four-arm set size. No small-manifest safe threshold is claimed.
DETERMINISTIC RED
- The focused suite now generates a 20,001-name manifest with a valid target sorted first and invokes the real mark path.
- Before remediation, in canonical Alpine ci-base:
docker run --rm -u "$(id -u):$(id -g)" -v "$PWD:/workspace" -w /workspace git.mosaicstack.dev/mosaicstack/stack/ci-base:latest bash tools/verify-greenfield-execution-coverage.test.sh
=> canonical_sigpipe_tdd_red_rc=1
=> [fixture-suite] case is not in the expected set: a-target
- This control exercises the production checker invocation rather than an approximated producer and makes the early-close race deterministic by exceeding pipe capacity.
IMPLEMENTATION
- The mark path now fully materializes expected_names into expected_snapshot and fails closed if production fails.
- grep -Fxq reads the completed snapshot through a here-string; there is no producer/consumer pipeline to close early.
- Missing names still fail with the same attributable message. No `|| true` or other failure suppression was introduced.
- Exact-set checks, marker inventory, aggregation, archive binding, fixture dispositions, expected-RED manifest, e2e installer, #869 wiring, and acquisition behavior are unchanged.
GREEN
- Local focused suite: greenfield execution coverage tests passed.
- Canonical Alpine focused suite: greenfield execution coverage tests passed.
- Canonical Alpine live production-manifest stress: 1,000 valid greenfield-git-absent arm marks, failures=0.
- Canonical grep-q pipeline mutant through the real checker path => rc=1 with the attributable false rejection; restored subject => GREEN.
- Existing Round-6 controls retained:
ignore-arms aggregation helper => rc=1
ignore-cases aggregation helper => rc=1
always-RED aggregation helper => rc=1
delete production .mosaic-test-work archive exclusion => rc=1
- Round-8 mutant workspace: /tmp/c1-round8-mutants.aS1xTI
FENCED FILES
- tools/e2e-install-test.sh HEAD/worktree SHA-256: a93113565aa69f2c6f3d792b78251021bb3bbe3f7813d5fed547ab0099fa3b98 (byte-identical)
- tools/fixtures/greenfield-expected-red.tsv HEAD/worktree SHA-256: baae06c664d0ab7ffe4c32ec106bfcb6f9dd74b46461d3c4440b73dc582af1a2 (byte-identical)
LOCAL BASELINES
- /home free before and after validation: 11G
- Bash syntax focused scripts: PASS
- ShellCheck focused scripts: PASS
- pnpm test:installer: PASS
- pnpm typecheck: PASS (45/45)
- pnpm lint: PASS (25/25)
- pnpm format:check: PASS
- woodpecker-cli lint --strict .woodpecker/greenfield-install.yml: PASS
- git diff --check: PASS
INDEPENDENT REVIEW
- Codex code review: APPROVE, confidence 0.96, six files reviewed, zero findings. It confirmed full materialization removes the SIGPIPE race and the deterministic regression control exercises the real early-match mark path.
- Codex security review: risk NONE, confidence 0.98, six files reviewed, zero findings. It confirmed fail-closed producer handling, constrained/quoted names, and no new injection, traversal, secret, access-control, cryptographic, dependency, or logging risk.
- The code-review sandbox could not execute the suite or install ShellCheck because its filesystem is read-only; local and canonical-container dynamic evidence above supplies those gates.
PENDING
- commit, queue guard, one lease-pinned push, provider attribution read-back
- replacement-head canonical CI; no manual trigger or polling
@@ -2,7 +2,7 @@
## Required artifacts
- [x] `docs/PRD.md` exists; #1050 C1 requirement 13 binds the complete in-scope remote stack source chain, and requirement 15 binds pipeline-level exact case+arm execution coverage, executable aggregation, production-bound archive purity, and canonical Alpine/BusyBox plus Debian portability.
- [x] `docs/PRD.md` exists; #1050 C1 requirement 13 binds the complete in-scope remote stack source chain, and requirement 15 binds exact case+arm execution coverage, executable aggregation, production-bound archive purity, dual-runtime portability, and pipefail-safe materialized membership.
- [x] User guide: not applicable; no user-facing production installer behavior changed.
- [x] Admin guide: not applicable; no operator procedure or deployment behavior changed.
- [x] Developer guide: existing `docs/guides/installer-state-machine.md` defines the fail-closed installer model; the C1-specific remote-arm contract and evidence live in the PRD, scratchpad, and scoped verification report.
@@ -24,4 +24,5 @@
- [x] Round-5 exact arm coverage and archive-purity controls reviewed: Codex code APPROVE (confidence 0.93, zero findings) and security risk NONE (confidence 0.96, zero findings).
- [x] Round-6 executable aggregation and production archive-selector binding reviewed: Codex code APPROVE (confidence 0.94, zero findings) and security risk NONE (confidence 0.97, zero findings).
- [x] Round-7 BusyBox-safe marker inventory and dual-runtime evidence reviewed: Codex code APPROVE (confidence 0.96, zero findings) and security risk NONE (confidence 0.97, zero findings).
- [x] Round-8 materialized membership and deterministic canonical-Alpine control reviewed: Codex code APPROVE (confidence 0.96, zero findings) and security risk NONE (confidence 0.98, zero findings).
- [x] Canonical evidence remains in-repo. No external publishing action was requested or performed.