Skip to content

fix(dash): report unpriced components in tokens, state the cache-frozen ceiling, and export the counters that only reached /stats - #155

Merged
OsherElhadad merged 1 commit into
rossoctl:mainfrom
OsherElhadad:feat/dashboard-honesty-0901
Sep 1, 2026
Merged

OsherElhadad merged 1 commit into
rossoctl:mainfrom
OsherElhadad:feat/dashboard-honesty-0901

Conversation

@OsherElhadad

Copy link
Copy Markdown
Collaborator

Eight fixes to the dashboard's honesty surface, found by driving the live UI in a real browser
rather than by reading it. Every one is a place where the page either asserted a number it could
not compute, or hid one it already had.

⚠️ One operational note, up front

cg_frozen_decisions_total steps from a hard-wired 0 to real values. All four outcomes were
reading Snapshot fields that only the /stats handler fills, while renderMetrics holds the bare
snapshot — so the series reported 0 on every scrape regardless of state, and the observability for
the freeze-replay mechanism read permanently healthy. Anyone alerting on it was alerting on a
constant and will see a step change at deploy. That is the fix landing, not an incident. Filed
separately as #154.

The UI fixes

# What was wrong Fix
1 The value-breakdown panel rendered every unpriced component as a green $0 under the heading "Where the value comes from". On /compact traffic that is all of them — collapse had removed 112,151 unique tokens and its tile said $0, while the Cost tiles eight lines above honestly read unknown. Reuse the sibling declaration-filter tile's priced-ness check, which already had the rule written out: "an unpriced model must not make a real saving read as $0.00". Now 60k tok in neutral tone. A component that genuinely saved nothing still reads $0 — that zero is a computed truth, not an unknown.
2 The first savings bar drew a ratio on a share scale: gross-over-attempted is correctly >100% (attempted_tokens is re-counted every turn) but rendered as 158.17% pinned full inside a track that is 100% by construction, as the first figure on the page. Render a bare multiple with no track. The arithmetic is untouched — only the presentation lied. The other three denominators are shares and are unchanged, and the "Missing inputs read n/a, never 0" contract still holds.
3 New: nothing on the page told a reader that the cache-frozen prefix is the explanation for the four ratios above it. frozen_tokens was present only as a cost row in the safety panel. One caption: "Compaction was allowed to touch 29.2% of these tokens; the other 70.8% sat in the already-cached prefix (616k frozen ÷ 869k attempted + frozen)." Uses the same top-level fields the "What compaction could reach" tiles already read, so caption and tiles cannot drift. Reports "no ceiling computable" rather than 0% when nothing was frozen.
4 Dark-mode --good/--bad — the pair the waterfall asks a reader to distinguish as adjacent bars — failed deuteranopia separation and sat outside the dark lightness band. Re-stepped in-band with separation restored. These tokens are also text ink (.good-text, .tile.good .v, .banner.ok), so ≥4.5:1 AA against all three dark grounds was a hard constraint — which is why separation had to come from hue and chroma rather than a lightness gap. Light pair and the four categorical series steps untouched.
5 collapse's char_window is an event, not a gate, and rendered under a header reading "Why declined" on rows that had acted. Header now reads "Why / what happened". The cell stays merged — dash/event.go:417 records that the merge fixed a real empty-cell bug; only the header was never revisited.
6 That column sat at x=2087 in a 2628px table — off-screen at 1600px — though docs/dashboard.md:325 calls it "the column to read when act rate is 0%… without it a table of zeros is unfalsifiable." Six of eleven components had a 0.0% act rate on the observed traffic. Moved to immediately after Act rate (now thLeft=613, visible). The <th>, the COMPONENT_SORT key array and the row builder all shifted together, so the table stays 21 headers to 21 cells with each row's data under its own header.

Palette validation (checker, not eyeballed):

BEFORE  dark  #3fbe7f <-> #ef6f63   deutan dE 4.1  FAIL   L 0.716/0.693 vs band 0.48-0.67  FAIL
AFTER   dark  #52a27a <-> #f84e3a   deutan dE 9.7  PASS   L 0.650/0.663                    PASS
                                    chroma PASS · normal dE 28.4 PASS · contrast PASS

