onboard-host preflight: execute the GNU toolchain the harness assumes; state 'Linux hosts only' in docs #212

Closed
opened 2026-10-15 02:59:33 +00:00 by ben · 3 comments
Owner

Filed from the 2026-10-14 infrastructure review (Claude Code session on Ben's workstation; four parallel read-only review passes over the root harness). Line anchors are against main at 3e50274.

Symptom

GNU-only constructs with no portability branch (uname/Darwin appears nowhere): stat -c %Y in 9 files (limit-lib.sh:97 inside $(( )) under set -e — a present limit marker crashes every caller if stat differs; execute-lib.sh:67, host-capacity-lib.sh:296/336/354, sweep-lib.sh:50/102, session-runner.sh:170/309/380, schedule-backstop.sh:61, run-swarm.sh:268, onboard-host-lib.sh:130), date -d (sweep-lib.sh:172, schedule-backstop.sh:88 fatal), flock (if missing, the inline swarm/triage guards read "both slots busy" and yield green forever — GOTCHAS 35 shape), timeout in 14 files (missing → session-runner escalates every ticket), declare -A (bash ≥ 4), mapfile, sha256sum. onboard_host_preflight (onboarding/onboard-host-lib.sh:101-114) checks only the registry-declared tools list by NAME. Nothing in README or install-prompt states the Linux requirement. Not live today (all three hosts are Ubuntu), but a latent enrolment trap for the next device.

Proposed change

  • Hardcoded toolchain check in preflight, independent of the registry, that EXECUTES: stat -c %Y on a temp file, date -u -d @0, flock -n on a temp fd, timeout 1 true, bash -c 'declare -A x', sha256sum, python3 -c 'import sqlite3'.
  • One line in README and install-prompt: "Linux hosts only (GNU coreutils, bash ≥ 4.3); macOS untested."
  • Optional follow-up: a _mtime/_epoch_from_iso/_timeout shim lib if a non-GNU host is ever wanted.

Acceptance

  • onboarding/tests/onboard-host-lib-test.sh: a shimmed missing flock fails preflight by name.
_Filed from the 2026-10-14 infrastructure review (Claude Code session on Ben's workstation; four parallel read-only review passes over the root harness). Line anchors are against `main` at 3e50274._ ## Symptom GNU-only constructs with no portability branch (`uname`/Darwin appears nowhere): `stat -c %Y` in 9 files (`limit-lib.sh:97` inside `$(( ))` under set -e — a present limit marker crashes every caller if stat differs; `execute-lib.sh:67`, `host-capacity-lib.sh:296/336/354`, `sweep-lib.sh:50/102`, `session-runner.sh:170/309/380`, `schedule-backstop.sh:61`, `run-swarm.sh:268`, `onboard-host-lib.sh:130`), `date -d` (`sweep-lib.sh:172`, `schedule-backstop.sh:88` fatal), `flock` (if missing, the inline swarm/triage guards read "both slots busy" and yield green forever — GOTCHAS 35 shape), `timeout` in 14 files (missing → session-runner escalates every ticket), `declare -A` (bash ≥ 4), `mapfile`, `sha256sum`. `onboard_host_preflight` (`onboarding/onboard-host-lib.sh:101-114`) checks only the registry-declared `tools` list by NAME. Nothing in README or install-prompt states the Linux requirement. Not live today (all three hosts are Ubuntu), but a latent enrolment trap for the next device. ## Proposed change - Hardcoded toolchain check in preflight, independent of the registry, that EXECUTES: `stat -c %Y` on a temp file, `date -u -d @0`, `flock -n` on a temp fd, `timeout 1 true`, `bash -c 'declare -A x'`, `sha256sum`, `python3 -c 'import sqlite3'`. - One line in README and install-prompt: "Linux hosts only (GNU coreutils, bash ≥ 4.3); macOS untested." - Optional follow-up: a `_mtime`/`_epoch_from_iso`/`_timeout` shim lib if a non-GNU host is ever wanted. ## Acceptance - `onboarding/tests/onboard-host-lib-test.sh`: a shimmed missing `flock` fails preflight by name.

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

  • Ruling: ready-for-agent.
  • Why this is a two-way door: an additive preflight execute-check plus two doc lines; revertible by a commit, and it tightens enrolment safety (catches a latent trap early) rather than widening any posture.
  • What proves it: a single offline test in onboarding/tests/onboard-host-lib-test.sh — with flock shimmed missing on PATH, preflight must fail and name flock; a host where every behaviour works still passes.

Agent Brief

Category: bug

Summary: onboard_host_preflight validates the declared toolchain by name only, so a host missing a GNU behaviour (not just a binary) enrols clean and then dies — or, worse, yields green forever — at run time. Execute the behaviours the harness actually assumes, and state the Linux requirement in the docs.

Current behavior: Preflight runs command -v <tool> over the registry-declared list. GNU-specific constructs (stat -c %Y inside set -e arithmetic, date -d, flock -n, timeout, declare -A, mapfile, sha256sum, python3 sqlite3) are used with no portability branch; a missing/divergent one surfaces as a crashed caller or a false "both slots busy" green yield, not a preflight failure.

Desired behavior: A hardcoded, registry-independent execute-check in preflight that actually runs each assumed behaviour and fails by name on any that misbehaves: stat -c %Y on a temp file, date -u -d @0, flock -n on a temp fd, timeout 1 true, bash -c 'declare -A x', sha256sum, python3 -c 'import sqlite3'. Plus one line in README and the install-prompt: "Linux hosts only (GNU coreutils, bash ≥ 4.3); macOS untested."

Key interfaces: A preflight sub-check that emits the same ok/fail reporting shape as the existing onboard_host_check_* functions and contributes to the aggregate preflight return code; independent of the registry tools list.

Acceptance criteria:

  • onboarding/tests/onboard-host-lib-test.sh: with flock shimmed missing on PATH, preflight fails and names flock.
  • A host where every behaviour works still passes preflight (existing "preflight passes" case stays green).
  • README and the install-prompt each carry the Linux-only line.
  • Full offline suite green.

Out of scope: The optional _mtime/_epoch_from_iso/_timeout shim lib (explicitly a separate follow-up) and any actual macOS portability work.

> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** - **Ruling:** `ready-for-agent`. - **Why this is a two-way door:** an additive preflight execute-check plus two doc lines; revertible by a commit, and it *tightens* enrolment safety (catches a latent trap early) rather than widening any posture. - **What proves it:** a single offline test in `onboarding/tests/onboard-host-lib-test.sh` — with `flock` shimmed missing on PATH, preflight must fail and name `flock`; a host where every behaviour works still passes. ## Agent Brief **Category:** bug **Summary:** `onboard_host_preflight` validates the declared toolchain by name only, so a host missing a GNU behaviour (not just a binary) enrols clean and then dies — or, worse, yields green forever — at run time. Execute the behaviours the harness actually assumes, and state the Linux requirement in the docs. **Current behavior:** Preflight runs `command -v <tool>` over the registry-declared list. GNU-specific constructs (`stat -c %Y` inside set -e arithmetic, `date -d`, `flock -n`, `timeout`, `declare -A`, `mapfile`, `sha256sum`, `python3 sqlite3`) are used with no portability branch; a missing/divergent one surfaces as a crashed caller or a false "both slots busy" green yield, not a preflight failure. **Desired behavior:** A hardcoded, registry-independent execute-check in preflight that actually runs each assumed behaviour and fails by name on any that misbehaves: `stat -c %Y` on a temp file, `date -u -d @0`, `flock -n` on a temp fd, `timeout 1 true`, `bash -c 'declare -A x'`, `sha256sum`, `python3 -c 'import sqlite3'`. Plus one line in README and the install-prompt: "Linux hosts only (GNU coreutils, bash ≥ 4.3); macOS untested." **Key interfaces:** A preflight sub-check that emits the same ok/fail reporting shape as the existing `onboard_host_check_*` functions and contributes to the aggregate preflight return code; independent of the registry `tools` list. **Acceptance criteria:** - [ ] `onboarding/tests/onboard-host-lib-test.sh`: with `flock` shimmed missing on PATH, preflight fails and names `flock`. - [ ] A host where every behaviour works still passes preflight (existing "preflight passes" case stays green). - [ ] README and the install-prompt each carry the Linux-only line. - [ ] Full offline suite green. **Out of scope:** The optional `_mtime`/`_epoch_from_iso`/`_timeout` shim lib (explicitly a separate follow-up) and any actual macOS portability work.

swarm-claim host=bens-mac-04 run=21816
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=21816 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #212 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 212,
  "status": "success",
  "commits": [
    "4753adaf"
  ],
  "changed_files": [
    "README.md",
    "STATUS.md",
    "onboarding/install-prompt.md",
    "onboarding/onboard-host-lib.sh",
    "onboarding/tests/onboard-host-lib-test.sh"
  ],
  "tests": [
    {
      "command": "bash onboarding/tests/onboard-host-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/install-prompt-contract-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "onboarding/tests/onboard-host-lib-test.sh: a shimmed missing flock fails preflight by name": "test 'preflight FAILS a host whose flock is missing, naming flock by name' and 'check_toolchain FAILS when flock is missing/broken, naming flock' in onboarding/tests/onboard-host-lib-test.sh (76/0)",
    "A host where every behaviour works still passes preflight (existing case stays green)": "test 'check_toolchain passes on a host carrying the GNU toolchain' and existing 'preflight passes on a host that is in order' both green",
    "README and the install-prompt each carry the Linux-only line": "README.md and onboarding/install-prompt.md both carry 'Linux hosts only (GNU coreutils, bash >= 4.3); macOS untested'",
    "Full offline suite green": "full suite loop exited with no FAIL lines"
  },
  "summary": "onboard-host preflight now executes the GNU toolchain behaviours (stat -c %Y, date -d, flock, timeout, declare -A, sha256sum, python3 sqlite3) registry-independently and fails by name, and the Linux-only requirement is stated in README and install-prompt.",
  "blockers": []
}
**close-report** for #212 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 212, "status": "success", "commits": [ "4753adaf" ], "changed_files": [ "README.md", "STATUS.md", "onboarding/install-prompt.md", "onboarding/onboard-host-lib.sh", "onboarding/tests/onboard-host-lib-test.sh" ], "tests": [ { "command": "bash onboarding/tests/onboard-host-lib-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/install-prompt-contract-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL; done", "exit_code": 0 } ], "criteria": { "onboarding/tests/onboard-host-lib-test.sh: a shimmed missing flock fails preflight by name": "test 'preflight FAILS a host whose flock is missing, naming flock by name' and 'check_toolchain FAILS when flock is missing/broken, naming flock' in onboarding/tests/onboard-host-lib-test.sh (76/0)", "A host where every behaviour works still passes preflight (existing case stays green)": "test 'check_toolchain passes on a host carrying the GNU toolchain' and existing 'preflight passes on a host that is in order' both green", "README and the install-prompt each carry the Linux-only line": "README.md and onboarding/install-prompt.md both carry 'Linux hosts only (GNU coreutils, bash >= 4.3); macOS untested'", "Full offline suite green": "full suite loop exited with no FAIL lines" }, "summary": "onboard-host preflight now executes the GNU toolchain behaviours (stat -c %Y, date -d, flock, timeout, declare -A, sha256sum, python3 sqlite3) registry-independently and fails by name, and the Linux-only requirement is stated in README and install-prompt.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#212
No description provided.