Skip to content

feat: core v3 - uniform metadata nesting default - #96

Merged
theogravity merged 24 commits into
mainfrom
dx-v3-metadata-and-docs
Aug 22, 2026
Merged

theogravity merged 24 commits into
mainfrom
dx-v3-metadata-and-docs

Conversation

@theogravity

@theogravity theogravity commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

PR A of a staged release shipping go.loglayer.dev/v3 with uniform metadata nesting by default.

Breaking change: Config.MetadataFieldName now resolves to "metadata" when empty, so map AND struct metadata render uniformly under that key across every transport. Restore the v2 shape with Config.FlattenMetadata: true (explicit non-empty MetadataFieldName always wins). Core module path moves go.loglayer.dev/v2/v3 (including sub-packages transport/, utils/, internal/).

Derived from DX feedback in the hmn-cli migration (LOGLAYER.md #7).

What's in this PR

  • Core v3: MetadataFieldName default flip + FlattenMetadata opt-out (build() defaulting; Child() propagates; NewMock consistent)
  • Module path: core + sub-packages to go.loglayer.dev/v3; go.work trimmed to . (restored in PR B); sub-modules untouched (still v2)
  • transporttest contract: suite updated for the new default + FlattenMetadataOptOut case; new in-core self-test exercising the full contract
  • Docs: consolidated Migration Guide (v2 + v3 on one page, redirects from old URLs), configuration.md / metadata.md / getting-started.md rewrites, Fatal-exit + New/Build guidance, transport-ID discoverability, whats-new / cheatsheet / llms / index updates, accuracy sweep, interim-transport-state callouts
  • Changeset: .changeset/swift-metadata.md (go.loglayer.dev: major)

Interim state (transports still v2)

The transports keep their v2 paths in this release; code pairing the v3 core with a v2 transport path does not compile together until the transport v3 bumps land. The code-first docs pages carry explicit ::: warning callouts for this. This is inherent to the staged release: monorel pins require versions at release but does not rewrite .go source imports, so the transport sweep requires the published v3 core first.

Follow-up PR (B): transport v3 sweep

  • Every sub-module: source imports + go.mod requirego.loglayer.dev/v3
  • Docs: pair v3 core + v3 transport paths; remove the interim callouts
  • Root README.md: sweep the example, install command, and badges from the v2 paths it still shows (untouched in this PR)
  • Restore full go.work
  • Own changesets per sub-module

Verification

  • Core: go build ./..., go test -race -count=1 ./..., go vet ./..., staticcheck ./..., gofmt -l — all clean
  • Docs: bun run docs:build — clean
  • Pre-merge code review (subagent, full diff): no Critical. Fixes applied in this PR: xargs parallel invocation cleaned (-n1 -I{}-P -I '{}', the -n1 silently disabled with -I{} on GNU xargs and would bite the 27-module sweep), go.work whitespace, migration-guide link in the changeset. Review-verified end-to-end: default resolves schema="metadata", FlattenMetadata: true yields "", explicit key wins, Child() inherits; CORE_ONLY gating collapses all ops to the root; the opt-out contract case is pinned. Forward-looking items recorded for PR B: plugins/datadogtrace/livetest re-listing in the test path, go.work hygiene.
  • Deep docs review (senior-Go-dev first-read): Critical (interim compile gap) addressed via the explicit callouts + recorded PR B scope; all other findings fixed or deferred to PR B
  • Pre-push hook's foreach-module.sh failures are the documented PR-A workspace anomaly (v2 sub-modules run inside the trimmed go.work); the core is fully green

Changelog

The release will publish go.loglayer.dev/v3.0.0 via the changeset. See Migrating to v3.

Theo Gravity added 24 commits August 21, 2026 16:41
Use transport.BaseConfig{} directly in TestRunContract_FlattenOptOutIsDistinct
instead of threading transporttest.FactoryOpts{}.Level through an empty
composite literal, and note in testMapMetadataMerged that the default
nesting shape is pinned by that test.
The root module now declares go.loglayer.dev/v3, so the still-v2
sub-modules (whose replace directives point at the repo root) cannot
build until the v3 core is published and the sweep PR moves them onto
it. CI's foreach-module ops and per-module direct test steps gate
behind CORE_ONLY=1 until then; the sweep PR removes the guard and
restores the full matrix.

Also restores the workspace-trimmed go.work to the full module list:
the trim broke the root's own dev builds, and the v3 core needs the
workspace to resolve its sub-packages while unpublished.
The migration guides were consolidated into /migrating; the changeset
body (which lands verbatim in the release changelog) still linked the
old /migrating-to-v3 URL, which is now only a meta-refresh redirect.
The -n1 flag silently disables with -I{} on GNU xargs (n control
falls back to -L 1), a latent shape issue that would bite when the
sweep PR restores the 27-module test list. Drop -n1 and quote the
placeholder; semantics unchanged. Fix a space-indented go.work entry.
The pretty, http, datadog, and betterstack pages document the
v2-transport metadata shape (maps merge at root when MetadataFieldName
is empty) without the interim-state callout. A v3-core reader would
misread the placement as the v3 default. Add the callout; the sweep
PR flips the prose itself when each transport moves to v3.
@theogravity
theogravity merged commit 4b4e228 into main Aug 22, 2026
13 checks passed
@theogravity
theogravity deleted the dx-v3-metadata-and-docs branch August 22, 2026 10:18
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