feat(mosaic): mosaic telemetry command (M6 CU-06-01..05) #417

Merged
jason.woltje merged 1 commits from feat/mosaic-telemetry into main 2026-04-05 07:06:43 +00:00

1 Commits

Author SHA1 Message Date
Jarvis
6dfc9e0e83 feat(mosaic): mosaic telemetry command (CU-06-01..05)
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful
Add mosaic telemetry command tree covering CU-06-01 through CU-06-05.

Local half (mosaic telemetry local {status,tail,jaeger}):
- status: probes OTEL_EXPORTER_OTLP_ENDPOINT reachability via fetch
- tail: explains OTLP push model and points to Jaeger + docker compose logs
- jaeger: prints Jaeger UI URL (respects JAEGER_UI_URL), --open flag best-effort

Remote half (mosaic telemetry {status,opt-in,opt-out,test,upload}):
- Remote upload is DISABLED by default (dry-run is the default)
- opt-in / opt-out: @clack/prompts consent flow persisted to telemetry.json
- status: shows consent state, endpoint, last upload timestamp
- test: synthesises fake event, dry-run by default; --upload path throws if shim
- upload: dry-run unless MOSAIC_TELEMETRY_ENDPOINT + consent + no dry-run flag

CU-06-01: @mosaicstack/telemetry-client-js is not yet published (404).
  Uses forward-compat shim at packages/mosaic/src/telemetry/client-shim.ts
  matching the expected {init, captureEvent, upload, shutdown} interface.

CU-06-04: Consent persisted to $MOSAIC_HOME/telemetry.json via atomicWrite.
  Schema: {remoteEnabled, optedInAt, optedOutAt, lastUploadAt}.

CU-06-05: 18 Vitest tests in telemetry.spec.ts covering structure,
  opt-in/opt-out persistence, status output (both states + dry-run banner),
  and dry-run assertions (no fetch, no upload() call, banner present).

Code-review findings addressed:
- Shim throws on real-upload attempts (blocker: no false success recorded)
- init() no longer resets queue (should-fix: pending events survive re-init)
- Windows --open uses cmd /c start (should-fix: start is a shell builtin)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 02:00:33 -05:00