CI always-red on main: tests/collector-test.sh pins snapshot_version to a stale literal 1 (collector.py is at 4) #153

Closed
opened 2026-09-16 23:06:40 +00:00 by matou-build-agent · 2 comments

Symptom

The test workflow (.forgejo/workflows/ci.yml) is always red on main — the hourly watchdog flagged signature f742cd7e8575 (watchdog: always-red). Every test run in the evidence window failed:

run event ref sha
10919 pull_request #152 ac4943e
10922 push main 84a3677

No other workflow is red (swarm, resume, triage, watchdog all green in the same window — runs.json). Host is healthy (66G free, 6.1G avail RAM, api_seconds=1), swarm-lock free, no stuck git state.

Root cause

One offline gate fails; the other 40-odd pass. Reproduced in a fresh clone at 84a3677:

FAIL: tests/collector-test.sh
  d["snapshot_version"] => 4 (want 1)
FAIL: snapshot_version is present and versioned
collector-test: 16/17 checks passed

tests/collector-test.sh:92 hard-codes the literal version:

check "snapshot_version is present and versioned" 'assert_json "d[\"snapshot_version\"]" "1"'

PR #152 (ac4943e, factory-floor: pixel-art rooms, break room, queue room, click-through detail panels) bumped fleet-tui/collector.py's SNAPSHOT_VERSION 1 → 4 across four shape changes. It updated the two other consumers of that constant — fleet-tui/floor/server/protocol.js (EXPECTED_SNAPSHOT_VERSION = 4) and the pytest twin fleet-tui/tests/test_collector.py (which asserts == collector.SNAPSHOT_VERSION, so it is version-agnostic and stayed green) — but missed the bash gate's hard-coded "1". The PR's own CI was already red before the merge, and merging carried the red onto main.

So: a single stale literal, not a real regression in collector.py. Everything else in the suite is green on a clean checkout, and bash -n passes.

What to fix

  1. tests/collector-test.sh:92 — stop pinning the version literal. Derive it from the module the way the pytest twin does (read collector.SNAPSHOT_VERSION in the same python3 heredoc and assert the emitted document matches it), so a deliberate shape bump can never fail this check for the wrong reason. Keep a check that the key is present and an int — that is the property worth gating; the number is not.
  2. Consider whether the same class of drift is live elsewhere: protocol.js's EXPECTED_SNAPSHOT_VERSION is a legitimate independent pin (it is the wire contract), but it is currently kept in step by hand across three files. A one-line note in the collector's docstring naming every place that must move together would stop the next bump repeating this.

Acceptance criteria

  • bash tests/collector-test.sh passes at current main (17/17).
  • The full offline suite is green: for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done prints no FAIL:.
  • The snapshot-version check still fails if collector.py stops emitting snapshot_version, or emits a non-integer — prove it by temporarily breaking the emitter.
  • Bumping SNAPSHOT_VERSION alone (without any other change) does not turn tests/collector-test.sh red.
  • STATUS.md updated in the same commit (repo rule).

