Skip to content

refactor(framework): extract correlation into dedicated package#15

Merged
ConsoleTVs merged 3 commits into
mainfrom
refactor/correlation-package
May 1, 2026
Merged

refactor(framework): extract correlation into dedicated package#15
ConsoleTVs merged 3 commits into
mainfrom
refactor/correlation-package

Conversation

@ConsoleTVs
Copy link
Copy Markdown
Member

Summary

  • Moves correlation ID middleware and slog handler from framework/middleware/ into a dedicated framework/correlation/ package
  • Follows the same pattern as framework/session/ — features with middleware + companion components get their own sub-package
  • Removes redundant CorrelationID prefix from all exported symbols since the package name provides context

Renames

Before (middleware.) After (correlation.)
CorrelationID() Middleware()
CorrelationIDWith(opts) MiddlewareWith(opts)
CorrelationIDOptions Options
CorrelationIDGenerator Generator
CorrelationIDHandler(next) Handler(next)
CorrelationIDFrom(r) From(r)
DefaultCorrelationIDHeader DefaultHeader

Rationale

The slog handler is not HTTP middleware — it's a slog.Handler decorator. Placing it in the middleware package was misleading. Extracting into framework/correlation/ groups related components cohesively and is consistent with how sessions are organized.

Move correlation ID middleware and slog handler from
framework/middleware/ into framework/correlation/ for consistency
with the session package pattern. Features that have middleware
plus companion components get their own sub-package.

Renames:
- CorrelationID() -> correlation.Middleware()
- CorrelationIDWith() -> correlation.MiddlewareWith()
- CorrelationIDOptions -> correlation.Options
- CorrelationIDGenerator -> correlation.Generator
- CorrelationIDHandler() -> correlation.Handler()
- CorrelationIDFrom() -> correlation.From()
- DefaultCorrelationIDHeader -> correlation.DefaultHeader
@ConsoleTVs ConsoleTVs marked this pull request as ready for review May 1, 2026 10:36
@ConsoleTVs ConsoleTVs merged commit 7fcc286 into main May 1, 2026
1 check passed
@ConsoleTVs ConsoleTVs deleted the refactor/correlation-package branch May 1, 2026 10:36
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