Skip to content

fix(addie): proper source attribution for 44 root-logger files#3622

Merged
bokelley merged 1 commit into
mainfrom
bokelley/addie-logger-attribution
Apr 30, 2026
Merged

fix(addie): proper source attribution for 44 root-logger files#3622
bokelley merged 1 commit into
mainfrom
bokelley/addie-logger-attribution

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Mechanical codemod across 44 files in server/src/addie/: replace import { logger } from '<path>/logger.js' with import { createLogger } from '<path>/logger.js'; const logger = createLogger('<module-name>').

Why

These files were producing :rotating_light: *System error: unknown [web]* alerts in #aao-errors. Without a module binding on the pino child logger, the error hook in server/src/utils/posthog.ts:245 falls back to module || 'unknown' and posts the alert with no source attribution.

This is the same root cause as #3578, just at scale. PostHog $exception events from these modules will now be attributed correctly too.

Approach

Followed the existing convention by directory:

  • addie/<file>.tsaddie-<basename>
  • addie/mcp/<file>.tsaddie-<basename>
  • addie/jobs/<file>.ts, addie/services/<file>.ts → bare <basename>
  • addie/home/<file>.tsaddie-home-<basename>
  • addie/home/builders/<file>.tsaddie-home-builder-<basename>
  • addie/rules/index.tsaddie-rules

Diff is +138 / -44, exactly 4 lines added and 1 removed per file. Child pino loggers are signature-compatible with the root, so no behavioral change beyond attribution.

Test plan

  • tsc --noEmit — clean
  • Pre-commit (test:unit + test-dynamic-imports + typecheck) — passed
  • After merge: confirm new alerts in #aao-errors show source: <module-name> instead of unknown for these files

🤖 Generated with Claude Code

…ution

Files in server/src/addie/ that imported the root pino `logger` directly
were producing #aao-errors Slack alerts as ":rotating_light: System error:
unknown [web]" because the pino error hook -> notifyErrorChannel path saw
no `module` binding and fell back to "unknown" (server/src/utils/posthog.ts:245).

Mechanical codemod: each file now imports `createLogger` and binds a
module name. No behavioral change — child pino loggers are
signature-compatible with the root, and errorHook/logHook fire the same
way. Module names follow existing convention by directory:
- addie/<file>.ts            -> addie-<basename>
- addie/mcp/<file>.ts        -> addie-<basename>
- addie/jobs|services/<file> -> bare <basename>
- addie/home/<file>.ts       -> addie-home-<basename>
- addie/home/builders/<file> -> addie-home-builder-<basename>
- addie/rules/index.ts       -> addie-rules

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bokelley
bokelley enabled auto-merge (squash) April 30, 2026 02:36
import { logger } from '../logger.js';
import { createLogger } from '../logger.js';

const logger = createLogger('addie-thread-service');
@bokelley
bokelley merged commit da631a4 into main Apr 30, 2026
12 checks passed
@bokelley
bokelley deleted the bokelley/addie-logger-attribution branch April 30, 2026 02:41
bokelley added a commit that referenced this pull request Apr 30, 2026
…3650)

Add JSDoc context next to the level guide in server/src/logger.ts
explaining that logger.error / logger.fatal trigger the #aao-errors
Slack alert and PostHog $exception capture via the pino hook, so they
should be used only for unexpected, page-worthy failures. Expected
failures with a graceful fallback (third-party 4xx, validation, etc.)
should be logger.warn so the alert path is not taken.

Same anti-pattern surfaced as ":rotating_light: System error: unknown"
noise in PRs #3578, #3622, #3648.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant