test hermeticity: fleet-queue-test ack-stand-down case reds only on a host with FLEET_DISPATCHER_URL set (the dispatcher host) #368

Closed
opened 2026-11-19 17:27:54 +00:00 by matou-build-agent · 4 comments

tests/fleet-queue-test.sh has one check that fails only on a host that declares FLEET_DISPATCHER_URL (i.e. the dispatcher host, matou-workstation), and passes everywhere else — so it reds the offline suite on exactly the box the dispatcher runs on, while CI stays green.

Symptom

FAIL: a tick with a fresh LIVE ack stands down: no lister, no dispatch, names the dispatcher
fleet-queue-test: 47 passed, 1 failed

The check (around line 222) crafts a fresh true true acting-ack, runs tick, and expects the tick to stand down (fleet_slot_report_acked_fresh).

Cause

The test does not neutralise FLEET_DISPATCHER_URL. On the dispatcher host that var is set in the host env, so fleet_slot_report_emit tick (fleet-queue.sh, before the gates) calls fleet_slot_report_send, which is NOT a no-op: it POSTs to the dispatcher (through the test curl shim, which returns [] → non-2xx), records a dead ack (false false), and so overwrites the crafted true true. fleet_slot_report_acked_fresh then returns rc 1 and the tick proceeds to list → [ ! -s "$LISTER_LOG" ] fails. In CI FLEET_DISPATCHER_URL is empty, send is a no-op, the crafted ack survives, the check passes.

Observed while landing #365 on matou-workstation; already noted as a pre-existing clean-tree red in docs/journal/2026-11-19-359.md and -364.md without a cause.

Fix (two-way, provable)

Make the test hermetic: export FLEET_DISPATCHER_URL="" (and likely FLEET_DISPATCHER_TOKEN="") in the test header, alongside the other exported state dirs, so the ack-stand-down cases exercise only the crafted ack. No harness-code change; tests/ is not vendored.

Ruled by agent under ADR 0174 — veto anytime. Filed as a follow-up from #365 (rule 1: work only the assigned ticket, file follow-ups). Related: #356, #357.

`tests/fleet-queue-test.sh` has one check that fails **only on a host that declares `FLEET_DISPATCHER_URL`** (i.e. the dispatcher host, `matou-workstation`), and passes everywhere else — so it reds the offline suite on exactly the box the dispatcher runs on, while CI stays green. ## Symptom ``` FAIL: a tick with a fresh LIVE ack stands down: no lister, no dispatch, names the dispatcher fleet-queue-test: 47 passed, 1 failed ``` The check (around line 222) crafts a fresh `true true` acting-ack, runs `tick`, and expects the tick to stand down (`fleet_slot_report_acked_fresh`). ## Cause The test does **not** neutralise `FLEET_DISPATCHER_URL`. On the dispatcher host that var is set in the host env, so `fleet_slot_report_emit tick` (fleet-queue.sh, before the gates) calls `fleet_slot_report_send`, which is NOT a no-op: it POSTs to the dispatcher (through the test curl shim, which returns `[]` → non-2xx), records a **dead ack** (`false false`), and so overwrites the crafted `true true`. `fleet_slot_report_acked_fresh` then returns rc 1 and the tick proceeds to list → `[ ! -s "$LISTER_LOG" ]` fails. In CI `FLEET_DISPATCHER_URL` is empty, `send` is a no-op, the crafted ack survives, the check passes. Observed while landing #365 on `matou-workstation`; already noted as a pre-existing clean-tree red in `docs/journal/2026-11-19-359.md` and `-364.md` without a cause. ## Fix (two-way, provable) Make the test hermetic: `export FLEET_DISPATCHER_URL=""` (and likely `FLEET_DISPATCHER_TOKEN=""`) in the test header, alongside the other `export`ed state dirs, so the ack-stand-down cases exercise only the crafted ack. No harness-code change; `tests/` is not vendored. Ruled by agent under ADR 0174 — veto anytime. Filed as a follow-up from #365 (rule 1: work only the assigned ticket, file follow-ups). Related: #356, #357.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime. Category bug, state ready-for-agent.

Confirmed and reproduced offline. Your diagnosis is right, and I verified the fix. The ack-stand-down check reds only when FLEET_DISPATCHER_URL is present in the test's environment (the dispatcher host); with it unset the suite is 48 passed, 0 failed. I reproduced the red with a fake, unreachable URL (http://127.0.0.1:9/x), which rules out any real slot/disk dependency — the cause is exactly the leaked env var overwriting the crafted true true ack via fleet_slot_report_send, as you describe. Neutralising it in the test header (export FLEET_DISPATCHER_URL="" FLEET_DISPATCHER_TOKEN="" alongside the other exported state) restores 48 passed, 0 failed even with the host var set.

