Skip to content

fix(logring): inline empty-key groups - #135

Merged
trefeon merged 1 commit into
trefeon:mainfrom
dhodhoo:fix/logring-empty-group
Aug 18, 2026
Merged

fix(logring): inline empty-key groups#135
trefeon merged 1 commit into
trefeon:mainfrom
dhodhoo:fix/logring-empty-group

Conversation

@dhodhoo

@dhodhoo dhodhoo commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

logring currently adds a separator when flattening an empty-key slog.Group under an existing group prefix. This can produce malformed retained fields such as:

svc..status=200

instead of:

svc.status=200

The slog.Handler contract specifies that groups with an empty key should have their attributes inlined.

This change keeps the existing prefix unchanged for empty-key groups while preserving the current behavior for named groups.

Regression coverage includes empty groups under a named prefix, nested empty groups, and consecutive empty groups.

No related issue; this was found while reviewing the structured log flattening path.

Type of change

  • Bug fix
  • New feature
  • Refactor / internal
  • Docs only
  • Dependency update

Checklist

  • Code builds: go build ./...
  • go vet ./... clean
  • Tests pass: go test ./... (CI also runs -race)
  • Tests added/updated for the change
  • Public docs updated if behavior or config changed (README.md, docs/guides/) — not applicable; no public config or documentation changes
  • No secrets: no real tokens, .env, or config.json content

Notes

Targeted logring tests pass with the race detector, and the full local race suite passes sequentially with go test -race -p 1 ./....

@dhodhoo
dhodhoo force-pushed the fix/logring-empty-group branch from ec62b25 to 3056b5e Compare August 18, 2026 10:03
@trefeon
trefeon merged commit f655ecd into trefeon:main Aug 18, 2026
5 checks passed
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.

2 participants