refactor: the frontend logs through LogTape, configured once, with lines that read on their own

Merged
HA
7d ago
+209-85

The frontend had a consola instance that every module tagged by hand, and log lines like "Connection failed:" followed by an object, so you couldn't tell what failed without reading the code. This swaps it for LogTape, set up once in the client init hook. Each module gets getLogger(['integr8scode', area]) and logs one sentence whose {placeholders} carry the values, for example GET https://.../api/v1/auth/me failed with 503: Service Unavailable. ESLint's no-console now rejects console calls in src, so there's one way to log.

Levels: error for status 0, 5xx and a stream handler that threw; warning for a dropped SSE connection; debug for a 4xx, which the user already sees as a toast or under a form. A production build prints warning and up, dev prints everything.

While checking the streams I found that none of the three SSE consumers (notifications, the editor's execution events, the replay banner) ever logged a dropped connection. The generated client retries inside the stream and reports each failure through onSseError instead of throwing, so the old catch blocks never saw it. They now log through onSseError, skipping the abort of their own disconnect, and the editor logs which execution ended without a result.

Unit tests leave LogTape unconfigured, so it drops everything. That made the console-silencing helpers and spies pointless, and they're gone. Tests that check a log line use a new captureLogs() in test-utils. AGENTS.md has a short Frontend: Logging section, and the ops logging doc notes that browser logs don't reach Loki yet.

Gates run locally: lint, stylelint, format, svelte-check, build, and coverage (964 tests).


Summary by cubic

Replaces the frontend's consola logger with LogTape, configured once in the client init hook. Each module calls getLogger(['integr8scode', area]) and logs a single sentence whose {placeholders} carry values, so each line reads on its own; ESLint's no-console makes that the only way to log in src/.

The three SSE consumers (notifications, editor execution events, replay banner) now log dropped connections through onSseError — the generated client retries inside the stream and reports failures there instead of throwing, so the old catch blocks never saw them. The editor also logs when an execution stream ends without a result.

  • Log levels: error for status 0, 5xx, and a thrown stream handler; warning for a dropped SSE connection; debug for a 4xx, which the user already sees as a toast or under a form.
  • Dev prints everything; a production build prints warning and up.
  • Unit tests leave LogTape unconfigured, so it drops all records; the console-silencing helpers and spies are gone, and tests that assert a log line use captureLogs().
  • AGENTS.md and the operations logging note document the new setup.