Why a two-way door: the fix touches only tests/ (not vendored, not a protected path — the swarm may work it), is reversible by a one-line revert, and is proven by an existing test (the suite itself flips red→green). Not on the one-way-door list. Hence ready-for-agent, not ready-for-session.

Agent Brief

Category: bug
Summary: fleet-queue-test.sh leaks FLEET_DISPATCHER_URL from the host env, reddening the fresh-LIVE-ack stand-down check on any host that declares one (the dispatcher host).

Current behavior:
The fleet-queue test suite exports its own state-dir vars in the header but does not neutralise FLEET_DISPATCHER_URL/FLEET_DISPATCHER_TOKEN. On a host where those are set in the environment, the slot-report emit that runs before the gates calls the real send path, which POSTs to the (test-shimmed) dispatcher, gets a non-2xx, and records a dead ack — overwriting the crafted fresh true true acting-ack the stand-down case depends on. The ack then reads stale/dead, the tick proceeds to list, and the check a tick with a fresh LIVE ack stands down … fails (47 passed, 1 failed). On CI and any host with no dispatcher URL, send is a no-op, the crafted ack survives, and the suite is green — so the red is invisible to CI and bites only the dispatcher host's offline runs.

Desired behavior:
The suite is hermetic with respect to the host's dispatcher configuration: every case exercises only the state it crafts, and the full suite passes identically on a dispatcher host and a non-dispatcher host.

Key interfaces:

  • The test's own environment setup (the block that exports FLEET_*/HOST_* state paths) should also pin the dispatcher-send inputs to empty so the real send path is a no-op, letting the crafted FLEET_DISPATCH_ACK_STATE be the only ack the gate reads.
  • No harness-code change. The stand-down ordering in fleet-queue.sh (fleet_queue_slot_free gate before fleet_slot_report_acked_fresh) is correct and out of scope — the failure does not involve real slot/disk state.

Acceptance criteria:

  • bash tests/fleet-queue-test.sh reports 0 failed with FLEET_DISPATCHER_URL and FLEET_DISPATCHER_TOKEN set in the environment (simulate the dispatcher host).
  • The same command reports 0 failed with those vars unset (non-dispatcher host / CI parity preserved).
  • No change to any file outside tests/.

Out of scope:

  • Any change to fleet-queue.sh, fleet-slot-report-lib.sh, or the gate ordering — this is a test-hermeticity fix only.
  • Closes the same clean-tree red tracked by #369 (duplicate — closed), and the pre-existing-red note in docs/journal/2026-11-19-359.md / -364.md.
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** Category `bug`, state `ready-for-agent`. Confirmed and reproduced offline. Your diagnosis is right, and I verified the fix. The ack-stand-down check reds **only** when `FLEET_DISPATCHER_URL` is present in the test's environment (the dispatcher host); with it unset the suite is `48 passed, 0 failed`. I reproduced the red with a *fake, unreachable* URL (`http://127.0.0.1:9/x`), which rules out any real slot/disk dependency — the cause is exactly the leaked env var overwriting the crafted `true true` ack via `fleet_slot_report_send`, as you describe. Neutralising it in the test header (`export FLEET_DISPATCHER_URL="" FLEET_DISPATCHER_TOKEN=""` alongside the other exported state) restores `48 passed, 0 failed` even with the host var set. **Why a two-way door:** the fix touches only `tests/` (not vendored, not a protected path — the swarm may work it), is reversible by a one-line revert, and is proven by an existing test (the suite itself flips red→green). Not on the one-way-door list. Hence `ready-for-agent`, not `ready-for-session`. ## Agent Brief **Category:** bug **Summary:** `fleet-queue-test.sh` leaks `FLEET_DISPATCHER_URL` from the host env, reddening the fresh-LIVE-ack stand-down check on any host that declares one (the dispatcher host). **Current behavior:** The fleet-queue test suite exports its own state-dir vars in the header but does not neutralise `FLEET_DISPATCHER_URL`/`FLEET_DISPATCHER_TOKEN`. On a host where those are set in the environment, the slot-report emit that runs before the gates calls the real send path, which POSTs to the (test-shimmed) dispatcher, gets a non-2xx, and records a *dead* ack — overwriting the crafted fresh `true true` acting-ack the stand-down case depends on. The ack then reads stale/dead, the tick proceeds to list, and the check `a tick with a fresh LIVE ack stands down …` fails (`47 passed, 1 failed`). On CI and any host with no dispatcher URL, send is a no-op, the crafted ack survives, and the suite is green — so the red is invisible to CI and bites only the dispatcher host's offline runs. **Desired behavior:** The suite is hermetic with respect to the host's dispatcher configuration: every case exercises only the state it crafts, and the full suite passes identically on a dispatcher host and a non-dispatcher host. **Key interfaces:** - The test's own environment setup (the block that exports `FLEET_*`/`HOST_*` state paths) should also pin the dispatcher-send inputs to empty so the real send path is a no-op, letting the crafted `FLEET_DISPATCH_ACK_STATE` be the only ack the gate reads. - No harness-code change. The stand-down ordering in `fleet-queue.sh` (`fleet_queue_slot_free` gate before `fleet_slot_report_acked_fresh`) is correct and out of scope — the failure does not involve real slot/disk state. **Acceptance criteria:** - [ ] `bash tests/fleet-queue-test.sh` reports `0 failed` with `FLEET_DISPATCHER_URL` and `FLEET_DISPATCHER_TOKEN` set in the environment (simulate the dispatcher host). - [ ] The same command reports `0 failed` with those vars unset (non-dispatcher host / CI parity preserved). - [ ] No change to any file outside `tests/`. **Out of scope:** - Any change to `fleet-queue.sh`, `fleet-slot-report-lib.sh`, or the gate ordering — this is a test-hermeticity fix only. - Closes the same clean-tree red tracked by #369 (duplicate — closed), and the pre-existing-red note in `docs/journal/2026-11-19-359.md` / `-364.md`.
Author
Member