The new green sits closer to the --s3 series step (normal ΔE 3.4, was 7.4). Verified by grepping
usage that the collision is unreachable: --s3 reaches the DOM only through SERIES/SERIES_SAVED
(legended line charts and one paired bar), never as status ink; --good is a chart mark in exactly
one place (the waterfall, app.js:1815), whose neighbours are --bad and SERIES[0]. No chart
draws both in the same mark set.

The metrics fixes

/compact?preset= rows were labelled with the wrong preset. The capture recorded the tenant's
preset, but a per-request ?preset= (or x-context-guru-pipeline) actually swaps the pipeline —
and proxy.go:594 documents /compact as the endpoint for offline replay and evaluation, where
the whole point is comparing presets. So every row carried the process default and the dashboard's
preset facet silently collapsed an A/B into one bucket. The tenant default remains the fallback (that
reasoning is still correct for hosted deployments). A raw pipeline header records custom — the
label main.go:756 already uses for exactly that — never a preset name that did not run.

model=m-default  preset=codesmart  components=[... extract_llm extract linecap cachesplit]
model=m-preset   preset=codesafe   components=[... extract collapse linecap cachesplit]
model=m-header   preset=custom     components=[format textclean]

collapse appears only in the codesafe row and extract_llm only in codesmart, so the label
names the pipeline that ran. Before the fix all three read codesmart.

cg_expand_unresolved_total is now exported, with reason="malformed" / reason="missing".
metrics/metrics.go calls it "the ALERTABLE one" and it reached /stats only, while
cg_expand_bounces_total sitting directly beside it worked — which is what made the gap hard to
spot by reading.

And the reason both gaps survived: promexport.go is a hand-maintained list of promLine calls
with nothing asserting that every Snapshot field is either exported or deliberately exempt.
promexport_coverage_test.go now reflects over all 66 fields and requires each to be exported or
listed with an honest reason. Stale entries fail too, so the list cannot rot.

Fourteen fields are recorded there as genuine unexported gaps rather than exempted to make the
test pass — including Summarize{Timeouts,Errors} and AgentDiet{Timeouts,Errors} (how you would
notice an LLM component silently failing) and AttemptedTokens/FrozenTokens (two of the four
savings denominators). Tracked separately rather than expanded into this diff.

The test's limits are stated in its own comment. It cannot detect a field that is exported but
hard-wired to a constant — a field read from s passes whatever it renders — so it would not
have caught the frozen-decisions bug above. Catching that class needs a render seam renderMetrics
does not have, and inventing one for a test hook was out of scope. Better to state the boundary than
to imply coverage that isn't there.

Verification

CGO_ENABLED=1 go build ./...                      exit=0
CGO_ENABLED=0 go build ./cmd/context-guru-proxy   exit=0   (the configuration that ships)
go vet ./dash/... ./proxy/...                     exit=0
go test -count=1 ./proxy/... ./metrics/... ./dash/... ./config/...
  ok proxy 44.6s · ok metrics 0.014s · ok dash 79.3s · ok config 8.4s
  • UI driven in headless Chromium on a live proxy with real traffic, both themes, zero JS console
    errors
    on every view (console, pageerror and requestfailed all captured).
  • The n/a branch of the new caption forced with real traffic (CACHE_MODE=off → frozen 0),
    not a stub, and confirmed to render the ambiguity honestly rather than pick a story: there is no
    cache-aware aggregate on the wire, so it says nothing-was-frozen or not-cache-aware.
  • The frozen-metric fix proven with a paired before/after on identical traffic — 0/0 → 2
    hits / 10 misses, matching /stats in the same process. No golden file needed regenerating.

No new dependency, no build step, no CDN reference — dash/ui/ stays hand-written and air-gapped.

…en ceiling, and export the counters that only reached /stats

Eight fixes to the dashboard's honesty surface, found by driving the live UI in a
real browser rather than by reading it. Every one of them is a place where the page
either asserted a number it could not compute, or hid one it already had.

- The value-breakdown panel rendered every unpriced component as a green $0 under
  the heading "Where the value comes from". On /compact traffic that is all of them:
  collapse had removed 112,151 unique tokens and its tile said $0, while the Cost
  tiles eight lines above honestly read "unknown". Reuses the sibling declaration-
  filter tile's priced-ness check, which already had the rule written out.
- The first savings bar drew a ratio on a share scale: gross-over-attempted is
  correctly >100% (attempted_tokens is re-counted every turn) but rendered as
  "158.17%" pinned full inside a 100% track. Now a bare multiple with no track. The
  arithmetic is untouched; only the presentation lied.
