Skip to content

ci(install): assert host detection on all three platforms, not just the one - #3748

Merged
joelteply merged 4 commits into
canaryfrom
feat/install-detect-matrix
Sep 5, 2026
Merged

joelteply merged 4 commits into
canaryfrom
feat/install-detect-matrix

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Card b2e4a0bb.

The gap

carl-install-smoke is our only install check, and it is runs-on: ubuntu-latest with no matrix. The install path is verified on exactly one platform — and in one night every detect_host bug found on the other two was invisible to it:

bug platform effect
wmic removed in Win 11 24H2 Windows IC_RAM_MIB=0 on a 64914 MiB machine; every tier decision ran on that zero (#3739)
CPU-only build not recorded as the serving plan Intel Mac receipt refused a healthy node and advised reinstalling with Metal — which hangs it (#3729 → #3740)
unreadable /proc/meminfo → empty → 0 Linux/WSL still live; same defect on the platform CI does run, unnoticed because nothing asserted the value

Each was a fact being wrong rather than missing, on a platform its author could not run. Three operators, three boxes, and the shared CI checking the tier none of them installs on.

Why not a matrix on carl-install-smoke

That job is Docker-based and ~30 minutes. install-common.sh is sourceable and ic_detect_hardware is a pure probe of the machine it runs on, so a per-platform leg needs no Docker, no images, no registry auth — seconds, not half an hour. The Docker smoke stays the Linux end-to-end check; this is the cross-platform truth check.

What it asserts

Shape, not hardware. A CI runner is none of our boxes, and a test expecting an M5 or a 5090 fails for the wrong reason. What must hold everywhere:

  • platform is one of the recognised values (an unrecognised host falls to the *) arm, which records placeholders by construction)
  • RAM is a positive integer — a real machine always has RAM, so 0 is "we could not look" wearing the clothes of "there is none", and empty is the Linux failure shape
  • arch is determinate
  • gpu_kind is one of the declared values including none — "no GPU" and "we did not look" are different facts, and conflating them is what made the backend receipt refuse a working CPU-by-plan host

The Windows leg runs under Git Bash, the shell install.sh actually uses there (uname -s → MINGW64_NT-...), so it exercises the real branch rather than a WSL or PowerShell approximation. fail-fast: false because the point is to learn what all three report — failing fast hides the second bug behind the first, which is how these stayed hidden.

The mutation step

The job forces the RAM arm to the silent-zero shape that shipped on 24H2 and asserts the leg goes red, then restores.

Verified by hand on an Intel Mac before commit:

MUTATED EXIT: 1   FAIL ram — IC_RAM_MIB=0 — a host with no readable RAM figure
                              will be mis-tiered, silently
RESTORED EXIT: 0

Written after finding twice in one night that a green check can mean the checker never ran — a crashed linter counted as zero errors, and a pipe returned tail's exit status instead of cargo's.

Both triggers carry the same paths filter, per the comment on ts-persona-forbidden-strings-ratchet.yml where a missing filter on push produced 100/100 red and taught everyone to ignore the X.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

…he one

`carl-install-smoke` is our only install check and it is `runs-on:
ubuntu-latest` with no matrix. So the install path is verified on exactly one
platform — and in one night every detect_host bug found on the other two was
invisible to it:

  - Windows 11 24H2 REMOVED `wmic`, so the RAM arm fell through to its else
    branch and recorded IC_RAM_MIB=0 on a machine with 64914 MiB. Every
    downstream tier decision then ran on that zero, silently (#3739).
  - The Intel-Mac arm builds llama-server CPU-only because a Metal build hangs
    that hardware uninterruptibly — and nothing recorded that as the host's
    serving PLAN, so the backend receipt refused a healthy node and advised
    reinstalling with Metal, which would have hung it again (#3729 → #3740).
  - The Linux/WSL RAM arm still turns an unreadable /proc/meminfo into 0 with no
    warning: the same defect as the Windows one, on the platform CI DOES run,
    unnoticed because nothing asserted the value.

Each was a detect_host fact being WRONG rather than missing, on a platform its
author could not run. Three operators, three boxes, and the shared CI checking
the tier none of them installs on.

NOT A MATRIX ON carl-install-smoke: that job is Docker-based and ~30 minutes.
`install-common.sh` is sourceable and `ic_detect_hardware` is a pure probe of
the machine it runs on, so a per-platform leg needs no Docker, no images and no
registry auth — seconds, not half an hour. The Docker smoke stays the Linux
end-to-end check; this is the cross-platform truth check.

Assertions are about SHAPE, not hardware. A CI runner is none of our boxes and
a test expecting an M5 or a 5090 fails for the wrong reason. What must hold
everywhere is that the detector produced a DETERMINATE answer rather than a
silent placeholder: platform recognised, RAM a positive integer, arch known,
gpu_kind one of the declared values INCLUDING `none` — because "no GPU" and "we
did not look" are different facts, and conflating them is what made the backend
receipt refuse a working CPU-by-plan host.

The Windows leg runs under Git Bash, which is the shell install.sh actually
uses there (uname -s reports MINGW64_NT-...), so it exercises the real branch
rather than a WSL or PowerShell approximation. `fail-fast: false` because the
point is to learn what ALL three report — failing fast would hide the second
bug behind the first, which is how these stayed hidden.

The job also runs a MUTATION step: force the RAM arm to the silent-zero shape
that shipped on 24H2, assert the leg goes red, restore. Verified by hand on
this Intel Mac before commit — mutated exit 1 with "IC_RAM_MIB=0 — a host with
no readable RAM figure will be mis-tiered, silently", restored exit 0. Written
after finding twice in one night that a green check can mean the checker never
ran (a crashed linter counted as zero errors; a pipe returned tail's exit
status instead of cargo's).

Both triggers carry the same paths filter, per the comment on
ts-persona-forbidden-strings-ratchet.yml where a missing filter on `push`
produced 100/100 red and taught everyone to ignore the X.

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply and others added 3 commits September 5, 2026 03:57
… three

The Windows leg failed on its own mutation step, and the failure was correct.

My first cut patched the two expression shapes I could see from a Mac —
macOS's `IC_RAM_MIB=$(( $(sysctl …) ))` and Linux's `IC_RAM_MIB=$(awk …)`.
Windows's arm is a `case` over a captured variable since #3739, so neither
pattern matched, nothing was mutated, the assertions passed unchanged, and the
step reported exactly what had happened:

    host-detect-assert did NOT fail with RAM forced to 0 — the gate is dead.

That is the mutation step catching a hole in the mutation step. It is also the
same defect the whole PR is about, committed by me while writing the PR: I
wrote a check against the platforms I could see and shipped it to three.

Now patches by LINE rather than by expression — every `IC_RAM_MIB=` assignment
becomes 0 regardless of the shape the platform's arm happens to use — and
prints the count of mutated lines so a future no-op is visible in the log
instead of inferred from a passing gate. Verified locally: 4 lines mutated,
assert exits 1, restore exits 0.

WHAT THE WINDOWS LEG ALREADY PROVED, and it is the point of the matrix: its
ASSERTIONS all passed. `IC_PLATFORM=windows` on MINGW64_NT-10.0-26100, RAM a
positive integer, gpu_kind `none`. So #3739's Get-CimInstance fallback works on
a real 24H2-era runner — measured on a platform none of us can run, by the leg
that exists for that reason, on its first execution.

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
Second failure of the same kind, and the lesson is the PR's own thesis pointed
at me twice.

The mutation step must prove this gate can fail. My first cut patched the two
RAM-assignment shapes I could see from a Mac; Windows uses a `case` over a
captured variable since #3739, so nothing was mutated and the step reported the
gate dead. I fixed that with a line-wise regex — which patched four lines and
STILL left Windows reporting 16378 MiB, because replacing a whole line inside a
`case` arm does not do what replacing an assignment does.

Twice I wrote a platform-shaped mutation from the one platform I have, and both
times the thing that caught it was the mutation step refusing to pass. That is
the same defect this PR exists to prevent — a check written against the
platforms its author can see — committed inside the check itself.

So the defect is now injected where every platform CONVERGES: a
`HOST_DETECT_MUTATE_RAM` hook in the assert script, applied after
`ic_detect_hardware` returns and before the assertions run. Shape-independent,
cannot silently miss an arm, and it lives in CI scaffolding rather than in a
sed over production source — install-common.sh is no longer touched by the
test at all.

Verified locally, both directions:
    MUTATION: forcing IC_RAM_MIB=0 (was 32768)
    FAIL ram — IC_RAM_MIB=0 — a host with no readable RAM figure will be
               mis-tiered, silently
    mutated exit=1   clean exit=0

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
ce8b9074's gap on #3748, and it lands on a claim I had already made without
checking.

I said the green Windows leg "confirms #3739's Get-CimInstance fallback works
on a real 24H2-era runner". That is only true IF `wmic` was absent. `wmic` was
removed in Windows 11 24H2, but a runner that still has it takes the LEGACY arm
— the leg would pass, prove the old path, and say nothing about the fix. A
passing RAM check reports the answer, never how it was obtained, and I filled
in the how from what I wanted it to mean.

The leg now prints the precondition, so the log answers the question instead of
the reader assuming:

    wmic PRESENT — the RAM figure came from the legacy wmic arm; this run does
                   NOT exercise the Get-CimInstance fallback (#3739)
    wmic ABSENT (removed in Win11 24H2) — the RAM figure came from the
                   Get-CimInstance fallback (#3739)

with the equivalent one-liner for the macOS sysctl and Linux /proc/meminfo arms,
so every platform's log says which code actually ran.

ON THE SECOND GAP (unconditional restore): already closed by the previous
commit rather than by this one. The mutation moved from patching
install-common.sh to a HOST_DETECT_MUTATE_RAM hook in the assert script, so the
workflow no longer copies, edits or restores production source at all — there
is nothing left to restore conditionally or otherwise. Verified: no `cp` of a
backup remains in the workflow.

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@github-actions github-actions Bot added size: L and removed size: M labels Sep 5, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

M5-core review: NO OBJECTION. A new, non-required matrix workflow (ubuntu/macos/windows) asserting host-detect SHAPE with a mutation step that forces IC_RAM_MIB=0 and expects red — a gate that has been seen to fail. The paths: filter is fine here because this check is not a required context (the required-checks-run-on-every-PR law is about the required trio). Card b2e4a0bb closes with it.

@joelteply
joelteply merged commit b9e7d30 into canary Sep 5, 2026
9 checks passed
@joelteply
joelteply deleted the feat/install-detect-matrix branch September 5, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant