Skip to content

SMOODEV-2700: Python log-level wire parity + golden-vector parity corpus#174

Merged
brentrager merged 1 commit into
mainfrom
SMOODEV-2700-logger-python-loglevel-parity
Jul 22, 2026
Merged

SMOODEV-2700: Python log-level wire parity + golden-vector parity corpus#174
brentrager merged 1 commit into
mainfrom
SMOODEV-2700-logger-python-loglevel-parity

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Fixes Python log-level wire parity and adds a cross-language golden-vector parity corpus (parity-corpus.json) exercised from both the TS and Python test suites.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ji3rA65cTfU9vPQh9HAASJ

…rity corpus

Python was the sole outlier across the five hand-written ports. It emitted a
lowercase string in `level` ("info") and never emitted `LogLevel` at all, while
TS/Go/Rust/.NET all emit BOTH: `level` = pino-compatible numeric, `LogLevel` =
canonical lowercase string.

This broke downstream log-level ingest: rust/api-prime's observability ingest
takes the first matching level key, so our own services' numeric `level` (30)
won the race over the unambiguous `LogLevel` ("info") -- which is why prod shows
a mixed bag of levels: ['30','40','ERROR','INFO','WARN'].

Python now emits both. The numeric codes already existed in `level_to_code()`
(trace=10 .. fatal=60); they were simply never written to the record. This is a
BREAKING wire-shape change for Python consumers reading `level` as a string --
they should read `LogLevel` instead. Changeset documents the migration.

Five hand-written implementations WILL drift; this bug is the proof. Adds
`parity-corpus.json`, a committed golden-vector corpus pinning the exact
level/LogLevel pair every port must emit for all six levels, asserted by the TS
and Python suites so drift fails that language's build. Follows the ADR-089
pattern used by @smooai/audit. Go/Rust/.NET lanes are NOT yet wired -- see the
corpus file; wiring them is mechanical and separately scoped.

Verified .NET already writes both (SmooLogger.cs:431-432) -- no fix needed.
The uvicorn adapter's uppercase "level": "INFO" is a stdlib logging dictConfig
threshold, not wire output, and is correctly left alone.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S2bM94GAnVjYSSv1x7HKRB
@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 85d48f8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/logger Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager
brentrager merged commit ddf9461 into main Jul 22, 2026
1 check passed
@brentrager
brentrager deleted the SMOODEV-2700-logger-python-loglevel-parity branch July 22, 2026 23:01
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