- New: one caption naming the cache-frozen ceiling as the EXPLANATION for the four
  ratios above it. frozen_tokens was on the page only as a cost row, so nothing told
  a reader why the savings plateau. Reports "no ceiling computable" rather than 0%
  when nothing was frozen.
- Dark-mode --good/--bad failed deuteranopia separation (deutan dE 4.1) and sat
  outside the dark lightness band. Re-stepped to dE 9.7 in-band, holding >=4.5:1 AA
  against all three dark grounds since these tokens are also text ink. Light pair
  and the four categorical series steps untouched.
- "Why declined" now reads "Why / what happened": collapse's char_window is an
  event, not a gate, and rendered under a decline-only header on rows that acted.
- That column sat at x=2087 in a 2628px table, off-screen at 1600px, though it is
  the column that makes a 0.0% act rate falsifiable. Moved beside Act rate.
- /compact rows were labelled with the tenant's preset, not the ?preset= override
  that actually ran, so an eval sweep's A/B silently collapsed into one bucket.
  The tenant default stays the fallback; a raw x-context-guru-pipeline header
  records "custom", never a preset name that did not run.
- cg_expand_unresolved_total is now exported. metrics.go calls it "the ALERTABLE
  one" and it reached /stats only, while cg_expand_bounces_total beside it worked.

Two things the exporter work turned up:

cg_frozen_decisions_total reported 0 on every scrape. All four outcomes read
Snapshot fields that only the /stats handler fills, while renderMetrics holds the
bare Snapshot -- so the observability for the freeze-replay mechanism read
permanently healthy. Now sourced as /stats does. NOTE FOR OPERATORS: these four
series step from a hard-wired 0 to real values. Anyone alerting on them was
alerting on a constant and will see a step change at deploy. That is the fix
landing, not an incident.

promexport.go is a hand-maintained list with nothing asserting that every Snapshot
field is exported or deliberately exempt, which is how both gaps above survived.
promexport_coverage_test.go reflects over Snapshot's 66 fields and requires each to
be exported or listed with an honest reason; stale entries fail too, so the list
cannot rot. Fourteen fields are recorded there as genuine unexported gaps rather
than exempted to make the test pass.

The test's limits are stated in its own comment: it cannot detect a field that is
exported but hard-wired to a constant, so it would not have caught the frozen bug
above -- catching that class needs a render seam renderMetrics does not have.

Verified: CGO_ENABLED=1 and CGO_ENABLED=0 builds clean, go vet clean, and
proxy/metrics/dash/config green uncached. UI changes driven in headless Chromium in
both themes with zero console errors; the palette change validated with a
colourblind-separation checker rather than by eye; the frozen-metric fix proven with
a paired before/after on identical traffic (0/0 -> 2 hits/10 misses, matching /stats
in the same process).

Signed-off-by: Osher-Elhadad <[email protected]>
@OsherElhadad
OsherElhadad merged commit 3ebc65d into rossoctl:main Sep 1, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Sep 1, 2026
amiddavid added a commit that referenced this pull request Sep 1, 2026
None of this is distribution work. Every item is a defect in code or docs that already shipped,
found while doing #141, and split out at review request so it can be judged on its own — and so it
can land whether or not the funnel does.

## 1. The expand tool was advertised where no marker can exist

`expand.Inject` under `auto` gated on "the request declares tools" and "the store persists".
Nothing asked whether the pipeline could produce a `<<cg:HASH>>` marker at all, so an
offloader-free pipeline declared `context_guru_expand` to the provider — and every call against it
must fail, because there is nothing in the Store to resolve. Measured on the real gateway route:

  tools SENT by client    : [Read Bash]
  tools FORWARDED upstream: [Read Bash context_guru_expand]

Affected `safe` and any cachesplit-only configuration, and — the one that matters most — **`off`,
the A/B control arm**. A control that carries an extra tool declaration is not a control, and every
measurement taken against it was comparing two arms that differed by more than the pipeline.

