Files
2026-05-27 23:29:53 +01:00

2.3 KiB

Tasks: logger-silent-failure-fix

1. Spec delta

  • 1.1 Author specs/logging/spec.md delta with ## MODIFIED Requirements (LG-11, LG-12, LG-13) and ## ADDED Requirements (LG-21 sink dispatch isolation, LG-22 BufferedSink no-deadlock, LG-23 MultiSink fan-out, LG-24 generic Logger, LG-25 concrete loggers, LG-26 lifecycle controls, LG-27 Sensitive envelope).
  • 1.2 Add **Verified by:** line to every existing LG-NN requirement in the folded spec on fold.

2. Implementation

  • 2.1 Add fallbackSink?: Sink to AbstractLoggerConfig; default to a sink that writes failure records via console.error.
  • 2.2 Replace dispatchToSinks body with per-sink try/catch that emits LoggerError(LOGGER.SINK) to fallbackSink, increments droppedBySinkError, fires logger.dropped_total{reason:"sink_error"}, and continues to remaining sinks.
  • 2.3 Add droppedBySinkError: number to LoggerMetrics and initialise in freshMetrics.
  • 2.4 Replace BufferedSink block-policy waiter list with inline-drain on overflow; throw LoggerError(LOGGER.CONFIG) on non-positive maxQueueSize.
  • 2.5 Update affected unit / conformance tests.

3. Conformance test

  • 3.1 Add packages/observability/logger/src/conformance.spec-conformance.test.ts pinning:
    • sink throw is captured into fallbackSink with code LOGGER.SINK and increments droppedBySinkError;
    • sink rejection is captured into fallbackSink and increments droppedBySinkError;
    • the second sink in a list still receives the record when the first throws (per-sink isolation);
    • BufferedSink({ overflowPolicy: "block", maxQueueSize: 1 }) makes forward progress without an external flush();
    • BufferedSink({ maxQueueSize: 0 }) throws LoggerError(LOGGER.CONFIG) at construction;
    • MultiSink([a,b]) writes to both a and b in parallel.

4. Gate

  • 4.1 bunx turbo lint typecheck test --filter=@suaveplan/logger green.
  • 4.2 bunx turbo test:coverage --filter=@suaveplan/logger 100/100/100/100.
  • 4.3 bun scripts/openspec-conformance.ts @suaveplan/logger exits 0.

5. Fold + archive

  • 5.1 Fold delta into openspec/specs/logging/spec.md.
  • 5.2 Move openspec/changes/logger-silent-failure-fix/ to openspec/archive/2026-04-27-logger-silent-failure-fix/.