Notes

  • Class: product — the fault is in the factory source at the repo root (tests/), so the healer did not touch it.
  • ci.yml checks out the repo root and runs root tests/, so this fix turns CI green the moment it lands on main — no re-vendor needed for the CI gate. (The vendored self-copy at FACTORY_REF 2445159 predates collector-test.sh entirely, and fleet-tui/** is vendor-excluded, so no consumer is affected either way.)
  • Filed by the swarm healer from evidence dir /tmp/matou-heal-Matou-dev-factory.j10rw3 (watchdog mode, signature f742cd7e8575).
## Symptom The `test` workflow (`.forgejo/workflows/ci.yml`) is **always red on `main`** — the hourly watchdog flagged signature `f742cd7e8575` (`watchdog: always-red`). Every `test` run in the evidence window failed: | run | event | ref | sha | |---|---|---|---| | [10919](https://git.matou.nz/Matou/dev-factory/actions/runs/10919) | pull_request | #152 | `ac4943e` | | [10922](https://git.matou.nz/Matou/dev-factory/actions/runs/10922) | push | main | `84a3677` | No other workflow is red (`swarm`, `resume`, `triage`, `watchdog` all green in the same window — `runs.json`). Host is healthy (66G free, 6.1G avail RAM, `api_seconds=1`), `swarm-lock` free, no stuck git state. ## Root cause One offline gate fails; the other 40-odd pass. Reproduced in a fresh clone at `84a3677`: ``` FAIL: tests/collector-test.sh d["snapshot_version"] => 4 (want 1) FAIL: snapshot_version is present and versioned collector-test: 16/17 checks passed ``` `tests/collector-test.sh:92` hard-codes the literal version: ```sh check "snapshot_version is present and versioned" 'assert_json "d[\"snapshot_version\"]" "1"' ``` PR #152 (`ac4943e`, *factory-floor: pixel-art rooms, break room, queue room, click-through detail panels*) bumped `fleet-tui/collector.py`'s `SNAPSHOT_VERSION` **1 → 4** across four shape changes. It updated the two *other* consumers of that constant — `fleet-tui/floor/server/protocol.js` (`EXPECTED_SNAPSHOT_VERSION = 4`) and the pytest twin `fleet-tui/tests/test_collector.py` (which asserts `== collector.SNAPSHOT_VERSION`, so it is version-agnostic and stayed green) — but missed the bash gate's hard-coded `"1"`. The PR's own CI was already red before the merge, and merging carried the red onto `main`. So: a single stale literal, not a real regression in `collector.py`. Everything else in the suite is green on a clean checkout, and `bash -n` passes. ## What to fix 1. `tests/collector-test.sh:92` — stop pinning the version literal. Derive it from the module the way the pytest twin does (read `collector.SNAPSHOT_VERSION` in the same `python3` heredoc and assert the emitted document matches it), so a deliberate shape bump can never fail this check for the wrong reason. Keep a check that the key is **present and an int** — that is the property worth gating; the *number* is not. 2. Consider whether the same class of drift is live elsewhere: `protocol.js`'s `EXPECTED_SNAPSHOT_VERSION` is a legitimate independent pin (it is the wire contract), but it is currently kept in step by hand across three files. A one-line note in the collector's docstring naming every place that must move together would stop the next bump repeating this. ## Acceptance criteria - `bash tests/collector-test.sh` passes at current `main` (17/17). - The full offline suite is green: `for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done` prints no `FAIL:`. - The snapshot-version check still fails if `collector.py` stops emitting `snapshot_version`, or emits a non-integer — prove it by temporarily breaking the emitter. - Bumping `SNAPSHOT_VERSION` alone (without any other change) does **not** turn `tests/collector-test.sh` red. - `STATUS.md` updated in the same commit (repo rule). ## Notes - **Class: product** — the fault is in the factory source at the repo root (`tests/`), so the healer did not touch it. - `ci.yml` checks out the repo root and runs root `tests/`, so **this fix turns CI green the moment it lands on `main`** — no re-vendor needed for the CI gate. (The vendored self-copy at `FACTORY_REF` `2445159` predates `collector-test.sh` entirely, and `fleet-tui/**` is vendor-excluded, so no consumer is affected either way.) - Filed by the swarm healer from evidence dir `/tmp/matou-heal-Matou-dev-factory.j10rw3` (watchdog mode, signature `f742cd7e8575`).
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=10934
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=10934 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #153 — status success

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

envelope
{
  "issue": 153,
  "status": "success",
  "commits": [
    "0d3f441"
  ],
  "changed_files": [
    "tests/collector-test.sh",
    "fleet-tui/collector.py",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "bash tests/collector-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": {
    "bash tests/collector-test.sh passes at current main (17/17)": "collector-test: 17/17 checks passed",
    "full offline suite green (no FAIL:)": "ran the suite loop; no FAIL: printed",
    "check still fails if collector stops emitting snapshot_version or emits a non-integer": "proven by temporarily editing the emitter: str() emit => FAIL (want an int), key-drop => None (want an int)",
    "bumping SNAPSHOT_VERSION alone does not turn the check red": "proven: set SNAPSHOT_VERSION=99 alone => 17/17 (version derived from collector.SNAPSHOT_VERSION)",
    "STATUS.md updated in the same commit": "commit 0d3f441 changes STATUS.md (header + milestone log)"
  },
  "summary": "tests/collector-test.sh now derives snapshot_version from collector.SNAPSHOT_VERSION and gates present+int+matches, ending the stale-literal always-red CI.",
  "blockers": []
}
**close-report** for #153 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 153, "status": "success", "commits": [ "0d3f441" ], "changed_files": [ "tests/collector-test.sh", "fleet-tui/collector.py", "STATUS.md" ], "tests": [ { "command": "bash tests/collector-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": { "bash tests/collector-test.sh passes at current main (17/17)": "collector-test: 17/17 checks passed", "full offline suite green (no FAIL:)": "ran the suite loop; no FAIL: printed", "check still fails if collector stops emitting snapshot_version or emits a non-integer": "proven by temporarily editing the emitter: str() emit => FAIL (want an int), key-drop => None (want an int)", "bumping SNAPSHOT_VERSION alone does not turn the check red": "proven: set SNAPSHOT_VERSION=99 alone => 17/17 (version derived from collector.SNAPSHOT_VERSION)", "STATUS.md updated in the same commit": "commit 0d3f441 changes STATUS.md (header + milestone log)" }, "summary": "tests/collector-test.sh now derives snapshot_version from collector.SNAPSHOT_VERSION and gates present+int+matches, ending the stale-literal always-red CI.", "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#153
No description provided.