The cost when it fires is a wasted round trip and a step of the user's turn: on a transcript
containing marker-shaped text (this repo's own docs contain literal `<<cg:HASH>>`), a model calls
the tool and gets "[expand: original for id ... is no longer available]".

It was also a code-vs-comment contradiction, which is why nobody noticed: `Options.InjectExpand`
documented the gate as requiring "an expandable marker", while `expand/inject.go` says "No marker
condition, deliberately" three lines from the code. Both now describe what happens.

`components.Pipeline.HasOffload()` answers by TYPE ASSERTION, not a list of component names: a
name list is a second copy of "which components are lossy" and drifts the moment somebody adds
one. `components.Offload` cannot be implemented by accident — it requires returning cache keys
proving the original was stashed. Marker independence is preserved (the property that keeps the
tools array byte-stable across a session, and hence the prefix cached): a pipeline does not change
turn to turn.

**Ten existing tests changed fixture.** Every test of the expand loop hand-seeds the Store to
simulate an offload, but built its handler with `pipeline: []` — which cannot offload anything.
Harmless while injection ignored the pipeline; now they use `offloadCapablePipeline` (`[linecap]`,
which does not act on their short bodies). No assertion was weakened; each fixture now matches its
own premise.

## 2. `POST /v1/messages/count_tokens` was not served

Absent it, a client asking how big its context is gets a 404 and falls back to working it out with
**inference requests** — billed calls, caused by a proxy whose purpose is to reduce them. Cheap to
add, and it costs every routed user, not only the funnel.

Forwarded verbatim, with no pipeline. Returning the compacted count would be smaller and would be
wrong in the dangerous direction: the client budgets its own transcript from this number, and
because every component fails open, the next request could forward the full body and take a 400.
Over-reporting is recoverable; under-reporting is a failed turn. The cost of that choice is now
documented in `docs/reference/routes.md`, where the route was absent entirely — a routed session
self-compacts earlier than it needs to (115,933 reported vs 32,802 forwarded on a measured body).

The hosted branch has tests, because that branch is the only thing standing between the
multi-tenant service and an unmetered open forwarder that would send OUR credential upstream.

## 3. Our own docs said the binary needs a C toolchain

`docs/setup.md`, `docs/hosted.md` and `docs/get-started/quickstart-proxy.md` all told evaluators to
install one. It is needed for `go test -race` and for the optional `cg_skeleton` tag, not for the
binary. setup.md went further and named **bifrost's tokenizer** as a cgo dependency, which it never
was — o200k_base is embedded (`internal/tokens/tokens.go`).

Asserted rather than re-claimed: a new `purego` CI job builds with `CGO_ENABLED=0` and
`CC=/nonexistent-c-compiler`, checks the artifact is statically linked, starts it and probes
/healthz. It also runs the packages whose behaviour depends on which components compile in —
because `build-test` runs exclusively with `CGO_ENABLED=1` (the race detector needs it), so
`TestEveryPresetBuilds` had **never executed in the configuration a user would build**. That guard
exists for exactly the `preset: coding` / `unknown component "skeleton"` breakage.

## 4. Preset facts stated outside the guarded files (#143, #145)

- The binary defaults to **`house`**; five sites said `codesmart` (README x3,
  `docs/reference/config.md`, `docs/get-started/quickstart-proxy.md` — the last is step 2 of the
  first page anyone runs). Anyone running the binary bare while reading those measured a different
  configuration than the published SWE-bench numbers describe.
- README's `codesmart`/`codesafe` pipeline lists and
  `docs/get-started/connect-ibm-service.md`'s "Default pipeline" were stale — naming `toon`,
  retired after acting 0 of 5,752 production requests, and omitting components that do run.
  The IBM page's omission of `toolfilter` matters most: that page is what a prospective hosted
  tenant reads to decide what the service does to their traffic.

All regenerated from the `presets` map. The two tables inside #142's drift guard are untouched
here; these are the sites that guard cannot reach.

## Verification

Five mutations, each proven to have landed in the source before its result was allowed to count:

  expand injection ungated        -> TestExpandToolIsAdvertisedOnlyWhereMarkersCanExist FAIL
    on cachesplit-only, `safe`, and `off`
  HasOffload always false         -> same test FAIL on `mcp` and the offloader pipeline: "mints
    markers but no longer advertises the expand tool, so a model cannot recover what it offloaded"
  count_tokens route unregistered -> TestCountTokensIsServed FAIL (404)
  count_tokens rewrites the body  -> TestCountTokensIsServed FAIL
  hosted auth removed             -> TestCountTokensHostedRequiresAuth FAIL (502, want 401)

The second is the mirror-image check: it proves the gate did not trade one silent defect for
another, an offloader whose output nothing can expand.

Two things I got wrong on the way, recorded because both were caught by tests rather than by me:

- I first asserted `mcp` had no offloader. `smartcrush` implements `components.Offload`
  (`components/offload/smartcrush.go`), so that pipeline genuinely mints markers and genuinely
  needs the tool. The case now asserts the opposite, with the reason — and it is the argument for
  asking the interface rather than keeping a hand-written list.
- Copying `proxy/proxy.go` wholesale from the older distribution branch onto current main silently
  reverted #155's `effPreset`/`notePreset` work. `TestCompactRowNamesThePresetThatRan` — a test I
  had never read — failed with "the dashboard names a pipeline that did not run". The file was
  restored from main and the two edits re-applied on top; #155's change is intact.

`go build ./...`, `go vet ./...`, `gofmt -l` and the full `go test ./...` are clean.

One unrelated flake seen once and not reproduced: `TestConcurrentCallsDoNotRaceOnTheGateHistogram`
failed in a full-suite run with "no single-flight follower ran ... the race was never exercised",
then passed 8/8 in isolation and in two further full suites, and passes on clean main. Reported
separately rather than papered over.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
OsherElhadad pushed a commit that referenced this pull request Sep 1, 2026
…pand-tool gate, count_tokens, C-toolchain claim, preset facts) (#161)

* fix: defects that surfaced while building the distribution funnel

None of this is distribution work. Every item is a defect in code or docs that already shipped,
found while doing #141, and split out at review request so it can be judged on its own — and so it
can land whether or not the funnel does.

## 1. The expand tool was advertised where no marker can exist

`expand.Inject` under `auto` gated on "the request declares tools" and "the store persists".
Nothing asked whether the pipeline could produce a `<<cg:HASH>>` marker at all, so an
offloader-free pipeline declared `context_guru_expand` to the provider — and every call against it
must fail, because there is nothing in the Store to resolve. Measured on the real gateway route:

  tools SENT by client    : [Read Bash]
  tools FORWARDED upstream: [Read Bash context_guru_expand]

Affected `safe` and any cachesplit-only configuration, and — the one that matters most — **`off`,
the A/B control arm**. A control that carries an extra tool declaration is not a control, and every
measurement taken against it was comparing two arms that differed by more than the pipeline.

The cost when it fires is a wasted round trip and a step of the user's turn: on a transcript
containing marker-shaped text (this repo's own docs contain literal `<<cg:HASH>>`), a model calls
the tool and gets "[expand: original for id ... is no longer available]".

It was also a code-vs-comment contradiction, which is why nobody noticed: `Options.InjectExpand`
documented the gate as requiring "an expandable marker", while `expand/inject.go` says "No marker
condition, deliberately" three lines from the code. Both now describe what happens.

`components.Pipeline.HasOffload()` answers by TYPE ASSERTION, not a list of component names: a
name list is a second copy of "which components are lossy" and drifts the moment somebody adds
one. `components.Offload` cannot be implemented by accident — it requires returning cache keys
proving the original was stashed. Marker independence is preserved (the property that keeps the
tools array byte-stable across a session, and hence the prefix cached): a pipeline does not change
turn to turn.

**Ten existing tests changed fixture.** Every test of the expand loop hand-seeds the Store to
simulate an offload, but built its handler with `pipeline: []` — which cannot offload anything.
Harmless while injection ignored the pipeline; now they use `offloadCapablePipeline` (`[linecap]`,
which does not act on their short bodies). No assertion was weakened; each fixture now matches its
own premise.

## 2. `POST /v1/messages/count_tokens` was not served

Absent it, a client asking how big its context is gets a 404 and falls back to working it out with
**inference requests** — billed calls, caused by a proxy whose purpose is to reduce them. Cheap to
add, and it costs every routed user, not only the funnel.

Forwarded verbatim, with no pipeline. Returning the compacted count would be smaller and would be
wrong in the dangerous direction: the client budgets its own transcript from this number, and
because every component fails open, the next request could forward the full body and take a 400.
Over-reporting is recoverable; under-reporting is a failed turn. The cost of that choice is now
documented in `docs/reference/routes.md`, where the route was absent entirely — a routed session
self-compacts earlier than it needs to (115,933 reported vs 32,802 forwarded on a measured body).

The hosted branch has tests, because that branch is the only thing standing between the
multi-tenant service and an unmetered open forwarder that would send OUR credential upstream.

## 3. Our own docs said the binary needs a C toolchain

`docs/setup.md`, `docs/hosted.md` and `docs/get-started/quickstart-proxy.md` all told evaluators to
install one. It is needed for `go test -race` and for the optional `cg_skeleton` tag, not for the
binary. setup.md went further and named **bifrost's tokenizer** as a cgo dependency, which it never
was — o200k_base is embedded (`internal/tokens/tokens.go`).

Asserted rather than re-claimed: a new `purego` CI job builds with `CGO_ENABLED=0` and
`CC=/nonexistent-c-compiler`, checks the artifact is statically linked, starts it and probes
/healthz. It also runs the packages whose behaviour depends on which components compile in —
because `build-test` runs exclusively with `CGO_ENABLED=1` (the race detector needs it), so
`TestEveryPresetBuilds` had **never executed in the configuration a user would build**. That guard
exists for exactly the `preset: coding` / `unknown component "skeleton"` breakage.

## 4. Preset facts stated outside the guarded files (#143, #145)

- The binary defaults to **`house`**; five sites said `codesmart` (README x3,
  `docs/reference/config.md`, `docs/get-started/quickstart-proxy.md` — the last is step 2 of the
  first page anyone runs). Anyone running the binary bare while reading those measured a different
  configuration than the published SWE-bench numbers describe.
- README's `codesmart`/`codesafe` pipeline lists and
  `docs/get-started/connect-ibm-service.md`'s "Default pipeline" were stale — naming `toon`,
  retired after acting 0 of 5,752 production requests, and omitting components that do run.
  The IBM page's omission of `toolfilter` matters most: that page is what a prospective hosted
  tenant reads to decide what the service does to their traffic.

All regenerated from the `presets` map. The two tables inside #142's drift guard are untouched
here; these are the sites that guard cannot reach.

## Verification

Five mutations, each proven to have landed in the source before its result was allowed to count:

  expand injection ungated        -> TestExpandToolIsAdvertisedOnlyWhereMarkersCanExist FAIL
    on cachesplit-only, `safe`, and `off`
  HasOffload always false         -> same test FAIL on `mcp` and the offloader pipeline: "mints
    markers but no longer advertises the expand tool, so a model cannot recover what it offloaded"
  count_tokens route unregistered -> TestCountTokensIsServed FAIL (404)
  count_tokens rewrites the body  -> TestCountTokensIsServed FAIL
  hosted auth removed             -> TestCountTokensHostedRequiresAuth FAIL (502, want 401)

The second is the mirror-image check: it proves the gate did not trade one silent defect for
another, an offloader whose output nothing can expand.

Two things I got wrong on the way, recorded because both were caught by tests rather than by me:

- I first asserted `mcp` had no offloader. `smartcrush` implements `components.Offload`
  (`components/offload/smartcrush.go`), so that pipeline genuinely mints markers and genuinely
  needs the tool. The case now asserts the opposite, with the reason — and it is the argument for
  asking the interface rather than keeping a hand-written list.
- Copying `proxy/proxy.go` wholesale from the older distribution branch onto current main silently
  reverted #155's `effPreset`/`notePreset` work. `TestCompactRowNamesThePresetThatRan` — a test I
  had never read — failed with "the dashboard names a pipeline that did not run". The file was
  restored from main and the two edits re-applied on top; #155's change is intact.

`go build ./...`, `go vet ./...`, `gofmt -l` and the full `go test ./...` are clean.

One unrelated flake seen once and not reproduced: `TestConcurrentCallsDoNotRaceOnTheGateHistogram`
failed in a full-suite run with "no single-flight follower ran ... the race was never exercised",
then passed 8/8 in isolation and in two further full suites, and passes on clean main. Reported
separately rather than papered over.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>

* ci(purego): run one package binary at a time

The new job runs `go test` over five package trees, and `go test` starts up to GOMAXPROCS package
binaries in parallel. On a 2-core CI runner that added a second heavily-parallel run of the proxy
package per PR, and under that contention a timing-sensitive control-plane test from #150
(TestCtlGetCampaignAggregatesPredictedAndRealPerTenant) failed on two unrelated PRs — then passed on
a re-run of the same commit, and passes 3/3 whole-package on a 16-core box against both main and the
affected branch. Filed as #163.

Hunting that flake is not this job's business. Not provoking it is: `-p 1` costs about a minute and
removes the contention this job introduced, without dropping any coverage.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>

* fix: make this PR's own prose true, and unit-test HasOffload

Review of #161 found the same defect this PR is themed on — claims that are not true — in seven more
places, one of them in shipped code. All seven fixed, plus the `HasOffload` unit test the reviewer
raised without asking for.

Rebased onto current main first, so #142's preset-table guard and the preset pass below cannot
re-fix or re-break each other.

## Merge-blocking

**1. `proxy/proxy.go` named `mcp` as offloader-free.** It is not: `smartcrush` implements
components.Offload, which this PR's own test asserts (`wantAdd: true`) and its own mirror-image
mutation proves. I had corrected the test and left the comment wrong — the copy a future reader
actually trusts.

The fix deletes the list rather than correcting it. The comment now names the shapes affected
(`off`, `safe`, any cachesplit-only configuration) and then says why enumerating presets here is the
wrong move: a list in a comment is a second source of truth, and this one was wrong about `mcp` on
its first draft. That is the whole argument for gating on the interface.

**2. Five sites named the `cache` preset, which does not exist on this base.** It is #141's, and it
reached here in the wholesale copy of `proxy/proxy.go` this PR already admits to, then travelled
into the test files when they were split out of that branch. Reworded to name configurations that
exist here; the underlying defect they describe is unchanged and still reproduces on `off` and
`safe`.

**3. `proxy/counttokens_test.go` carried copy-paste artifacts vet and gofmt cannot see.** A
duplicated 3-line doc comment, and a 20-line orphan documenting a function that lives in
`expandgate_test.go` under a different name and citing a test that exists nowhere. Both from the
same cause: my splitter took each test's doc comment by scanning back to the previous blank line,
which swallowed the FOLLOWING test's comment as a trailing block. A third artifact the review did not
list is fixed too — `expandgate_test.go`'s doc comment still described "the preset's promise" and
cited `docs/how-to/install-plugin.md` and an install skill, both of which belong to #160.

## The rest

**4.** `docs/reference/config.md` and `docs/components.md` said `auto` injection has exactly two
conditions. It has three. Both now say so, and say what the third is for. The cache-stability
argument those passages make is unaffected — a pipeline does not change turn to turn either — so it
gained a member rather than needing a rewrite.

**5. `make build` now sets `CGO_ENABLED=0`.** The docs could claim "no C toolchain" all they liked
while step 1 of the quickstart was `make build`, which needed one because the Makefile exported
`CGO_ENABLED=1` for every target. Pointing readers at `build-static` would have fixed the sentence;
making the DEFAULT build pure Go makes the claim true of the command the docs tell people to run.
`CGO_ENABLED=1` stays for the test targets, where `-race` requires it, and the comment says exactly
that. Verified: `CC=/nonexistent make build` produces a statically linked binary.

README, CLAUDE.md and the quickstart no longer require a C toolchain. All five remaining
`codesmart`-is-the-default sites are corrected — including two in `config/config.go`, which is how
the claim spread to five documents: it sat three lines from the flag that disproves it.

**6.** `docs/setup.md` overstated its own evidence, which is the exact sin this PR is about. It
claimed CI removes the C compiler from `PATH` (with cgo off the toolchain never consults `CC`; that
variable is a tripwire, not the mechanism) and that cross-compilation to four targets is asserted,
when CI builds native linux/amd64 only. Now says what CI actually does, and states separately that
the other three targets were verified by hand and are asserted at release time. Same overstatement
fixed in the `ci.yaml` comment.

**7.** `ci.yaml` promised a linked issue and linked nothing, and named a different flake than the PR
body did. Both are real; the comment is about the campaign one, and now links #163.

## HasOffload unit tests

`./components`: nil-safe, empty pipeline (the A/B control arm), reformatters-only, and an offloader
in three positions. Revert-verified both ways — always-true fails the empty and reformatter cases,
always-false fails the offloader cases.

A registry-walking test was supposed to make it rot-proof, and **it skipped**: registrations happen
in `components/all`, so a test inside `components` can neither see them nor import the package that
does. A test that skips reads as coverage and is not, so it moved to `components/all`, where it
runs — 21 of 21 registered components, 13 implementing Offload. It fails if either count is zero,
because an all-false or all-true population would agree with a broken HasOffload.

Full `go test ./...`, `go vet ./...` and `gofmt -l` clean; doc link/anchor checker re-run over every
document touched.

Assisted-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>

---------

Signed-off-by: DAVID AMID <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant