feat(869-c5): mosaic doctor surfaces wired-but-unactivatable lease enforcement #878
Reference in New Issue
Block a user
Delete Branch "feat/869-c5-doctor-activation-check"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #869 (Point-1 C5)
Summary
Adds a
mosaic doctorhealth check for the #869 fail-closed brick scenario: the Claude Code enforcement hooks (mutator-gate.pygating PreToolUse,receipt-observer-client.pyobserving Stop) can be wired into~/.claude/settings.jsonon a host where the activation half is absent (C1'sleaseEnforcementActivatable()is false) and/or the broker supervisor is unhealthy (C3'scheckBrokerSupervisorHealth()). That combination fails closed correctly but was previously silent —mosaic doctordid not detect it.packages/mosaic/src/commands/lease-doctor-check.ts:detectEnforcementHooksWired()— pure detection of the mutator-gate/receipt-observer markers in a parsedsettings.json.runLeaseEnforcementDoctorCheck()— combines wiring detection with C1'sleaseEnforcementActivatable()and C3'scheckBrokerSupervisorHealth()(both imported read-only, not modified). Not wired ⇒ ok (no false alarm, activation/broker never even probed). Wired + activatable + broker-healthy ⇒ ok. Wired + (not activatable OR broker unhealthy) ⇒ a LOUD, actionable error citing #869.packages/mosaic/src/commands/launch.ts: thedoctorsubcommand now runs this check before delegating to the existingmosaic-doctorbash audit script, printing[mosaic-doctor] [ERROR] ...(louder than the script's own[WARN]lines) and forcing a non-zero exit if the lease-enforcement check fails — even if the bash script itself is green. Silent on anokresult, matching this file's existingcheckMosaicHome/checkFileconventions.Test plan
lease-doctor-check.spec.ts(11 tests): wired+not-activatable ⇒ error, wired+activatable+broker-unhealthy ⇒ error, wired+neither ⇒ error citing both reasons, wired+activatable+healthy ⇒ ok, not-wired ⇒ ok (and activation/broker probes are never even called), settings.json absent ⇒ ok, malformed settings.json ⇒ ok. Every dependency (settings read, activation probe, broker-health check) is injected — no real~/.claude/settings.jsonor broker touched.pnpm typecheck— passpnpm lint— passpnpm format:check— passpnpm --filter @mosaicstack/mosaicfull vitest suite (1477 tests) — pass, including pre-existing C1 (lease-activation-probe.spec.ts) and C3 (broker-supervisor.spec.ts) suites, unmodified and still green.Gate-16 APPROVE -- stamped by Mos (id-11)
PR author jason.woltje(id2) != approver Mos(id11); commit-author mosaic-coder != reviewer -> no Finding-0. Registers the independent reviewer's APPROVE (#869 Point-1 C5, mosaic doctor activation-check); MS-LEAD prepared/relayed, Mos stamps+merges.
VERDICT: APPROVE @
e75e32386c(Part of #869 -- Point-1 card, umbrella stays open, no Closes).Independent review, all 8 PASS: (1) detectEnforcementHooksWired matches both hook markers (partial wiring=dangerous, tested); (2) check logic -- not-wired->silent ok; wired->error unless activatable AND broker-healthy; names each failing reason, cites #869/brick; no false-alarm, no silent-pass; (3) launch.ts scoped to doctor subcommand only (init/sync/bootstrap untouched); (4) C1/C3 consumed read-only (zero diff); (5) red-first 11 tests, injected fakes, both branches; (6) fail-closed locks untouched+green; (7) firewall clean; (8) CI terminal-green wp1987 (all 8 steps) + vitest 1477/1477.
Doctor loudly surfaces the wired-but-unactivatable brick state (reuses C1 probe + C3 broker-health) -- the operator-facing guard for the #828/#869 fleet-brick class.
6-CHECK re-verified by Mos @e75e32386c86e5c6ce294f0a17dc65b92c12eee5: open/not-merged/mergeable onto main 4422231b/base main; CI success @exact head; reviewed==CI==head; independent APPROVE author!=reviewer no REQUEST-CHANGES; body 'Part of #869'; queue clear.