Commit Graph
2 Commits
Author SHA1 Message Date
GandClaude Opus 5 caa0e41c3b chore: add a formatter (#449)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier (1062 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore: teach git blame to skip the reformat

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(lint): reattach two guards the reformat detached

Both effects were one-liners, so a trailing eslint-disable-line covered the
setState call:

  useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ...

prettier expanded the block. The comment stayed on the closing line while the
call moved above it, so the guard protected nothing and the rule its author had
deliberately silenced failed the build.

This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line
variant. Both come from the same fact: an eslint directive binds to a line
number, so reformatting can silently unbind it, which makes 'mechanical, no
behaviour change' false for any bulk reformat.

* chore(desktop): bump the runner version the reformat requires

desktop-release-drift enforces that anything built into Fleet Runner which
differs from the last released tag must carry a version ahead of that tag —
main read 0.8.15 and fleet-runner-v0.8.15 already shipped.

A whole-repo reformat changes bytes under desktop/, so the gate fires. The
alternative was adding desktop/ to .prettierignore, which would buy a quiet PR
by carving a permanent hole in the formatter's coverage — the precise shape of
silent drift this test was written to catch. Bumping is what the rule asks for
and costs one patch release whose only content is whitespace.

* chore: merge main and re-format

A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR
runs no checks at all while reporting nothing. Conflicts resolved to main,
which is correct because this branch changes formatting and nothing else.

* chore: leave desktop/ out of this reformat

desktop-release-drift is right to refuse this. Everything under desktop/ is
built into Fleet Runner, so changing it means shipping: bump the version AND add
a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed
Fleet Runner and wants to know what changed'. For a whitespace-only build the
honest answer is 'nothing', so that release should not exist — and I should not
write release notes claiming otherwise.

I had bumped to 0.8.16 to get the gate green. That was the wrong direction:
publishing a build to three OS runners to keep a formatting PR quiet. Reverted.

desktop/ is excluded in .prettierignore with the reasoning recorded there, to be
formatted alongside the next real runner change, where the bump and the notes are
true anyway.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 09:23:30 +00:00
ad56bc5800 feat(telemetry): make a dead sensor visible within a day, not two months (#364)
* feat(telemetry): make a dead sensor visible within a day, not two months

`claude_code_history` stopped receiving rows on 2026-06-10 and was still
stopped 76 days later, when this was written. Every check in the system passed
the entire time: Fleet Doctor asserted the table EXISTS, the ingest swallows its
own errors by design (it must never block the operator), and /activity kept
rendering — just with 76 days missing and no indication of it. Existence is not
function, so the outage had no symptom.

The only proof a telemetry path works is a RECENT ROW. This asks that question
on a timer.

What it is NOT: a check over every table. Most tables here are written when a
human does something — `ai_spend` is a per-(user,day) rollup of chat turns, so
three rows means three days anyone chatted; `captures` has never held a row.
Alerting on those manufactures permanent noise, and permanent noise is how a
real alert gets ignored. So each path declares who writes it: automatic writer
on a known cadence ⇒ monitored, silence is a fault; written on demand ⇒ not
monitored, and it says why. Both halves are recorded, because a path nobody can
name a writer for is one nobody can fix when it goes quiet.

Budgets are measured against 90 days of production, not guessed, and each
carries the observation behind it. claude_code_history: p99 gap 8m47s,
worst-ever 17h58m, budget 48h — 2.7x its worst normal silence. debug_logs takes
its 12h from the CONTRACT (three hourly crons) rather than from history,
because prune-debug-logs keeps only 30 days and the apparent 6-day "worst gap"
is a pruning artifact — measuring there would have set the budget from the
janitor's behaviour instead of the writers'.

Four states, never collapsed into two: FLOWING / STALE (worked, then stopped) /
SILENT (never carried a row — different fault, different fix) / UNCHECKED (the
query failed; not a pass and not a fault). The last is the point: a monitor
that reports "could not look" as "fine" is worse than no monitor, because it
emits a check mark while blind.

Proven by mutation, seven ways, each red then green again: renaming a monitored
table, pointing a path at a missing column, unscheduling the monitor itself,
unscheduling a cron a budget depends on, letting UNCHECKED count as healthy,
demoting the path this was written for, and an off-by-one on the budget
boundary.

Run against production it goes red on exactly one path — the one that is
genuinely broken — and stays quiet on the other eleven.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(hooks): pre-commit rejected every commit touching two or more TS files

`staged=$(git diff --cached -z --name-only ...)` looks correct and is not.
Command substitution STRIPS NUL bytes, so the whole point of `-z` is discarded
at the moment of capture: every path collapses into one string, and the
`xargs -0` that follows fails on a filename that never existed.

  src/.../check-telemetry/route.ts + src/.../doctor/route.ts
  → "src/.../check-telemetry/route.tssrc/.../doctor/route.ts"
  → No files matching the pattern ... (exit 123)

It works with ONE staged file and breaks at TWO, which is why it read as an odd
one-off rather than a hook that had stopped working. Proven with od -c: the
captured form contains "route.tssrc/", the piped form "route.ts\0src/".

Fix is the shape it should always have been: pipe the -z producer straight into
`xargs -0`, and count with a separate non-`-z` call for the emptiness check.

The class is closed rather than the instance fixed — scripts/test/nul-safe-paths.ts
scans all 87 shell scripts and husky hooks and fails on any `$( ... -z ... )`
capture. Mutation-proven three ways: it catches the original bug, catches the
same bug planted in a different script, and does NOT fire on the correct piped
form. It also asserts .husky/pre-commit specifically still pipes, since a
generic scan passes trivially if the file stops mentioning -z at all.

The scan strips comments before matching — the hook now documents the broken
form as a warning, and a check that reads its own counter-example fires on the
explanation instead of the code.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: t <t@t.t>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 01:10:02 +00:00