swarm-claim host=matou-dev-server-01 run=28894
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=28894 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

⏩ independent reviewer for #368 — verdict unauthenticated

review JSON
{
  "verdict": "unauthenticated",
  "findings": []
}
:fast_forward: **independent reviewer** for #368 — verdict `unauthenticated` <details><summary>review JSON</summary> ```json { "verdict": "unauthenticated", "findings": [] } ``` </details>
Author
Member

close-report for #368 — status success

✅ close-report gates passed — every claim verified against the pushed worker branch sandcastle/worker/20261119185826-1049892 (pre-land — the host promotes it to main only after its post-run verify, #193/#283); issue closed.

envelope
{
  "issue": 368,
  "status": "success",
  "commits": [
    "2c5e585faace3c7bb369ce33b1e24cd4c8880b80"
  ],
  "changed_files": [
    "tests/fleet-queue-test.sh",
    "docs/journal/2026-11-19-368.md"
  ],
  "tests": [
    {
      "command": "bash tests/fleet-queue-test.sh",
      "exit_code": 0
    },
    {
      "command": "FLEET_DISPATCHER_URL=https://dispatch.test FLEET_DISPATCHER_TOKEN=tok bash tests/fleet-queue-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/docs-budget-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "ack-stand-down case passes on a host with FLEET_DISPATCHER_URL set": "tests/fleet-queue-test.sh now exports FLEET_DISPATCHER_URL=\"\" FLEET_DISPATCHER_TOKEN=\"\" in the header; run with those vars set yields 48 passed, 0 failed",
    "still passes where the var is unset (CI)": "plain run yields 48 passed, 0 failed",
    "no harness-code change (tests/ not vendored)": "changed_files are only tests/fleet-queue-test.sh and a journal entry"
  },
  "summary": "Made tests/fleet-queue-test.sh hermetic by neutralising FLEET_DISPATCHER_URL/TOKEN so the ack-stand-down case no longer reds on the dispatcher host.",
  "blockers": []
}
**close-report** for #368 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against the pushed worker branch `sandcastle/worker/20261119185826-1049892` (pre-land — the host promotes it to `main` only after its post-run verify, #193/#283); issue closed. <details><summary>envelope</summary> ```json { "issue": 368, "status": "success", "commits": [ "2c5e585faace3c7bb369ce33b1e24cd4c8880b80" ], "changed_files": [ "tests/fleet-queue-test.sh", "docs/journal/2026-11-19-368.md" ], "tests": [ { "command": "bash tests/fleet-queue-test.sh", "exit_code": 0 }, { "command": "FLEET_DISPATCHER_URL=https://dispatch.test FLEET_DISPATCHER_TOKEN=tok bash tests/fleet-queue-test.sh", "exit_code": 0 }, { "command": "bash tests/docs-budget-test.sh", "exit_code": 0 } ], "criteria": { "ack-stand-down case passes on a host with FLEET_DISPATCHER_URL set": "tests/fleet-queue-test.sh now exports FLEET_DISPATCHER_URL=\"\" FLEET_DISPATCHER_TOKEN=\"\" in the header; run with those vars set yields 48 passed, 0 failed", "still passes where the var is unset (CI)": "plain run yields 48 passed, 0 failed", "no harness-code change (tests/ not vendored)": "changed_files are only tests/fleet-queue-test.sh and a journal entry" }, "summary": "Made tests/fleet-queue-test.sh hermetic by neutralising FLEET_DISPATCHER_URL/TOKEN so the ack-stand-down case no longer reds on the dispatcher host.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#368
No description provided.