feat(plugins): harness watch W1: one pass over every installed harness gives a record and its transitions, with inspect for pi and claude-code (#1873) #2013

Merged
jason.woltje merged 3 commits from harness-watch-w1 into refactor 2026-11-20 10:40:31 +00:00
Owner

What changes

Lane harness-watch-w1, slice W1 of the harness-watch design: the function the periodic harness check will call. Jason's ruling, 2026-11-19: no pins on any harness, a periodic check instead. Nothing calls this function yet. The timer, the state file and the Settings line are later slices.

  • The watch. packages/plugins/src/harness-watch.mjs exports watchHarnesses(). It makes one pass over every harness the loader gives, with no name list. It takes the last records and returns the new records and the transitions. It writes nothing.
  • States. fit, changed, red, unknown, missing. A check that throws or times out reads unknown, never fit.
  • inspect. A harness module may export inspect({ env, scratch, signal }). A module without one is watched through version() with fit unknown.
  • pi. Its inspect calls the same fit check as preflight and shares its cache. It never runs a second check.
  • claude-code. Its inspect gives the version, a sha256 of the file it ran and the help text. Fit stays unknown until W2.
  • No paths or env values in a record. source is the lookup step (MOSAIC_PI_BIN, PATH, repo). The watch redacts every text field itself.

No new verb, refusal code, grant, role, schema or config format. Only packages/plugins/ changes.

Tests

  • New: packages/plugins/tests/harness-watch.test.mjs, 16 tests. The lane broke 11 changes in turn and each turned a test red. The second reviewer broke 24 more; 21 were caught and the 3 misses are listed in the lane report.
  • Lane gate on 4a7815d29: 732 pass, 0 fail.
  • Lead check in a clean environment on 4a7815d29: 267 files, 2898 pass, 0 fail, 0 skip.

Review

A fresh claude-opus-5-5 reviewer asked for eight changes. The lane fixed seven and left one for W2. A second fresh reviewer found two small items, both fixed. The Lead read the last fix.

Left for later

  • claude-code's version and help captures run on the host network. W2 should run them with no network.
  • The hash and the run are two reads of one path, so a swap between them is a small window.
  • A failed pi fit check gives no digest and no "could not decide" field. pi's inspect reads that from the message text. pi-fit.mjs should export both.
  • The redaction can rewrite help text when an env value is a common word. The stored help is for display and comparison only; fit rules must run on the raw text inside the module.
  • Slices W2 to W8.
## What changes Lane harness-watch-w1, slice W1 of the harness-watch design: the function the periodic harness check will call. Jason's ruling, 2026-11-19: no pins on any harness, a periodic check instead. Nothing calls this function yet. The timer, the state file and the Settings line are later slices. - **The watch.** `packages/plugins/src/harness-watch.mjs` exports `watchHarnesses()`. It makes one pass over every harness the loader gives, with no name list. It takes the last records and returns the new records and the transitions. It writes nothing. - **States.** `fit`, `changed`, `red`, `unknown`, `missing`. A check that throws or times out reads `unknown`, never `fit`. - **`inspect`.** A harness module may export `inspect({ env, scratch, signal })`. A module without one is watched through `version()` with fit `unknown`. - **pi.** Its `inspect` calls the same fit check as preflight and shares its cache. It never runs a second check. - **claude-code.** Its `inspect` gives the version, a sha256 of the file it ran and the help text. Fit stays `unknown` until W2. - **No paths or env values in a record.** `source` is the lookup step (`MOSAIC_PI_BIN`, `PATH`, `repo`). The watch redacts every text field itself. No new verb, refusal code, grant, role, schema or config format. Only `packages/plugins/` changes. ## Tests - New: `packages/plugins/tests/harness-watch.test.mjs`, 16 tests. The lane broke 11 changes in turn and each turned a test red. The second reviewer broke 24 more; 21 were caught and the 3 misses are listed in the lane report. - Lane gate on 4a7815d29: 732 pass, 0 fail. - Lead check in a clean environment on 4a7815d29: 267 files, 2898 pass, 0 fail, 0 skip. ## Review A fresh claude-opus-5-5 reviewer asked for eight changes. The lane fixed seven and left one for W2. A second fresh reviewer found two small items, both fixed. The Lead read the last fix. ## Left for later - claude-code's version and help captures run on the host network. W2 should run them with no network. - The hash and the run are two reads of one path, so a swap between them is a small window. - A failed pi fit check gives no digest and no "could not decide" field. pi's `inspect` reads that from the message text. `pi-fit.mjs` should export both. - The redaction can rewrite help text when an env value is a common word. The stored help is for display and comparison only; fit rules must run on the raw text inside the module. - Slices W2 to W8.
jason.woltje added 3 commits 2026-11-20 10:40:28 +00:00
jason.woltje merged commit 4a7815d29e into refactor 2026-11-20 10:40:31 +00:00
Sign in to join this conversation.