Skip to content

Develop#375

Merged
ClaraTersi merged 156 commits intomainfrom
develop
Mar 21, 2026
Merged

Develop#375
ClaraTersi merged 156 commits intomainfrom
develop

Conversation

@qnen
Copy link
Contributor

@qnen qnen commented Mar 20, 2026

Pull Request Checklist

Pull Request Type

  • Feature
  • Fix
  • Refactor
  • Pipeline
  • Tests
  • Documentation

Checklist

Please check each item after it's completed.

  • I have tested these changes locally.
  • I have updated the documentation accordingly.
  • I have added necessary comments to the code, especially in complex areas.
  • I have ensured that my changes adhere to the project's coding standards.
  • I have checked for any potential security issues.
  • I have ensured that all tests pass.
  • I have updated the version appropriately (if applicable).
  • I have confirmed this code is ready for review.

Additional Notes

Obs: Please, always remember to target your PR to develop branch instead of main.

jeffersonrodrigues92 and others added 30 commits February 13, 2026 11:47
…ema mode support

Implements schema-based tenant isolation:
- Add SchemaNameFromTenantID() to generate consistent schema names
- Add setSearchPath() to configure connection for tenant schema
- Add IsSchemaMode()/IsIsolatedMode() helpers to TenantConfig
- Automatically set search_path when connecting in schema mode
- Restructure package with cleaner separation (client, pool, types)

Schema mode sets: SET search_path TO "tenant_{uuid}", public

X-Lerian-Ref: 0x1
- Refactor MongoPool to use MongoConnection from commons/mongo instead
  of duplicating connection logic
- Add WithMongoLogger option to pass logger to MongoConnection
- Add AuthSource and DirectConnection fields to MongoDBConfig for
  MongoDB authentication and replica set support
- Add MaxPoolSize field to MongoDBConfig for connection pool sizing
- Update buildMongoURI to support authSource and directConnection params

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…oped DB contexts

- Add RabbitMQPool for tenant-specific vhost connections via Pool Manager
- Add MultiTenantConsumer for consuming from tenant-specific RabbitMQ vhosts
- Add module-scoped context functions for PostgreSQL isolation:
  - ContextWithOnboardingPGConnection / GetOnboardingPostgresForTenant
  - ContextWithTransactionPGConnection / GetTransactionPostgresForTenant
- Add GetKeyFromContext for tenant-prefixed Redis/Valkey keys
- Add GetActiveTenantsByService client method for tenant discovery

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add PostgreSQLReplica field to DatabaseConfig and GetPostgreSQLReplicaConfig method to TenantConfig for retrieving replica database configurations.

X-Lerian-Ref: 0x1
…d replica connections

Replace SET search_path with connection string options (-csearch_path=). Use separate replica connection when available, falling back to primary. Remove SchemaNameFromTenantID and setSearchPath methods as schema is now provided directly by Pool Manager.

X-Lerian-Ref: 0x1
Rename all Pool/pool identifiers to Manager/manager across the tenant-manager package for clarity. File renames: pool.go to postgres.go, pool_test.go to postgres_test.go, rabbitmq_pool.go to rabbitmq.go. Type renames: Pool to PostgresManager, MongoPool to MongoManager, RabbitMQPool to RabbitMQManager, ErrPoolClosed to ErrManagerClosed.

X-Lerian-Ref: 0x1
Add MultiStatementEnabled *bool field to PostgresConnection. When nil, defaults to true for backward compatibility. Allows tenant-manager to disable multi-statement migrations for specific connections.

X-Lerian-Ref: 0x1
Remove dead code not consumed by midaz: db_interface.go (19 delegation methods), HasTenantContext, ErrModuleNotConfigured, ErrConnectionNotFound, module-specific Mongo/RabbitMQ context functions.

X-Lerian-Ref: 0x1
Add Valkey/Redis key helpers (GetKey, GetKeyFromContext, GetPattern, GetPatternFromContext, StripTenantPrefix) for tenant-scoped cache isolation.

X-Lerian-Ref: 0x1
Align config field naming with MULTI_TENANT_* env var convention used by consumers.

X-Lerian-Ref: 0x1
Fixes build error in commons/redis using google.CredentialsFromJSONWithType and google.ServiceAccount introduced in oauth2 v0.35.0.

X-Lerian-Ref: 0x1
…with generic module-keyed API

Add ContextWithModulePGConnection and GetModulePostgresForTenant that accept
a module name parameter, enabling any service to use multi-tenant PostgreSQL
without changes to lib-commons. Deprecate old onboarding/transaction-specific
functions as thin wrappers.
PostgreSQL identifiers with mixed case need quotes. Without quotes, 'onboarding_org_01KHKAKW7NVW62H40GQKFECA0S' becomes lowercase and tables are not found.

X-Lerian-Ref: 0x1
…yed format

Removed ServiceDatabaseConfig intermediate layer. TenantConfig.Databases now maps module names directly to DatabaseConfig, matching the flat format from tenant-manager /settings endpoint.

X-Lerian-Ref: 0x1
Changes MultiTenantConsumer from eager (connect all tenants at startup) to lazy (connect on-demand) initialization, reducing startup time from O(N) to O(1).

Key changes:
- Add knownTenants map to track discovered tenants without connecting
- Implement ensureConsumerStarted() for on-demand consumer spawning
- Add exponential backoff for connection retries (5s, 10s, 20s, 40s)
- Add per-tenant retry state and degraded tenant tracking
- Enhance Stats() API with ConnectionMode, KnownTenants, PendingTenants, DegradedTenants
- Add tenant ID validation with regex whitelist
- Add URL encoding for tenant IDs and service names in HTTP client
- Add response body size limits (10MB) for DoS prevention
- Add 100% OpenTelemetry instrumentation with per-iteration spans
- Add comprehensive test suite (133 test cases, 95% coverage)

Breaking changes:
- Startup behavior: Run() no longer blocks on tenant connections
- First message per tenant incurs connection establishment latency (~200-500ms)

See MIGRATION_GUIDE.md for upgrade instructions.

X-Lerian-Ref: 0x1
…on string

PostgreSQL search_path option expects unquoted schema names.
Fixes TestBuildConnectionString test failure.

X-Lerian-Ref: 0x1
…LRU eviction, circuit breaker, and per-module connection settings

X-Lerian-Ref: 0x1
…d add absent-sync threshold

Replace Logger.Fatal with Logger.Error in postgres to prevent process crashes. Fix mutex lock contention in MongoManager.createClient by releasing lock before error returns. Add absentSyncsBeforeRemoval to prevent premature tenant removal from a single sync miss.

X-Lerian-Ref: 0x1
Replace Fatal with Error in postgres, fix mutex contention in MongoManager, URL-encode credentials in URIs, defensive WithTimeout, Bearer-only token extraction, errors.Join in Close methods, deterministic map iteration, remove poison message DLX, update Fiber to v2.52.11.

X-Lerian-Ref: 0x1
…e coverage

Add test config fixtures, table-driven refactoring for type getters, middleware WithTenantDB tests, and URL-encoding tests for mongo URI builder.

X-Lerian-Ref: 0x1
Fix 138 linter issues: wsl whitespace, dogsled, errcheck, predeclared param names, staticcheck, unparam, unused code, and complexity. Add gosec nolint for SSRF false positives and password DTOs. Add URL validation in client constructor.

X-Lerian-Ref: 0x1
Convert nolint:gosec to nosec directives for standalone gosec compatibility. Add explicit error discards for Close calls to suppress G104 warnings.

X-Lerian-Ref: 0x1
Update go.mod module declaration and all internal imports from github.com/LerianStudio/lib-commons/v2 to github.com/LerianStudio/lib-commons/v3 for major version bump.

X-Lerian-Ref: 0x1
chore: migrate module path from v2 to v3
marcelo-lerian and others added 9 commits March 19, 2026 17:20
…and timeout clamping

Four verified findings addressed:

1. IdentityFromHeader and IdentityFromIPAndHeader now URL-encode each component and
   prefix with type tags (hdr:/ip:) so header values that look like IPs, IPv6 colons,
   and '#' characters cannot produce colliding Redis keys. Format:
   IdentityFromHeader   → hdr:<encoded> or ip:<encoded>
   IdentityFromIPAndHeader → ip:<encodedIP>:hdr:<encodedVal> or ip:<encodedIP>

2. WithRateLimit and WithDynamicRateLimit now reject tiers whose Window <= 0 or
   whose Window.Milliseconds() == 0 (sub-millisecond). Such windows cause PEXPIRE 0,
   silently expiring every key and bypassing the rate limit entirely. The handlers
   return 503 misconfigured_rate_limiter instead of calling check.

3. RATE_LIMIT_REDIS_TIMEOUT_MS env var is clamped to fallbackRedisTimeoutMS when
   non-positive, preventing an immediately-expired context.WithTimeout that would
   make every Redis call fail at startup.

4. TestNew_RateLimitEnabledEnv now always calls t.Setenv regardless of whether
   tt.envVal is empty, making the empty-string case deterministic under any
   inherited environment.

X-Lerian-Ref: 0x1
…entityFromIPAndHeader

The previous encoding used ':' as separator between ip and hdr components (ip:<ip>:hdr:<val>), which reverted the deliberate decision to use '#' over ':'. With URL encoding, '#' in header values is encoded as %23 and IPv6 colons as %3A, making '#' an unambiguous component boundary while keeping ':' only within the tag names (ip:, hdr:). Final format: ip:<encodedIP>#hdr:<encodedVal>.

X-Lerian-Ref: 0x1
…event goroutine leaks

When EnableTelemetry=true and CollectorExporterEndpoint is empty,
NewTelemetry now returns a noop Telemetry with globals applied instead
of bare nil. This prevents downstream libraries (e.g. otelfiber) from
falling back to default gRPC exporters that leak background goroutines.

Closes #370
…pty-endpoint

Fix/otel noop globals on empty endpoint
…iations/

Tenant-manager consolidated all tenant-scoped routes under /associations/ (issue #134). Updates the connections endpoint path to match.

X-Lerian-Ref: 0x1
…ions-path

fix(client): update tenant-manager endpoint from /services/ to /associations/
@qnen qnen self-assigned this Mar 20, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

💤 Files selected but had no reviewable changes (2)
  • commons/opentelemetry/otel.go
  • commons/opentelemetry/otel_test.go
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c8d011af-8ae0-4030-a7d2-2466a7de6af9

📥 Commits

Reviewing files that changed from the base of the PR and between 977411b and dfc8f4d.

📒 Files selected for processing (2)
  • commons/opentelemetry/otel.go
  • commons/opentelemetry/otel_test.go

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This pull request implements a comprehensive version 4 release of the lib-commons library. Changes include removal of git hooks (commit-msg, pre-commit, pre-push, pre-receive), updates to build tooling and CI configurations, and extensive library restructuring. The logging interface is redesigned from method-based (Info/Error/etc.) to structured context-aware methods (Log). New packages are introduced including assertion frameworks, backoff/retry utilities, cron expression parsing, JWT token handling, and enhanced security helpers. Existing packages are significantly refactored: MongoDB connector moves from singleton pattern to explicit Client lifecycle management; circuit breaker adds metrics and health-check integrations; context utilities add cloning and nil-safety features. Documentation is substantially reorganized with migration guides and project rules. Configuration files are updated for linting, release, and test automation.

coderabbitai[bot]
coderabbitai bot previously requested changes Mar 20, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 29

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/go-combined-analysis.yml (1)

54-57: 🧹 Nitpick | 🔵 Trivial

Consider pinning gosec version for reproducibility.

Using securego/gosec@master can lead to inconsistent builds as the action updates. Consider pinning to a specific version tag for reproducibility, similar to how the Makefile pins GOSEC_VERSION ?= v2.22.4.

♻️ Proposed fix to pin gosec version
       - name: Gosec Scanner
-        uses: securego/gosec@master
+        uses: securego/gosec@v2.22.4
         with:
           args: ./...
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/go-combined-analysis.yml around lines 54 - 57, Replace the
floating action reference securego/gosec@master used in the "Gosec Scanner"
workflow step with a pinned tag matching the project's pinned GoSec version
(e.g., the Makefile's GOSEC_VERSION ?= v2.22.4), so update the uses value to use
that specific tag (securego/gosec@v2.22.4) or reference the GOSEC_VERSION
variable if you source it into the workflow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CHANGELOG.md`:
- Around line 1-3: Replace the placeholder CHANGELOG.md with versioned release
sections: add at minimum a v4.0.0 heading that lists "Breaking Changes",
"Migration Steps", and "Key Fixes/Features", then add subsequent release
headings (e.g., v4.0.1, v4.1.0) with short summaries; ensure the top of the file
keeps the existing "Changelog" heading and that each release section includes
concrete items (bullet or short-line entries) describing the behavior changes
and upgrade guidance so consumers can follow migration steps for the v4
migration.

In `@commons/assert/assert.go`:
- Around line 202-207: When logger == nil the stderr fallback currently only
prints msg and drops the assertion context/stack; update the stderr path to
mirror the structured-logger output by emitting the collapsed details string and
the stack trace as well (i.e., print details and string(stack) alongside msg),
while preserving the existing behavior when logger != nil; apply the same change
to the other fallback block that handles msg/details/stack (the second
occurrence around the Halt/goroutine flow) so both non-logger paths include
details and stack for diagnostics.
- Around line 141-155: In Asserter.NoError, replace the direct nil check (err ==
nil) with a call to isNil(err) so interface-wrapped nils are detected and
NoError returns nil; do this before any use of err so you never call err.Error()
on a typed-nil. Update the early-return condition to use isNil(err) and leave
the rest of the function (building kvWithError, using err.Error(), and calling
asserter.fail) unchanged so behavior matches NotNil and avoids panics.

In `@commons/assert/benchmark_test.go`:
- Around line 17-37: Benchmarks like BenchmarkThat_True and
BenchmarkThat_TrueWithContext repeatedly call context.Background() inside tight
loops, adding noise; hoist a single ctx := context.Background() (or separate
ctxs where different contexts are used) outside each b.N loop and pass that ctx
into asserter.That (and similarly for other benchmark helpers referenced around
lines 44-46, 65-67, 72-74, 148-156) so the timed section measures only the
assertion/predicate work rather than context allocation.

In `@commons/assert/predicates_test.go`:
- Around line 216-217: The test case entries in predicates_test.go that use
now.Add(time.Second) (the "one second future invalid" case in the test table)
are flaky in CI; update that entry to use a wider offset (e.g., time.Minute or
time.Hour) so the value remains in the future during evaluation—locate the table
of test cases in predicates_test.go and replace time.Second with a larger
duration for the future-case rows (e.g., change now.Add(time.Second) to
now.Add(time.Minute)).

In `@commons/assert/predicates.go`:
- Around line 311-335: Both predicates currently treat blank/whitespace-only
entries as valid; update TransactionHasOperations and
TransactionOperationsContain to first trim entries and drop any empty strings
before evaluating. Specifically, in TransactionHasOperations iterate the input
slice, apply strings.TrimSpace and count only non-empty tokens (return true only
if at least one non-empty token exists). In TransactionOperationsContain build
the allowedSet from trimmed non-empty allowed tokens and iterate trimmed
non-empty operations (return false if either filtered list is empty) so blank
tokens are ignored for both presence and subset checks.

In `@commons/circuitbreaker/healthchecker.go`:
- Around line 206-210: Update the OnStateChange comment on healthChecker to
state that the incoming context parameter is intentionally ignored (hence the
signature uses _ context.Context) because health-check work is scheduled to run
from context.Background() and its lifecycle is controlled by stopChan rather
than the caller's request context; reference the healthChecker.OnStateChange
method, mention context.Background() and stopChan to clarify why the request
context isn't used.

In `@commons/circuitbreaker/manager_test.go`:
- Around line 355-369: TestGetOrCreate_ReturnExistingBreaker currently only
compares cb1.State() and cb2.State(), which can be equal for two distinct
instances; change the test to prove reuse by either asserting pointer/identity
equality of cb1 and cb2 returned from Manager.GetOrCreate or by mutating shared
mutable state on cb1 (e.g., call a method that changes state such as Trip/Fail
or increment a failure counter exposed by the breaker) and then asserting the
same change is visible on cb2; update the assertions in
TestGetOrCreate_ReturnExistingBreaker to use identity comparison or the mutation
check so it verifies real reuse of the breaker instance.
- Around line 325-328: The test double mockStateChangeListener currently
discards the listener context in OnStateChange; update the mock so its callback
signature (onStateChangeFn) accepts context.Context and invoke it with the
received ctx (i.e., change mockStateChangeListener.OnStateChange to call
m.onStateChangeFn(ctx, serviceName, from, to) when non-nil). This preserves and
exercises the timeout-bound context propagation in tests (look for
mockStateChangeListener and onStateChangeFn references).

In `@commons/circuitbreaker/types.go`:
- Around line 72-94: Change the receiver of the Config validation method from a
value receiver to a pointer receiver to follow project guidelines: update the
method signature for Validate on type Config (function name Validate, receiver
Config) to use *Config instead of Config and ensure any callers still work with
the pointer receiver; no logic changes inside the method are needed.

In `@commons/constants/headers.go`:
- Around line 14-17: The DSL and FileExtension constants are misplaced in the
HTTP headers file; move the exported constants DSL and FileExtension into a new
file (e.g., file.go or dsl.go) within the same constants package, remove them
from headers.go, keep the same package name and identifiers, and update any
references across the codebase to point to the constants package as before so
compilation is unaffected.
- Around line 20-21: HeaderTraceparent and HeaderTraceparentPascal currently
have identical values; pick one of two fixes: either consolidate by removing
HeaderTraceparentPascal and replace its callers to use HeaderTraceparent (keep
the W3C doc comment on HeaderTraceparent), or make the distinction explicit by
changing HeaderTraceparentPascal to the gRPC/metadata form you intend (e.g.,
lowercase "traceparent") and update its doc comment to state "for gRPC
metadata". Do the same for the analogous pair HeaderTracestate /
HeaderTracestatePascal. Ensure all references in code are updated to the chosen
constant names so there are no duplicates or mismatched usages.

In `@commons/context_test.go`:
- Around line 164-170: Replace value equality checks with identity checks for
the injected logger: in the test that calls ContextWithLogger and
NewLoggerFromContext (and the other two assertions noted), change the
assert.Equal calls to an identity assertion (e.g., assert.Same or require.Same)
so the test verifies the exact logger instance (nop := &log.NopLogger{})
returned from NewLoggerFromContext, and update the other two logger assertions
in this file (the ones around the calls to
ContextWithLogger/NewLoggerFromContext at the other locations) the same way.

In `@commons/context.go`:
- Around line 46-57: The current interface-level nil checks can miss typed-nil
implementations; update NewLoggerFromContext (and the other guard around the
local logger variable referenced in the review) to detect typed-nil values by
doing a type switch or type assertion on CustomContextKeyValue.Logger (check
concrete types such as *GoLogger, *zap.Logger, *log.NopLogger) and ensure the
underlying pointer is non-nil before returning it; if the asserted pointer is
nil or the type is unknown, return &log.NopLogger{} instead. Ensure you apply
the same typed-nil detection logic where the review points to the other logger
check so no typed-nil loggers escape the guard.

In `@commons/cron/cron_test.go`:
- Around line 142-194: Multiple near-duplicate tests
(TestParse_InvalidExpression, TestParse_EmptyString, TestParse_TooFewFields,
TestParse_TooManyFields, TestParse_OutOfRangeValue, TestParse_InvalidStep) all
call Parse and assert ErrInvalidExpression; consolidate them into one
table-driven test (e.g., TestParse_InvalidExpressions) that defines a slice of
cases with name and expr, ranges over them with t.Run and t.Parallel per
subtest, calls Parse(tc.expr) and uses require.Error + assert.ErrorIs(err,
ErrInvalidExpression); remove the individual TestParse_* functions to avoid
duplication and keep the test suite concise.

In `@commons/crypto/crypto_test.go`:
- Line 14: Add a gitleaks/secret-scanner allowlist entry for the deterministic
test fixture constant validHexKey in crypto_test.go so the scanner ignores this
known test key; update the repository's secret-scan config (allowlist rules) to
permit patterns or specific matches for *_test.go files or the exact constant
name validHexKey so CI gitleaks no longer flags this intentional test fixture.

In `@commons/errgroup/errgroup_test.go`:
- Around line 160-163: The test currently relies on time.Sleep inside the first
group.Go goroutine to make its panic occur before the other goroutine, which is
flaky; replace the time-based ordering with deterministic channel coordination:
add an "allowPanic" (or "proceed") channel, have the panic goroutine wait on
<-allowPanic instead of time.Sleep, signal readiness via the existing started
channel, then in the test close(allowPanic) (or send to it) before starting or
unblocking the second goroutine so the panic always happens first; update the
goroutine bodies referenced (group.Go, the panic goroutine, and the other
goroutine that returns an error) to use started and allowPanic to enforce
deterministic ordering.

In `@commons/errgroup/errgroup.go`:
- Around line 69-71: The WithContext function currently calls
context.WithCancel(ctx) which will panic if ctx is nil; update WithContext to
nil-guard the input by replacing a nil ctx with context.Background() before
calling context.WithCancel. Specifically, in WithContext check if ctx == nil
then set ctx = context.Background(), then call context.WithCancel(ctx) and
return &Group{ctx: ctx, cancel: cancel}, ctx so Group and its cancel remain
correct.

In `@commons/internal/nilcheck/nilcheck_test.go`:
- Around line 21-49: The TestInterface function is not table-driven; convert it
to a table-driven test to match PROJECT_RULES.md: create a slice of test cases
with fields (name, value, wantBool) that includes all current inputs (nil,
nilPointer, nilSlice, nilMap, nilChan, nilFunc, nilIface, typedNilIface, 0, "",
sampleStruct{}, &sampleStruct{}, []string{}) and iterate them with t.Run,
asserting Interface(tc.value) equals tc.wantBool; keep t.Parallel where
appropriate and reference the existing TestInterface test and the Interface
function when implementing the new table-driven structure.

In `@commons/internal/nilcheck/nilcheck.go`:
- Around line 14-15: The switch that returns v.IsNil() for nil-capable kinds
(case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map,
reflect.Pointer, reflect.Slice) must include reflect.UnsafePointer so
unsafe.Pointer(nil) is treated as nil; update the case in the nil-checking
function in commons/internal/nilcheck/nilcheck.go to include
reflect.UnsafePointer and add a unit test that asserts the function returns true
for unsafe.Pointer(nil) to prevent regressions.

In `@commons/log/log.go`:
- Line 9: Update the package comment for the Logger symbol to clarify that "v2"
refers to the internal structured-logging API generation, not the Go module
semantic version; specifically edit the comment line containing "Logger is the
package interface for v2 logging." to mention that v2 denotes the evolved
structured logging interface (see commons/log/doc.go) and is independent of the
module's v4 versioning so readers won't confuse API generation version with Go
module versioning.

In `@commons/log/sanitizer.go`:
- Around line 8-15: The SafeError function currently forwards the
caller-supplied msg into logs even when production=true; change SafeError to
avoid emitting msg text in the production branch and instead log only the
error's type/name (and any minimal context like an obfuscated field summary),
ensuring no raw caller message or sensitive payloads are included; locate
SafeError (and the other production branches that currently forward msg in the
same file) and replace direct msg forwarding with a sanitized summary (error
type and obfuscated-sensitive-fields) or a fixed production-safe message.

In `@commons/mongo/connection_string.go`:
- Around line 56-65: The current code mutates the caller's cfg.Query when adding
authSource; to fix, implement a cloneValues helper that deep-copies a url.Values
(copying slices) and use it whenever you need to modify cfg.Query: replace
direct use of cfg.Query in the branch that checks query == nil ||
!query.Has("authSource") by first cloning (if cfg.Query != nil) and then calling
Set("authSource", "admin") on the clone so the original cfg.Query remains
unchanged; reference the local variable query and the new cloneValues function
when making this change.

In `@commons/mongo/mongo_integration_test.go`:
- Around line 47-52: The cleanup closure currently calls require.NoError(t,
container.Terminate(closeCtx)) which can fail the test after it already passed;
change the closure to capture the error from container.Terminate(closeCtx) and
log it instead of asserting, e.g. call container.Terminate with the same
closeCtx/closeCancel and if err != nil use t.Logf or t.Errorf to record
"container termination failed: %v" (referencing container.Terminate, closeCtx,
closeCancel and the anonymous cleanup function) so teardown failures are
reported but do not mark the test as failed.

In `@Makefile`:
- Line 83: Add clear inline documentation and usage guidance for the
RETRY_ON_FAIL Makefile variable: update the Makefile near the RETRY_ON_FAIL
definition to include a comment describing its purpose, allowed values, and
recommended use cases (only for transient infra issues like container startup in
integration tests), and add a short note in the project README or CONTRIBUTING
that warns that enabling RETRY_ON_FAIL can mask flaky tests and should be used
sparingly with examples of acceptable use (e.g., retry count 1-3 for CI jobs
that depend on non-deterministic external services). Ensure references to
RETRY_ON_FAIL appear alongside any test or CI targets that honor it (search for
its usage in test targets) and clarify the default value and how to override it
in CI pipelines.
- Around line 77-79: The Makefile's GOLANGCI_LINT_VERSION variable is misaligned
with the CI workflow; update the GOLANGCI_LINT_VERSION definition (symbol:
GOLANGCI_LINT_VERSION) to match the version used in the workflow (v2.11.2) so
local and CI linting use the same golangci-lint release, and ensure any related
references (e.g., in targets that consume GOLANGCI_LINT_VERSION) continue to
work with the updated value.

In `@README.md`:
- Line 54: Update the README line describing the package (the paragraph that
starts with "commons/net/http/ratelimit") to hyphenate the compound adjective:
change "Redis-backed distributed rate limiting middleware" to "Redis-backed
distributed rate-limiting middleware"; keep the rest of the sentence intact (the
list of symbols like New, WithDefaultRateLimit, WithRateLimit,
WithDynamicRateLimit, MethodTierSelector,
DefaultTier/AggressiveTier/RelaxedTier,
IdentityFromIP/IdentityFromHeader/IdentityFromIPAndHeader, WithOnLimited,
RedisStorage/NewRedisStorage should remain unchanged).

In `@REVIEW.md`:
- Line 3: The report currently preserves intentionally duplicated findings;
update the generation step that produces the "Generated from 54 reviewer-agent
runs..." section to deduplicate entries by a canonical key composed of file path
+ symbol (e.g., function/class/line identifier) + root-cause, collapsing
duplicates into a single entry and adding an occurrence_count field for how many
times it appeared; locate the report assembly logic that emits the findings list
(the code that produces the "Generated from ..." block in REVIEW.md) and change
it to build a map keyed by (file, symbol, root-cause), emit one canonical entry
per key with occurrence_count, and omit the original duplicate entries.
- Around line 8-388: The review file uses non-repo-relative paths like
references/lib-commons/... which are hard to navigate; update all findings in
REVIEW.md to use repository-relative paths (e.g. commons/..., net/http/...,
opentelemetry/..., tenant-manager/...) so code-review tooling links resolve
directly. Locate and replace the repeated prefix "references/lib-commons/"
across the document (search for that exact token and the listed occurrences such
as commons/opentelemetry/otel.go, commons/net/http/withTelemetry.go,
commons/tenant-manager/middleware/tenant.go, etc.), normalize any path
formatting/commas/line-wrapped lists to valid repo-relative file paths, and
add/adjust any failing links or anchors; optionally add a small validation (CI
lint) that REVIEW.md paths are repo-relative to prevent regressions.

---

Outside diff comments:
In @.github/workflows/go-combined-analysis.yml:
- Around line 54-57: Replace the floating action reference securego/gosec@master
used in the "Gosec Scanner" workflow step with a pinned tag matching the
project's pinned GoSec version (e.g., the Makefile's GOSEC_VERSION ?= v2.22.4),
so update the uses value to use that specific tag (securego/gosec@v2.22.4) or
reference the GOSEC_VERSION variable if you source it into the workflow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 85363ac0-bf44-4097-b65a-0b3ce94b16ce

📥 Commits

Reviewing files that changed from the base of the PR and between 5ed6219 and 977411b.

📒 Files selected for processing (300)
  • .githooks/commit-msg/commit-msg
  • .githooks/pre-commit/pre-commit
  • .githooks/pre-push/pre-push
  • .githooks/pre-receive/pre-receive
  • .github/workflows/go-combined-analysis.yml
  • .gitignore
  • .golangci.yml
  • .goreleaser.yml
  • AGENTS.md
  • CHANGELOG.md
  • CLAUDE.md
  • MIGRATION_MAP.md
  • Makefile
  • README.md
  • REVIEW.md
  • commons/app.go
  • commons/app_test.go
  • commons/assert/assert.go
  • commons/assert/assert_extended_test.go
  • commons/assert/assert_test.go
  • commons/assert/benchmark_test.go
  • commons/assert/doc.go
  • commons/assert/predicates.go
  • commons/assert/predicates_test.go
  • commons/backoff/backoff.go
  • commons/backoff/backoff_test.go
  • commons/backoff/doc.go
  • commons/circuitbreaker/config.go
  • commons/circuitbreaker/doc.go
  • commons/circuitbreaker/fallback_example_test.go
  • commons/circuitbreaker/healthchecker.go
  • commons/circuitbreaker/healthchecker_test.go
  • commons/circuitbreaker/manager.go
  • commons/circuitbreaker/manager_example_test.go
  • commons/circuitbreaker/manager_metrics_test.go
  • commons/circuitbreaker/manager_test.go
  • commons/circuitbreaker/types.go
  • commons/circuitbreaker/types_test.go
  • commons/constants/datasource.go
  • commons/constants/doc.go
  • commons/constants/errors.go
  • commons/constants/headers.go
  • commons/constants/log.go
  • commons/constants/metadata.go
  • commons/constants/obfuscation.go
  • commons/constants/opentelemetry.go
  • commons/constants/opentelemetry_test.go
  • commons/constants/pagination.go
  • commons/constants/response.go
  • commons/constants/transaction.go
  • commons/context.go
  • commons/context_clone_test.go
  • commons/context_example_test.go
  • commons/context_test.go
  • commons/cron/cron.go
  • commons/cron/cron_test.go
  • commons/cron/doc.go
  • commons/crypto/crypto.go
  • commons/crypto/crypto_nil_test.go
  • commons/crypto/crypto_test.go
  • commons/crypto/doc.go
  • commons/doc.go
  • commons/errgroup/doc.go
  • commons/errgroup/errgroup.go
  • commons/errgroup/errgroup_nil_test.go
  • commons/errgroup/errgroup_test.go
  • commons/errors.go
  • commons/errors_test.go
  • commons/internal/nilcheck/nilcheck.go
  • commons/internal/nilcheck/nilcheck_test.go
  • commons/jwt/doc.go
  • commons/jwt/jwt.go
  • commons/jwt/jwt_test.go
  • commons/license/doc.go
  • commons/license/manager.go
  • commons/license/manager_nil_test.go
  • commons/license/manager_test.go
  • commons/log/doc.go
  • commons/log/go_logger.go
  • commons/log/log.go
  • commons/log/log_example_test.go
  • commons/log/log_mock.go
  • commons/log/log_test.go
  • commons/log/nil.go
  • commons/log/sanitizer.go
  • commons/log/sanitizer_test.go
  • commons/mongo/connection_string.go
  • commons/mongo/connection_string_example_test.go
  • commons/mongo/connection_string_test.go
  • commons/mongo/doc.go
  • commons/mongo/mongo.go
  • commons/mongo/mongo_integration_test.go
  • commons/mongo/mongo_test.go
  • commons/net/http/context.go
  • commons/net/http/context_nil_error_test.go
  • commons/net/http/context_ownership.go
  • commons/net/http/context_span.go
  • commons/net/http/context_test.go
  • commons/net/http/cursor.go
  • commons/net/http/cursor_example_test.go
  • commons/net/http/cursor_test.go
  • commons/net/http/doc.go
  • commons/net/http/error.go
  • commons/net/http/error_test.go
  • commons/net/http/handler.go
  • commons/net/http/handler_nil_test.go
  • commons/net/http/handler_test.go
  • commons/net/http/health.go
  • commons/net/http/health_config_test.go
  • commons/net/http/health_integration_test.go
  • commons/net/http/health_test.go
  • commons/net/http/matcher_response.go
  • commons/net/http/matcher_response_test.go
  • commons/net/http/middleware_example_test.go
  • commons/net/http/pagination.go
  • commons/net/http/pagination_cursor_timestamp_test.go
  • commons/net/http/pagination_cursor_uuid_test.go
  • commons/net/http/pagination_sort.go
  • commons/net/http/pagination_sort_test.go
  • commons/net/http/pagination_strict_test.go
  • commons/net/http/pagination_test.go
  • commons/net/http/pagination_timestamp.go
  • commons/net/http/proxy.go
  • commons/net/http/proxy_defensive_test.go
  • commons/net/http/proxy_forwarding_test.go
  • commons/net/http/proxy_ssrf_test.go
  • commons/net/http/proxy_test.go
  • commons/net/http/proxy_transport.go
  • commons/net/http/proxy_transport_test.go
  • commons/net/http/proxy_validation.go
  • commons/net/http/ratelimit/doc.go
  • commons/net/http/ratelimit/middleware.go
  • commons/net/http/ratelimit/middleware_options.go
  • commons/net/http/ratelimit/middleware_test.go
  • commons/net/http/ratelimit/redis_storage.go
  • commons/net/http/ratelimit/redis_storage_integration_test.go
  • commons/net/http/ratelimit/redis_storage_test.go
  • commons/net/http/ratelimit/server_test.go
  • commons/net/http/response.go
  • commons/net/http/response_test.go
  • commons/net/http/validation.go
  • commons/net/http/validation_parse_test.go
  • commons/net/http/validation_query_test.go
  • commons/net/http/validation_rules_amount_test.go
  • commons/net/http/validation_rules_field_test.go
  • commons/net/http/validation_test.go
  • commons/net/http/withBasicAuth.go
  • commons/net/http/withBasicAuth_test.go
  • commons/net/http/withCORS.go
  • commons/net/http/withCORS_test.go
  • commons/net/http/withLogging.go
  • commons/net/http/withLogging_grpc_test.go
  • commons/net/http/withLogging_middleware.go
  • commons/net/http/withLogging_obfuscation.go
  • commons/net/http/withLogging_sanitize.go
  • commons/net/http/withLogging_test.go
  • commons/net/http/withTelemetry.go
  • commons/net/http/withTelemetry_helpers.go
  • commons/net/http/withTelemetry_metrics.go
  • commons/net/http/withTelemetry_route_test.go
  • commons/net/http/withTelemetry_test.go
  • commons/opentelemetry/README.md
  • commons/opentelemetry/doc.go
  • commons/opentelemetry/extract_queue_test.go
  • commons/opentelemetry/inject_trace_test.go
  • commons/opentelemetry/metrics/METRICS_USAGE.md
  • commons/opentelemetry/metrics/account.go
  • commons/opentelemetry/metrics/builders.go
  • commons/opentelemetry/metrics/doc.go
  • commons/opentelemetry/metrics/labels.go
  • commons/opentelemetry/metrics/metrics.go
  • commons/opentelemetry/metrics/operation_routes.go
  • commons/opentelemetry/metrics/system.go
  • commons/opentelemetry/metrics/system_test.go
  • commons/opentelemetry/metrics/transaction.go
  • commons/opentelemetry/metrics/transaction_routes.go
  • commons/opentelemetry/metrics/v2_test.go
  • commons/opentelemetry/obfuscation.go
  • commons/opentelemetry/obfuscation_example_test.go
  • commons/opentelemetry/obfuscation_test.go
  • commons/opentelemetry/otel.go
  • commons/opentelemetry/otel_example_test.go
  • commons/opentelemetry/otel_test.go
  • commons/opentelemetry/processor.go
  • commons/opentelemetry/processor_test.go
  • commons/opentelemetry/queue_trace_example_test.go
  • commons/opentelemetry/queue_trace_test.go
  • commons/opentelemetry/v2_test.go
  • commons/os.go
  • commons/os_test.go
  • commons/outbox/classifier.go
  • commons/outbox/config.go
  • commons/outbox/config_test.go
  • commons/outbox/dispatcher.go
  • commons/outbox/dispatcher_test.go
  • commons/outbox/doc.go
  • commons/outbox/errors.go
  • commons/outbox/event.go
  • commons/outbox/event_test.go
  • commons/outbox/handler.go
  • commons/outbox/handler_test.go
  • commons/outbox/metrics.go
  • commons/outbox/metrics_test.go
  • commons/outbox/postgres/column_resolver.go
  • commons/outbox/postgres/column_resolver_test.go
  • commons/outbox/postgres/db.go
  • commons/outbox/postgres/db_test.go
  • commons/outbox/postgres/doc.go
  • commons/outbox/postgres/migrations/000001_outbox_events_schema.down.sql
  • commons/outbox/postgres/migrations/000001_outbox_events_schema.up.sql
  • commons/outbox/postgres/migrations/README.md
  • commons/outbox/postgres/migrations/column/000001_outbox_events_column.down.sql
  • commons/outbox/postgres/migrations/column/000001_outbox_events_column.up.sql
  • commons/outbox/postgres/repository.go
  • commons/outbox/postgres/repository_integration_test.go
  • commons/outbox/postgres/repository_test.go
  • commons/outbox/postgres/schema_resolver.go
  • commons/outbox/postgres/schema_resolver_test.go
  • commons/outbox/repository.go
  • commons/outbox/sanitizer.go
  • commons/outbox/sanitizer_test.go
  • commons/outbox/status.go
  • commons/outbox/status_test.go
  • commons/outbox/tenant.go
  • commons/outbox/tenant_test.go
  • commons/pointers/doc.go
  • commons/pointers/pointers.go
  • commons/pointers/pointers_test.go
  • commons/postgres/doc.go
  • commons/postgres/migration_integration_test.go
  • commons/postgres/pagination.go
  • commons/postgres/postgres.go
  • commons/postgres/postgres_integration_test.go
  • commons/postgres/postgres_test.go
  • commons/postgres/resilience_integration_test.go
  • commons/rabbitmq/dlq.go
  • commons/rabbitmq/dlq_test.go
  • commons/rabbitmq/doc.go
  • commons/rabbitmq/publisher.go
  • commons/rabbitmq/publisher_test.go
  • commons/rabbitmq/rabbitmq.go
  • commons/rabbitmq/rabbitmq_integration_test.go
  • commons/rabbitmq/rabbitmq_test.go
  • commons/rabbitmq/trace_propagation_integration_test.go
  • commons/redis/doc.go
  • commons/redis/iam_example_test.go
  • commons/redis/lock.go
  • commons/redis/lock_integration_test.go
  • commons/redis/lock_interface.go
  • commons/redis/lock_test.go
  • commons/redis/redis.go
  • commons/redis/redis_example_test.go
  • commons/redis/redis_integration_test.go
  • commons/redis/redis_test.go
  • commons/redis/resilience_integration_test.go
  • commons/runtime/doc.go
  • commons/runtime/error_reporter.go
  • commons/runtime/error_reporter_test.go
  • commons/runtime/example_test.go
  • commons/runtime/goroutine.go
  • commons/runtime/goroutine_test.go
  • commons/runtime/helpers_test.go
  • commons/runtime/log_mode_link_test.go
  • commons/runtime/metrics.go
  • commons/runtime/metrics_test.go
  • commons/runtime/policy.go
  • commons/runtime/policy_test.go
  • commons/runtime/recover.go
  • commons/runtime/recover_test.go
  • commons/runtime/tracing.go
  • commons/runtime/tracing_test.go
  • commons/safe/doc.go
  • commons/safe/math.go
  • commons/safe/math_test.go
  • commons/safe/regex.go
  • commons/safe/regex_example_test.go
  • commons/safe/regex_test.go
  • commons/safe/safe_example_test.go
  • commons/safe/slice.go
  • commons/safe/slice_test.go
  • commons/secretsmanager/m2m.go
  • commons/secretsmanager/m2m_test.go
  • commons/security/doc.go
  • commons/security/sensitive_fields.go
  • commons/security/sensitive_fields_test.go
  • commons/server/doc.go
  • commons/server/grpc_test.go
  • commons/server/shutdown.go
  • commons/server/shutdown_example_test.go
  • commons/server/shutdown_integration_test.go
  • commons/server/shutdown_test.go
  • commons/shell/logo.txt
  • commons/shell/makefile_colors.mk
  • commons/shell/makefile_utils.mk
  • commons/stringUtils.go
  • commons/stringUtils_test.go
  • commons/tenant-manager/cache/config_cache.go
  • commons/tenant-manager/cache/memory.go
  • commons/tenant-manager/cache/memory_test.go
  • commons/tenant-manager/client/client.go
💤 Files with no reviewable changes (7)
  • commons/constants/datasource.go
  • commons/constants/obfuscation.go
  • commons/circuitbreaker/config.go
  • .githooks/pre-receive/pre-receive
  • .githooks/pre-commit/pre-commit
  • .githooks/commit-msg/commit-msg
  • .githooks/pre-push/pre-push

Comment on lines +1 to +3
# Changelog


### Bug Fixes

* improve SafeIntToUint32 function by using uint64 for overflow checks :bug: ([4340367](https://github.com/LerianStudio/lib-commons/commit/43403675c46dc513cbfa12102929de0387f026cd))

## [2.4.0](https://github.com/LerianStudio/lib-commons/compare/v2.3.0...v2.4.0) (2025-10-30)


### Features

* **redis:** add RateLimiterLockOptions helper function ([6535d18](https://github.com/LerianStudio/lib-commons/commit/6535d18146a36eaf23584893b7ff4fdef0d6fe61))
* **ratelimit:** add Redis-based rate limiting with global middleware support ([9a976c3](https://github.com/LerianStudio/lib-commons/commit/9a976c3267adc45f77482f68a3e1ebc65c6baa42))
* **commons:** add SafeIntToUint32 utility with overflow protection and logging ([5a13d45](https://github.com/LerianStudio/lib-commons/commit/5a13d45f0a3cd2fafdb3debf99017bac473083f7))
* add service unavailable error code and standardize rate limit responses ([f65af5a](https://github.com/LerianStudio/lib-commons/commit/f65af5a258b3d7659e3b5afc0854036d8ace14b5))
* **circuitbreaker:** add state change notifications and immediate health checks ([2532b8b](https://github.com/LerianStudio/lib-commons/commit/2532b8b9605619b8b3a6f0f6e1ec0b3574de5516))
* Adding datasource constants. ([5a04f8a](https://github.com/LerianStudio/lib-commons/commit/5a04f8a5eb139318b7b71c1fef9d966bfd296f50))
* **circuitbreaker:** extend HealthChecker interface to include state change notifications ([9087254](https://github.com/LerianStudio/lib-commons/commit/90872540cf2aad78d642596652789747075e71c7))
* **circuitbreaker:** implement circuit breaker package with health checks and state management ([d93b161](https://github.com/LerianStudio/lib-commons/commit/d93b1610c0cae3be263be4e684afc157c88e93b4))
* **redis:** implement distributed locking with RedLock algorithm ([5ee1bdb](https://github.com/LerianStudio/lib-commons/commit/5ee1bdb96af56371309231323f4be7e09c98e6b5))
* improve distributed locking and rate limiting reliability ([79dbad3](https://github.com/LerianStudio/lib-commons/commit/79dbad34e600d27a512c2f99104b91a77e6f0f3e))
* update OperateBalances to include balance versioning :sparkles: ([3a75235](https://github.com/LerianStudio/lib-commons/commit/3a75235256893ea35ea94edfe84789a84b620b2f))


### Bug Fixes

* add nil check for circuit breaker state change listener registration ([55da00b](https://github.com/LerianStudio/lib-commons/commit/55da00b081dcc0251433dcb702b14e98486348cd))
* add nil logger check and change warn to debug level in SafeIntToUint32 ([a72880c](https://github.com/LerianStudio/lib-commons/commit/a72880ca0525c05cf61802c0f976e7b872f85b51))
* add panic recovery to circuit breaker state change listeners ([96fe07e](https://github.com/LerianStudio/lib-commons/commit/96fe07eff47627fde636fbf814b687cdab3ecac7))
* **redis:** correct benchmark loop and test naming in rate limiter tests ([4622c78](https://github.com/LerianStudio/lib-commons/commit/4622c783412d81408697413d1e70d1ced6c6c3be))
* **redis:** correct goroutine test assertions in distributed lock tests ([b9e6d70](https://github.com/LerianStudio/lib-commons/commit/b9e6d703de7893cec558bb673632559175e4604f))
* update OperateBalances to handle unknown operations without changing balance version :bug: ([2f4369d](https://github.com/LerianStudio/lib-commons/commit/2f4369d1b73eaaf66bd2b9a430584c2f9a840ac4))

## [2.4.0-beta.9](https://github.com/LerianStudio/lib-commons/compare/v2.4.0-beta.8...v2.4.0-beta.9) (2025-10-30)


### Features

* improve distributed locking and rate limiting reliability ([79dbad3](https://github.com/LerianStudio/lib-commons/commit/79dbad34e600d27a512c2f99104b91a77e6f0f3e))

## [2.4.0-beta.8](https://github.com/LerianStudio/lib-commons/compare/v2.4.0-beta.7...v2.4.0-beta.8) (2025-10-29)


### Bug Fixes

* add panic recovery to circuit breaker state change listeners ([96fe07e](https://github.com/LerianStudio/lib-commons/commit/96fe07eff47627fde636fbf814b687cdab3ecac7))

## [2.4.0-beta.7](https://github.com/LerianStudio/lib-commons/compare/v2.4.0-beta.6...v2.4.0-beta.7) (2025-10-27)


### Features

* **commons:** add SafeIntToUint32 utility with overflow protection and logging ([5a13d45](https://github.com/LerianStudio/lib-commons/commit/5a13d45f0a3cd2fafdb3debf99017bac473083f7))
* **circuitbreaker:** add state change notifications and immediate health checks ([2532b8b](https://github.com/LerianStudio/lib-commons/commit/2532b8b9605619b8b3a6f0f6e1ec0b3574de5516))
* **circuitbreaker:** extend HealthChecker interface to include state change notifications ([9087254](https://github.com/LerianStudio/lib-commons/commit/90872540cf2aad78d642596652789747075e71c7))


### Bug Fixes

* add nil check for circuit breaker state change listener registration ([55da00b](https://github.com/LerianStudio/lib-commons/commit/55da00b081dcc0251433dcb702b14e98486348cd))
* add nil logger check and change warn to debug level in SafeIntToUint32 ([a72880c](https://github.com/LerianStudio/lib-commons/commit/a72880ca0525c05cf61802c0f976e7b872f85b51))

## [2.4.0-beta.6](https://github.com/LerianStudio/lib-commons/compare/v2.4.0-beta.5...v2.4.0-beta.6) (2025-10-24)


### Features

* **circuitbreaker:** implement circuit breaker package with health checks and state management ([d93b161](https://github.com/LerianStudio/lib-commons/commit/d93b1610c0cae3be263be4e684afc157c88e93b4))

## [2.4.0-beta.5](https://github.com/LerianStudio/lib-commons/compare/v2.4.0-beta.4...v2.4.0-beta.5) (2025-10-21)


### Features

* **redis:** add RateLimiterLockOptions helper function ([6535d18](https://github.com/LerianStudio/lib-commons/commit/6535d18146a36eaf23584893b7ff4fdef0d6fe61))
* **redis:** implement distributed locking with RedLock algorithm ([5ee1bdb](https://github.com/LerianStudio/lib-commons/commit/5ee1bdb96af56371309231323f4be7e09c98e6b5))


### Bug Fixes

* **redis:** correct benchmark loop and test naming in rate limiter tests ([4622c78](https://github.com/LerianStudio/lib-commons/commit/4622c783412d81408697413d1e70d1ced6c6c3be))
* **redis:** correct goroutine test assertions in distributed lock tests ([b9e6d70](https://github.com/LerianStudio/lib-commons/commit/b9e6d703de7893cec558bb673632559175e4604f))

## [2.4.0-beta.4](https://github.com/LerianStudio/lib-commons/compare/v2.4.0-beta.3...v2.4.0-beta.4) (2025-10-17)


### Features

* add service unavailable error code and standardize rate limit responses ([f65af5a](https://github.com/LerianStudio/lib-commons/commit/f65af5a258b3d7659e3b5afc0854036d8ace14b5))

## [2.4.0-beta.3](https://github.com/LerianStudio/lib-commons/compare/v2.4.0-beta.2...v2.4.0-beta.3) (2025-10-16)


### Features

* **ratelimit:** add Redis-based rate limiting with global middleware support ([9a976c3](https://github.com/LerianStudio/lib-commons/commit/9a976c3267adc45f77482f68a3e1ebc65c6baa42))

## [2.4.0-beta.2](https://github.com/LerianStudio/lib-commons/compare/v2.4.0-beta.1...v2.4.0-beta.2) (2025-10-15)


### Features

* update OperateBalances to include balance versioning :sparkles: ([3a75235](https://github.com/LerianStudio/lib-commons/commit/3a75235256893ea35ea94edfe84789a84b620b2f))


### Bug Fixes

* update OperateBalances to handle unknown operations without changing balance version :bug: ([2f4369d](https://github.com/LerianStudio/lib-commons/commit/2f4369d1b73eaaf66bd2b9a430584c2f9a840ac4))

## [2.4.0-beta.1](https://github.com/LerianStudio/lib-commons/compare/v2.3.0...v2.4.0-beta.1) (2025-10-14)


### Features

* Adding datasource constants. ([5a04f8a](https://github.com/LerianStudio/lib-commons/commit/5a04f8a5eb139318b7b71c1fef9d966bfd296f50))

## [2.3.0](https://github.com/LerianStudio/lib-commons/compare/v2.2.0...v2.3.0) (2025-09-18)


### Features

* **rabbitmq:** add EnsureChannel method to manage RabbitMQ connection and channel lifecycle :sparkles: ([9e6ebf8](https://github.com/LerianStudio/lib-commons/commit/9e6ebf89c727e52290e83754ed89303557f6f69d))
* add telemetry and logging to transaction validation and gRPC middleware ([0aabecc](https://github.com/LerianStudio/lib-commons/commit/0aabeccb0a7bb2f50dfc3cf9544cfe6b2dcddf91))
* Adding the crypto package of encryption and decryption. ([f309c23](https://github.com/LerianStudio/lib-commons/commit/f309c233404a56ca1bd3f27e7a9a28bd839fac37))
* Adding the crypto package of encryption and decryption. ([577b746](https://github.com/LerianStudio/lib-commons/commit/577b746c0dfad3dc863027bbe6f5508b194f7578))
* **transaction:** implement balanceKey support in operations :sparkles: ([38ac489](https://github.com/LerianStudio/lib-commons/commit/38ac489a64c11810bf406d7a2141b4aed3ca6746))
* **rabbitmq:** improve error logging in EnsureChannel method for connection and channel failures :sparkles: ([266febc](https://github.com/LerianStudio/lib-commons/commit/266febc427996da526abc7e50c53675b8abe2f18))
* some adjusts; ([60b206a](https://github.com/LerianStudio/lib-commons/commit/60b206a8bf1c8a299648a5df09aea76191dbea0c))


### Bug Fixes

* add error handling for short ciphertext in Decrypt method :bug: ([bc73d51](https://github.com/LerianStudio/lib-commons/commit/bc73d510bb21e5cc18a450d616746d21fbf85a3d))
* add nil check for uninitialized cipher in Decrypt method :bug: ([e1934a2](https://github.com/LerianStudio/lib-commons/commit/e1934a26e5e2b6012f3bfdcf4378f70f21ec659a))
* add nil check for uninitialized cipher in Encrypt method :bug: ([207cae6](https://github.com/LerianStudio/lib-commons/commit/207cae617e34bcf9ece83b61fbfbac308b935b44))
* Adjusting instance when telemetry is off. ([68504a7](https://github.com/LerianStudio/lib-commons/commit/68504a7080ce4f437a9f551ae4c259ed7c0daaa6))
* ensure nil check for values in AttributesFromContext function :bug: ([38f8c77](https://github.com/LerianStudio/lib-commons/commit/38f8c7725f9e91eff04c79b69983497f9ea5c86c))
* go.mod and go.sum; ([cda49e7](https://github.com/LerianStudio/lib-commons/commit/cda49e7e7d7a9b5da91155c43bdb9966826a7f4c))
* initialize no-op providers in InitializeTelemetry when telemetry is disabled to prevent nil-pointer panics :bug: ([c40310d](https://github.com/LerianStudio/lib-commons/commit/c40310d90f06952877f815238e33cc382a4eafbd))
* make lint ([ec9fc3a](https://github.com/LerianStudio/lib-commons/commit/ec9fc3ac4c39996b2e5ce308032f269380df32ee))
* **otel:** reorder shutdown sequence to ensure proper telemetry export and add span attributes from request params id ([44fc4c9](https://github.com/LerianStudio/lib-commons/commit/44fc4c996e2f322244965bb31c79e069719a1e1f))
* **cursor:** resolve first page prev_cursor bug and infinite loop issues; ([b0f8861](https://github.com/LerianStudio/lib-commons/commit/b0f8861c22521b6ec742a365560a439e28b866c4))
* **cursor:** resolve pagination logic errors and add comprehensive UUID v7 tests ([2d48453](https://github.com/LerianStudio/lib-commons/commit/2d4845332e94b8225e781b267eec9f405519a7f6))
* return TelemetryConfig in InitializeTelemetry when telemetry is disabled :bug: ([62bd90b](https://github.com/LerianStudio/lib-commons/commit/62bd90b525978ea2540746b367775143d39ca922))
* **http:** use HasPrefix instead of Contains for route exclusion matching ([9891eac](https://github.com/LerianStudio/lib-commons/commit/9891eacbd75dfce11ba57ebf2a6f38144dc04505))

## [2.3.0-beta.10](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.9...v2.3.0-beta.10) (2025-09-18)


### Bug Fixes

* add error handling for short ciphertext in Decrypt method :bug: ([bc73d51](https://github.com/LerianStudio/lib-commons/commit/bc73d510bb21e5cc18a450d616746d21fbf85a3d))
* add nil check for uninitialized cipher in Decrypt method :bug: ([e1934a2](https://github.com/LerianStudio/lib-commons/commit/e1934a26e5e2b6012f3bfdcf4378f70f21ec659a))
* add nil check for uninitialized cipher in Encrypt method :bug: ([207cae6](https://github.com/LerianStudio/lib-commons/commit/207cae617e34bcf9ece83b61fbfbac308b935b44))
* ensure nil check for values in AttributesFromContext function :bug: ([38f8c77](https://github.com/LerianStudio/lib-commons/commit/38f8c7725f9e91eff04c79b69983497f9ea5c86c))
* initialize no-op providers in InitializeTelemetry when telemetry is disabled to prevent nil-pointer panics :bug: ([c40310d](https://github.com/LerianStudio/lib-commons/commit/c40310d90f06952877f815238e33cc382a4eafbd))
* return TelemetryConfig in InitializeTelemetry when telemetry is disabled :bug: ([62bd90b](https://github.com/LerianStudio/lib-commons/commit/62bd90b525978ea2540746b367775143d39ca922))

## [2.3.0-beta.9](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.8...v2.3.0-beta.9) (2025-09-18)

## [2.3.0-beta.8](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.7...v2.3.0-beta.8) (2025-09-15)


### Features

* **rabbitmq:** add EnsureChannel method to manage RabbitMQ connection and channel lifecycle :sparkles: ([9e6ebf8](https://github.com/LerianStudio/lib-commons/commit/9e6ebf89c727e52290e83754ed89303557f6f69d))
* **rabbitmq:** improve error logging in EnsureChannel method for connection and channel failures :sparkles: ([266febc](https://github.com/LerianStudio/lib-commons/commit/266febc427996da526abc7e50c53675b8abe2f18))

## [2.3.0-beta.7](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.6...v2.3.0-beta.7) (2025-09-10)


### Features

* **transaction:** implement balanceKey support in operations :sparkles: ([38ac489](https://github.com/LerianStudio/lib-commons/commit/38ac489a64c11810bf406d7a2141b4aed3ca6746))

## [2.3.0-beta.6](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.5...v2.3.0-beta.6) (2025-08-21)


### Features

* some adjusts; ([60b206a](https://github.com/LerianStudio/lib-commons/commit/60b206a8bf1c8a299648a5df09aea76191dbea0c))


### Bug Fixes

* go.mod and go.sum; ([cda49e7](https://github.com/LerianStudio/lib-commons/commit/cda49e7e7d7a9b5da91155c43bdb9966826a7f4c))
* make lint ([ec9fc3a](https://github.com/LerianStudio/lib-commons/commit/ec9fc3ac4c39996b2e5ce308032f269380df32ee))
* **cursor:** resolve first page prev_cursor bug and infinite loop issues; ([b0f8861](https://github.com/LerianStudio/lib-commons/commit/b0f8861c22521b6ec742a365560a439e28b866c4))
* **cursor:** resolve pagination logic errors and add comprehensive UUID v7 tests ([2d48453](https://github.com/LerianStudio/lib-commons/commit/2d4845332e94b8225e781b267eec9f405519a7f6))

## [2.3.0-beta.5](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.4...v2.3.0-beta.5) (2025-08-20)

## [2.3.0-beta.4](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.3...v2.3.0-beta.4) (2025-08-20)


### Features

* add telemetry and logging to transaction validation and gRPC middleware ([0aabecc](https://github.com/LerianStudio/lib-commons/commit/0aabeccb0a7bb2f50dfc3cf9544cfe6b2dcddf91))

## [2.3.0-beta.3](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.2...v2.3.0-beta.3) (2025-08-19)


### Bug Fixes

* Adjusting instance when telemetry is off. ([68504a7](https://github.com/LerianStudio/lib-commons/commit/68504a7080ce4f437a9f551ae4c259ed7c0daaa6))

## [2.3.0-beta.2](https://github.com/LerianStudio/lib-commons/compare/v2.3.0-beta.1...v2.3.0-beta.2) (2025-08-18)


### Features

* Adding the crypto package of encryption and decryption. ([f309c23](https://github.com/LerianStudio/lib-commons/commit/f309c233404a56ca1bd3f27e7a9a28bd839fac37))
* Adding the crypto package of encryption and decryption. ([577b746](https://github.com/LerianStudio/lib-commons/commit/577b746c0dfad3dc863027bbe6f5508b194f7578))

## [2.3.0-beta.1](https://github.com/LerianStudio/lib-commons/compare/v2.2.0...v2.3.0-beta.1) (2025-08-18)


### Bug Fixes

* **otel:** reorder shutdown sequence to ensure proper telemetry export and add span attributes from request params id ([44fc4c9](https://github.com/LerianStudio/lib-commons/commit/44fc4c996e2f322244965bb31c79e069719a1e1f))
* **http:** use HasPrefix instead of Contains for route exclusion matching ([9891eac](https://github.com/LerianStudio/lib-commons/commit/9891eacbd75dfce11ba57ebf2a6f38144dc04505))

## [2.2.0](https://github.com/LerianStudio/lib-commons/compare/v2.1.0...v2.2.0) (2025-08-08)


### Features

* add new field transaction date to be used to make past transactions; ([fcb4704](https://github.com/LerianStudio/lib-commons/commit/fcb47044c5b11d0da0eb53a75fc31f26ae6f7fb6))
* add span events, UUID conversion and configurable log obfuscation ([d92bb13](https://github.com/LerianStudio/lib-commons/commit/d92bb13aabeb0b49b30a4ed9161182d73aab300f))
* merge pull request [#182](https://github.com/LerianStudio/lib-commons/issues/182) from LerianStudio/feat/COMMONS-1155 ([931fdcb](https://github.com/LerianStudio/lib-commons/commit/931fdcb9c5cdeabf1602108db813855162b8e655))


### Bug Fixes

* go get -u ./... && make tidy; ([a18914f](https://github.com/LerianStudio/lib-commons/commit/a18914fd032c639bf06732ccbd0c66eabd89753d))
* **otel:** add nil checks and remove unnecessary error handling in span methods ([3f9d468](https://github.com/LerianStudio/lib-commons/commit/3f9d46884dad366520eb1b95a5ee032a2992b959))

## [2.2.0-beta.4](https://github.com/LerianStudio/lib-commons/compare/v2.2.0-beta.3...v2.2.0-beta.4) (2025-08-08)

## [2.2.0-beta.3](https://github.com/LerianStudio/lib-commons/compare/v2.2.0-beta.2...v2.2.0-beta.3) (2025-08-08)

## [2.2.0-beta.2](https://github.com/LerianStudio/lib-commons/compare/v2.2.0-beta.1...v2.2.0-beta.2) (2025-08-08)


### Features

* add span events, UUID conversion and configurable log obfuscation ([d92bb13](https://github.com/LerianStudio/lib-commons/commit/d92bb13aabeb0b49b30a4ed9161182d73aab300f))


### Bug Fixes

* **otel:** add nil checks and remove unnecessary error handling in span methods ([3f9d468](https://github.com/LerianStudio/lib-commons/commit/3f9d46884dad366520eb1b95a5ee032a2992b959))

## [2.2.0-beta.1](https://github.com/LerianStudio/lib-commons/compare/v2.1.0...v2.2.0-beta.1) (2025-08-06)


### Features

* add new field transaction date to be used to make past transactions; ([fcb4704](https://github.com/LerianStudio/lib-commons/commit/fcb47044c5b11d0da0eb53a75fc31f26ae6f7fb6))
* merge pull request [#182](https://github.com/LerianStudio/lib-commons/issues/182) from LerianStudio/feat/COMMONS-1155 ([931fdcb](https://github.com/LerianStudio/lib-commons/commit/931fdcb9c5cdeabf1602108db813855162b8e655))


### Bug Fixes

* go get -u ./... && make tidy; ([a18914f](https://github.com/LerianStudio/lib-commons/commit/a18914fd032c639bf06732ccbd0c66eabd89753d))

## [2.1.0](https://github.com/LerianStudio/lib-commons/compare/v2.0.0...v2.1.0) (2025-08-01)


### Bug Fixes

* add UTF-8 sanitization for span attributes and error handling improvements ([e69dae8](https://github.com/LerianStudio/lib-commons/commit/e69dae8728c7c2ae669c96e102a811febc45de14))

## [2.1.0-beta.2](https://github.com/LerianStudio/lib-commons/compare/v2.1.0-beta.1...v2.1.0-beta.2) (2025-08-01)

## [2.1.0-beta.1](https://github.com/LerianStudio/lib-commons/compare/v2.0.0...v2.1.0-beta.1) (2025-08-01)


### Bug Fixes

* add UTF-8 sanitization for span attributes and error handling improvements ([e69dae8](https://github.com/LerianStudio/lib-commons/commit/e69dae8728c7c2ae669c96e102a811febc45de14))

## [2.0.0](https://github.com/LerianStudio/lib-commons/compare/v1.18.0...v2.0.0) (2025-07-30)


### ⚠ BREAKING CHANGES

* change version and paths to v2

### Features

* **security:** add accesstoken and refreshtoken to sensitive fields list ([9e884c7](https://github.com/LerianStudio/lib-commons/commit/9e884c784e686c15354196fa09526371570f01e1))
* **security:** add accesstoken and refreshtoken to sensitive fields ([ede9b9b](https://github.com/LerianStudio/lib-commons/commit/ede9b9ba17b7f98ffe53a927d42cfb7b0f867f29))
* **telemetry:** add metrics factory with fluent API for counter, gauge and histogram metrics ([517352b](https://github.com/LerianStudio/lib-commons/commit/517352b95111de59613d9b2f15429c751302b779))
* **telemetry:** add request ID to HTTP span attributes ([3c60b29](https://github.com/LerianStudio/lib-commons/commit/3c60b29f9432c012219f0c08b1403594ea54069b))
* **telemetry:** add telemetry queue propagation ([610c702](https://github.com/LerianStudio/lib-commons/commit/610c702c3f927d08bcd3f5279caf99b75127dfd8))
* adjust internal keys on redis to use generic one; ([c0e4556](https://github.com/LerianStudio/lib-commons/commit/c0e45566040c9da35043601b8128b3792c43cb61))
* create a new balance internal key to lock balance on redis; ([715e2e7](https://github.com/LerianStudio/lib-commons/commit/715e2e72b47c681064fd83dcef89c053c1d33d1c))
* extract logger separator constant and enhance telemetry span attributes ([2f611bb](https://github.com/LerianStudio/lib-commons/commit/2f611bb808f4fb68860b9745490a3ffdf8ba37a9))
* **security:** implement sensitive field obfuscation for telemetry and logging ([b98bd60](https://github.com/LerianStudio/lib-commons/commit/b98bd604259823c733711ef552d23fb347a86956))
* Merge pull request [#166](https://github.com/LerianStudio/lib-commons/issues/166) from LerianStudio/feat/add-new-redis-key ([3199765](https://github.com/LerianStudio/lib-commons/commit/3199765d6832d8a068f8e925773ea44acce5291e))
* Merge pull request [#168](https://github.com/LerianStudio/lib-commons/issues/168) from LerianStudio/feat/COMMONS-redis-balance-key ([2b66484](https://github.com/LerianStudio/lib-commons/commit/2b66484703bb7551fbe5264cc8f20618fe61bd5b))
* merge pull request [#176](https://github.com/LerianStudio/lib-commons/issues/176) from LerianStudio/develop ([69fd3fa](https://github.com/LerianStudio/lib-commons/commit/69fd3face5ada8718fe290ac951e89720c253980))


### Bug Fixes

* Add NormalizeDateTime helper for date offset and time bounds formatting ([838c5f1](https://github.com/LerianStudio/lib-commons/commit/838c5f1940fd06c109ba9480f30781553e80ff45))
* Merge pull request [#164](https://github.com/LerianStudio/lib-commons/issues/164) from LerianStudio/fix/COMMONS-1111 ([295ca40](https://github.com/LerianStudio/lib-commons/commit/295ca4093e919513bfcf7a0de50108c9e5609eb2))
* remove commets; ([333fe49](https://github.com/LerianStudio/lib-commons/commit/333fe499e1a8a43654cd6c0f0546e3a1c5279bc9))


### Code Refactoring

* update module to v2 ([1c20f97](https://github.com/LerianStudio/lib-commons/commit/1c20f97279dd7ab0c59e447b4e1ffc1595077deb))

## [2.0.0-beta.1](https://github.com/LerianStudio/lib-commons/compare/v1.19.0-beta.11...v2.0.0-beta.1) (2025-07-30)


### ⚠ BREAKING CHANGES

* change version and paths to v2

### Features

* **security:** add accesstoken and refreshtoken to sensitive fields list ([9e884c7](https://github.com/LerianStudio/lib-commons/commit/9e884c784e686c15354196fa09526371570f01e1))


### Code Refactoring

* update module to v2 ([1c20f97](https://github.com/LerianStudio/lib-commons/commit/1c20f97279dd7ab0c59e447b4e1ffc1595077deb))

## [1.19.0-beta.11](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.10...v1.19.0-beta.11) (2025-07-30)


### Features

* **telemetry:** add request ID to HTTP span attributes ([3c60b29](https://github.com/LerianStudio/lib-commons/v2/commit/3c60b29f9432c012219f0c08b1403594ea54069b))

## [1.19.0-beta.10](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.9...v1.19.0-beta.10) (2025-07-30)


### Features

* **security:** add accesstoken and refreshtoken to sensitive fields ([ede9b9b](https://github.com/LerianStudio/lib-commons/v2/commit/ede9b9ba17b7f98ffe53a927d42cfb7b0f867f29))

## [1.19.0-beta.9](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.8...v1.19.0-beta.9) (2025-07-30)

## [1.19.0-beta.8](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.7...v1.19.0-beta.8) (2025-07-29)

## [1.19.0-beta.7](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.6...v1.19.0-beta.7) (2025-07-29)


### Features

* extract logger separator constant and enhance telemetry span attributes ([2f611bb](https://github.com/LerianStudio/lib-commons/v2/commit/2f611bb808f4fb68860b9745490a3ffdf8ba37a9))

## [1.19.0-beta.6](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.5...v1.19.0-beta.6) (2025-07-28)


### Features

* **telemetry:** add metrics factory with fluent API for counter, gauge and histogram metrics ([517352b](https://github.com/LerianStudio/lib-commons/v2/commit/517352b95111de59613d9b2f15429c751302b779))

## [1.19.0-beta.5](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.4...v1.19.0-beta.5) (2025-07-28)


### Features

* adjust internal keys on redis to use generic one; ([c0e4556](https://github.com/LerianStudio/lib-commons/v2/commit/c0e45566040c9da35043601b8128b3792c43cb61))
* Merge pull request [#168](https://github.com/LerianStudio/lib-commons/v2/issues/168) from LerianStudio/feat/COMMONS-redis-balance-key ([2b66484](https://github.com/LerianStudio/lib-commons/v2/commit/2b66484703bb7551fbe5264cc8f20618fe61bd5b))

## [1.19.0-beta.4](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.3...v1.19.0-beta.4) (2025-07-28)


### Features

* create a new balance internal key to lock balance on redis; ([715e2e7](https://github.com/LerianStudio/lib-commons/v2/commit/715e2e72b47c681064fd83dcef89c053c1d33d1c))
* Merge pull request [#166](https://github.com/LerianStudio/lib-commons/v2/issues/166) from LerianStudio/feat/add-new-redis-key ([3199765](https://github.com/LerianStudio/lib-commons/v2/commit/3199765d6832d8a068f8e925773ea44acce5291e))

## [1.19.0-beta.3](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.2...v1.19.0-beta.3) (2025-07-25)


### Features

* **telemetry:** add telemetry queue propagation ([610c702](https://github.com/LerianStudio/lib-commons/v2/commit/610c702c3f927d08bcd3f5279caf99b75127dfd8))

## [1.19.0-beta.2](https://github.com/LerianStudio/lib-commons/v2/compare/v1.19.0-beta.1...v1.19.0-beta.2) (2025-07-25)


### Bug Fixes

* Add NormalizeDateTime helper for date offset and time bounds formatting ([838c5f1](https://github.com/LerianStudio/lib-commons/v2/commit/838c5f1940fd06c109ba9480f30781553e80ff45))
* Merge pull request [#164](https://github.com/LerianStudio/lib-commons/v2/issues/164) from LerianStudio/fix/COMMONS-1111 ([295ca40](https://github.com/LerianStudio/lib-commons/v2/commit/295ca4093e919513bfcf7a0de50108c9e5609eb2))
* remove commets; ([333fe49](https://github.com/LerianStudio/lib-commons/v2/commit/333fe499e1a8a43654cd6c0f0546e3a1c5279bc9))

## [1.19.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.18.0...v1.19.0-beta.1) (2025-07-23)


### Features

* **security:** implement sensitive field obfuscation for telemetry and logging ([b98bd60](https://github.com/LerianStudio/lib-commons/v2/commit/b98bd604259823c733711ef552d23fb347a86956))

## [1.18.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0...v1.18.0) (2025-07-22)


### Features

* Improve Redis client configuration with UniversalOptions and connection pool tuning ([1587047](https://github.com/LerianStudio/lib-commons/v2/commit/158704738d1c823af6fbf3bc37f97d9e9734ed8e))
* Merge pull request [#159](https://github.com/LerianStudio/lib-commons/v2/issues/159) from LerianStudio/feat/COMMONS-REDIS-RETRY ([e279ae9](https://github.com/LerianStudio/lib-commons/v2/commit/e279ae92be1464100e7f11c236afa9df408834cb))
* Merge pull request [#162](https://github.com/LerianStudio/lib-commons/v2/issues/162) from LerianStudio/develop ([f0778f0](https://github.com/LerianStudio/lib-commons/v2/commit/f0778f040d2e0ec776a5e7ca796578b1a01bd869))


### Bug Fixes

* add on const magic numbers; ([ff4d39b](https://github.com/LerianStudio/lib-commons/v2/commit/ff4d39b9ae209ce83827d5ba8b73f1e54692caad))
* add redis values default; ([7fe8252](https://github.com/LerianStudio/lib-commons/v2/commit/7fe8252291623f0c148155c60e33e48c7e2722ec))
* add variables default config; ([3c0b0a8](https://github.com/LerianStudio/lib-commons/v2/commit/3c0b0a8d5a07979ed668885d9799fb5c1c60aa3b))
* change default values to regular size; ([42ff053](https://github.com/LerianStudio/lib-commons/v2/commit/42ff053d9545be847d7f6033c6e3afd8f4fd4bf0))
* remove alias concat on operation route assignment :bug: ([ddf7530](https://github.com/LerianStudio/lib-commons/v2/commit/ddf7530692f9e1121b986b1c4d7cc27022b22f24))

## [1.18.0-beta.4](https://github.com/LerianStudio/lib-commons/v2/compare/v1.18.0-beta.3...v1.18.0-beta.4) (2025-07-22)


### Bug Fixes

* add redis values default; ([7fe8252](https://github.com/LerianStudio/lib-commons/v2/commit/7fe8252291623f0c148155c60e33e48c7e2722ec))

## [1.18.0-beta.3](https://github.com/LerianStudio/lib-commons/v2/compare/v1.18.0-beta.2...v1.18.0-beta.3) (2025-07-22)


### Bug Fixes

* add variables default config; ([3c0b0a8](https://github.com/LerianStudio/lib-commons/v2/commit/3c0b0a8d5a07979ed668885d9799fb5c1c60aa3b))
* change default values to regular size; ([42ff053](https://github.com/LerianStudio/lib-commons/v2/commit/42ff053d9545be847d7f6033c6e3afd8f4fd4bf0))

## [1.18.0-beta.2](https://github.com/LerianStudio/lib-commons/v2/compare/v1.18.0-beta.1...v1.18.0-beta.2) (2025-07-22)


### Features

* Improve Redis client configuration with UniversalOptions and connection pool tuning ([1587047](https://github.com/LerianStudio/lib-commons/v2/commit/158704738d1c823af6fbf3bc37f97d9e9734ed8e))
* Merge pull request [#159](https://github.com/LerianStudio/lib-commons/v2/issues/159) from LerianStudio/feat/COMMONS-REDIS-RETRY ([e279ae9](https://github.com/LerianStudio/lib-commons/v2/commit/e279ae92be1464100e7f11c236afa9df408834cb))


### Bug Fixes

* add on const magic numbers; ([ff4d39b](https://github.com/LerianStudio/lib-commons/v2/commit/ff4d39b9ae209ce83827d5ba8b73f1e54692caad))

## [1.18.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0...v1.18.0-beta.1) (2025-07-21)


### Bug Fixes

* remove alias concat on operation route assignment :bug: ([ddf7530](https://github.com/LerianStudio/lib-commons/v2/commit/ddf7530692f9e1121b986b1c4d7cc27022b22f24))

## [1.17.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.16.0...v1.17.0) (2025-07-17)


### Features

* **transaction:** add accounting routes to Responses struct :sparkles: ([5f36263](https://github.com/LerianStudio/lib-commons/v2/commit/5f36263e6036d5e993d17af7d846c10c9290e610))
* **utils:** add ExtractTokenFromHeader function to parse Authorization headers ([c91ea16](https://github.com/LerianStudio/lib-commons/v2/commit/c91ea16580bba21118a726c3ad0751752fe59e5b))
* **http:** add Fiber error handler with OpenTelemetry span management ([5c7deed](https://github.com/LerianStudio/lib-commons/v2/commit/5c7deed8216321edd0527b10bad220dde1492d2e))
* add gcp credentials to use passing by app like base64 string; ([326ff60](https://github.com/LerianStudio/lib-commons/v2/commit/326ff601e7eccbfd9aa7a31a54488cd68d8d2bbb))
* add new internal key generation functions for settings and accounting routes :sparkles: ([d328f29](https://github.com/LerianStudio/lib-commons/v2/commit/d328f29ef095c8ca2e3741744918da4761a1696f))
* add some refactors ([8cd3f91](https://github.com/LerianStudio/lib-commons/v2/commit/8cd3f915f3b136afe9d2365b36a3cc96934e1c52))
* add TTL support to Redis/Valkey and support cluster + sentinel modes alongside standalone ([1d825df](https://github.com/LerianStudio/lib-commons/v2/commit/1d825dfefbf574bfe3db0bc718b9d0876aec5e03))
* add variable tableAlias variadic to ApplyCursorPagination; ([1579a9e](https://github.com/LerianStudio/lib-commons/v2/commit/1579a9e25eae1da3247422ccd64e48730c59ba31))
* adjust to use only one host; ([22696b0](https://github.com/LerianStudio/lib-commons/v2/commit/22696b0f989eff5db22aeeff06d82df3b16230e4))
* change cacert to string to receive base64; ([a24f5f4](https://github.com/LerianStudio/lib-commons/v2/commit/a24f5f472686e39b44031e00fcc2b7989f1cf6b7))
* create a new const called x-idempotency-replayed; ([df9946c](https://github.com/LerianStudio/lib-commons/v2/commit/df9946c830586ed80577495cc653109b636b4575))
* **otel:** enhance trace context propagation with tracestate support for grpc ([f6f65ee](https://github.com/LerianStudio/lib-commons/v2/commit/f6f65eec7999c9bb4d6c14b2314c5c7e5d7f76ea))
* implements IAM refresh token; ([3d21e04](https://github.com/LerianStudio/lib-commons/v2/commit/3d21e04194a10710a1b9de46a3f3aba89804c8b8))
* Merge pull request [#118](https://github.com/LerianStudio/lib-commons/v2/issues/118) from LerianStudio/feat/COMMONS-52 ([e8f8917](https://github.com/LerianStudio/lib-commons/v2/commit/e8f8917b5c828c487f6bf2236b391dd4f8da5623))
* merge pull request [#120](https://github.com/LerianStudio/lib-commons/v2/issues/120) from LerianStudio/feat/COMMONS-52-2 ([4293e11](https://github.com/LerianStudio/lib-commons/v2/commit/4293e11ae36942afd7a376ab3ee3db3981922ebf))
* merge pull request [#124](https://github.com/LerianStudio/lib-commons/v2/issues/124) from LerianStudio/feat/COMMONS-52-6 ([8aaaf65](https://github.com/LerianStudio/lib-commons/v2/commit/8aaaf652e399746c67c0b8699c57f4a249271ef0))
* merge pull request [#127](https://github.com/LerianStudio/lib-commons/v2/issues/127) from LerianStudio/feat/COMMONS-52-9 ([12ee2a9](https://github.com/LerianStudio/lib-commons/v2/commit/12ee2a947d2fc38e8957b9b9f6e129b65e4b87a2))
* Merge pull request [#128](https://github.com/LerianStudio/lib-commons/v2/issues/128) from LerianStudio/feat/COMMONS-52-10 ([775f24a](https://github.com/LerianStudio/lib-commons/v2/commit/775f24ac85da8eb5e08a6e374ee61f327e798094))
* Merge pull request [#132](https://github.com/LerianStudio/lib-commons/v2/issues/132) from LerianStudio/feat/COMMOS-1023 ([e2cce46](https://github.com/LerianStudio/lib-commons/v2/commit/e2cce46b11ca9172f45769dae444de48e74e051f))
* Merge pull request [#152](https://github.com/LerianStudio/lib-commons/v2/issues/152) from LerianStudio/develop ([9e38ece](https://github.com/LerianStudio/lib-commons/v2/commit/9e38ece58cac8458cf3aed44bd2e210510424a61))
* merge pull request [#153](https://github.com/LerianStudio/lib-commons/v2/issues/153) from LerianStudio/feat/COMMONS-1055 ([1cc6cb5](https://github.com/LerianStudio/lib-commons/v2/commit/1cc6cb53c71515bd0c574ece0bb6335682aab953))
* Preallocate structures and isolate channels per goroutine for CalculateTotal ([8e92258](https://github.com/LerianStudio/lib-commons/v2/commit/8e922587f4b88f93434dfac5e16f0e570bef4a98))
* revert code that was on the main; ([c2f1772](https://github.com/LerianStudio/lib-commons/v2/commit/c2f17729bde8d2f5bbc36381173ad9226640d763))


### Bug Fixes

* .golangci.yml ([038bedd](https://github.com/LerianStudio/lib-commons/v2/commit/038beddbe9ed4a867f6ed93dd4e84480ed65bb1b))
* add fallback logging when logger is nil in shutdown handler ([800d644](https://github.com/LerianStudio/lib-commons/v2/commit/800d644d920bd54abf787d3be457cc0a1117c7a1))
* add new check channel is closed; ([e3956c4](https://github.com/LerianStudio/lib-commons/v2/commit/e3956c46eb8a87e637e035d7676d5c592001b509))
* adjust camel case time name; ([5ba77b9](https://github.com/LerianStudio/lib-commons/v2/commit/5ba77b958a0386a2ab9f8197503bbd4bd57235f0))
* adjust decimal values from remains and percentage; ([e1dc4b1](https://github.com/LerianStudio/lib-commons/v2/commit/e1dc4b183d0ca2d1247f727b81f8f27d4ddcc3c7))
* adjust redis key to use {} to calculate slot on cluster; ([318f269](https://github.com/LerianStudio/lib-commons/v2/commit/318f26947ee847aebfc600ed6e21cb903ee6a795))
* adjust some code and test; ([c6aca75](https://github.com/LerianStudio/lib-commons/v2/commit/c6aca756499e8b9875e1474e4f7949bb9cc9f60c))
* adjust to create tls on redis using variable; ([e78ae20](https://github.com/LerianStudio/lib-commons/v2/commit/e78ae2035b5583ce59654e3c7f145d93d86051e7))
* gitactions; ([7f9ebeb](https://github.com/LerianStudio/lib-commons/v2/commit/7f9ebeb1a9328a902e82c8c60428b2a8246793cf))
* go lint ([2499476](https://github.com/LerianStudio/lib-commons/v2/commit/249947604ed5d5382cd46e28e03c7396b9096d63))
* improve error handling and prevent deadlocks in server and license management ([24282ee](https://github.com/LerianStudio/lib-commons/v2/commit/24282ee9a411e0d5bf1977447a97e1e3fb260835))
* Merge pull request [#119](https://github.com/LerianStudio/lib-commons/v2/issues/119) from LerianStudio/feat/COMMONS-52 ([3ba9ca0](https://github.com/LerianStudio/lib-commons/v2/commit/3ba9ca0e284cf36797772967904d21947f8856a5))
* Merge pull request [#121](https://github.com/LerianStudio/lib-commons/v2/issues/121) from LerianStudio/feat/COMMONS-52-3 ([69c9e00](https://github.com/LerianStudio/lib-commons/v2/commit/69c9e002ab0a4fcd24622c79c5da7857eb22c922))
* Merge pull request [#122](https://github.com/LerianStudio/lib-commons/v2/issues/122) from LerianStudio/feat/COMMONS-52-4 ([46f5140](https://github.com/LerianStudio/lib-commons/v2/commit/46f51404f5f472172776abb1fbfd3bab908fc540))
* Merge pull request [#123](https://github.com/LerianStudio/lib-commons/v2/issues/123) from LerianStudio/fix/COMMONS-52-5 ([788915b](https://github.com/LerianStudio/lib-commons/v2/commit/788915b8c333156046e1d79860f80dc84f9aa08b))
* Merge pull request [#126](https://github.com/LerianStudio/lib-commons/v2/issues/126) from LerianStudio/fix-COMMONS-52-8 ([cfe9bbd](https://github.com/LerianStudio/lib-commons/v2/commit/cfe9bbde1bcf97847faf3fdc7e72e20ff723d586))
* rabbit hearthbeat and log type of client conn on redis/valkey; ([9607bf5](https://github.com/LerianStudio/lib-commons/v2/commit/9607bf5c0abf21603372d32ea8d66b5d34c77ec0))
* revert to original rabbit source; ([351c6ea](https://github.com/LerianStudio/lib-commons/v2/commit/351c6eac3e27301e4a65fce293032567bfd88807))
* **otel:** simplify resource creation to solve schema merging conflict ([318a38c](https://github.com/LerianStudio/lib-commons/v2/commit/318a38c07ca8c3bd6e2345c78302ad0c515d39a3))

## [1.17.0-beta.31](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.30...v1.17.0-beta.31) (2025-07-17)

## [1.17.0-beta.30](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.29...v1.17.0-beta.30) (2025-07-17)


### Bug Fixes

* improve error handling and prevent deadlocks in server and license management ([24282ee](https://github.com/LerianStudio/lib-commons/v2/commit/24282ee9a411e0d5bf1977447a97e1e3fb260835))

## [1.17.0-beta.29](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.28...v1.17.0-beta.29) (2025-07-16)


### Features

* merge pull request [#153](https://github.com/LerianStudio/lib-commons/v2/issues/153) from LerianStudio/feat/COMMONS-1055 ([1cc6cb5](https://github.com/LerianStudio/lib-commons/v2/commit/1cc6cb53c71515bd0c574ece0bb6335682aab953))
* Preallocate structures and isolate channels per goroutine for CalculateTotal ([8e92258](https://github.com/LerianStudio/lib-commons/v2/commit/8e922587f4b88f93434dfac5e16f0e570bef4a98))

## [1.17.0-beta.28](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.27...v1.17.0-beta.28) (2025-07-15)


### Features

* **http:** add Fiber error handler with OpenTelemetry span management ([5c7deed](https://github.com/LerianStudio/lib-commons/v2/commit/5c7deed8216321edd0527b10bad220dde1492d2e))

## [1.17.0-beta.27](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.26...v1.17.0-beta.27) (2025-07-15)

## [1.17.0-beta.26](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.25...v1.17.0-beta.26) (2025-07-15)

## [1.17.0-beta.25](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.24...v1.17.0-beta.25) (2025-07-11)


### Features

* **transaction:** add accounting routes to Responses struct :sparkles: ([5f36263](https://github.com/LerianStudio/lib-commons/v2/commit/5f36263e6036d5e993d17af7d846c10c9290e610))

## [1.17.0-beta.24](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.23...v1.17.0-beta.24) (2025-07-07)


### Bug Fixes

* **otel:** simplify resource creation to solve schema merging conflict ([318a38c](https://github.com/LerianStudio/lib-commons/v2/commit/318a38c07ca8c3bd6e2345c78302ad0c515d39a3))

## [1.17.0-beta.23](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.22...v1.17.0-beta.23) (2025-07-07)

## [1.17.0-beta.22](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.21...v1.17.0-beta.22) (2025-07-07)


### Features

* **otel:** enhance trace context propagation with tracestate support for grpc ([f6f65ee](https://github.com/LerianStudio/lib-commons/v2/commit/f6f65eec7999c9bb4d6c14b2314c5c7e5d7f76ea))

## [1.17.0-beta.21](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.20...v1.17.0-beta.21) (2025-07-02)


### Features

* **utils:** add ExtractTokenFromHeader function to parse Authorization headers ([c91ea16](https://github.com/LerianStudio/lib-commons/v2/commit/c91ea16580bba21118a726c3ad0751752fe59e5b))

## [1.17.0-beta.20](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.19...v1.17.0-beta.20) (2025-07-01)


### Features

* add new internal key generation functions for settings and accounting routes :sparkles: ([d328f29](https://github.com/LerianStudio/lib-commons/v2/commit/d328f29ef095c8ca2e3741744918da4761a1696f))

## [1.17.0-beta.19](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.18...v1.17.0-beta.19) (2025-06-30)


### Features

* create a new const called x-idempotency-replayed; ([df9946c](https://github.com/LerianStudio/lib-commons/v2/commit/df9946c830586ed80577495cc653109b636b4575))
* Merge pull request [#132](https://github.com/LerianStudio/lib-commons/v2/issues/132) from LerianStudio/feat/COMMOS-1023 ([e2cce46](https://github.com/LerianStudio/lib-commons/v2/commit/e2cce46b11ca9172f45769dae444de48e74e051f))

## [1.17.0-beta.18](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.17...v1.17.0-beta.18) (2025-06-27)

## [1.17.0-beta.17](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.16...v1.17.0-beta.17) (2025-06-27)

## [1.17.0-beta.16](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.15...v1.17.0-beta.16) (2025-06-26)


### Features

* add gcp credentials to use passing by app like base64 string; ([326ff60](https://github.com/LerianStudio/lib-commons/v2/commit/326ff601e7eccbfd9aa7a31a54488cd68d8d2bbb))

## [1.17.0-beta.15](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.14...v1.17.0-beta.15) (2025-06-25)


### Features

* add some refactors ([8cd3f91](https://github.com/LerianStudio/lib-commons/v2/commit/8cd3f915f3b136afe9d2365b36a3cc96934e1c52))
* Merge pull request [#128](https://github.com/LerianStudio/lib-commons/v2/issues/128) from LerianStudio/feat/COMMONS-52-10 ([775f24a](https://github.com/LerianStudio/lib-commons/v2/commit/775f24ac85da8eb5e08a6e374ee61f327e798094))

## [1.17.0-beta.14](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.13...v1.17.0-beta.14) (2025-06-25)


### Features

* change cacert to string to receive base64; ([a24f5f4](https://github.com/LerianStudio/lib-commons/v2/commit/a24f5f472686e39b44031e00fcc2b7989f1cf6b7))
* merge pull request [#127](https://github.com/LerianStudio/lib-commons/v2/issues/127) from LerianStudio/feat/COMMONS-52-9 ([12ee2a9](https://github.com/LerianStudio/lib-commons/v2/commit/12ee2a947d2fc38e8957b9b9f6e129b65e4b87a2))

## [1.17.0-beta.13](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.12...v1.17.0-beta.13) (2025-06-25)


### Bug Fixes

* Merge pull request [#126](https://github.com/LerianStudio/lib-commons/v2/issues/126) from LerianStudio/fix-COMMONS-52-8 ([cfe9bbd](https://github.com/LerianStudio/lib-commons/v2/commit/cfe9bbde1bcf97847faf3fdc7e72e20ff723d586))
* revert to original rabbit source; ([351c6ea](https://github.com/LerianStudio/lib-commons/v2/commit/351c6eac3e27301e4a65fce293032567bfd88807))

## [1.17.0-beta.12](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.11...v1.17.0-beta.12) (2025-06-25)


### Bug Fixes

* add new check channel is closed; ([e3956c4](https://github.com/LerianStudio/lib-commons/v2/commit/e3956c46eb8a87e637e035d7676d5c592001b509))

## [1.17.0-beta.11](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.10...v1.17.0-beta.11) (2025-06-25)


### Features

* merge pull request [#124](https://github.com/LerianStudio/lib-commons/v2/issues/124) from LerianStudio/feat/COMMONS-52-6 ([8aaaf65](https://github.com/LerianStudio/lib-commons/v2/commit/8aaaf652e399746c67c0b8699c57f4a249271ef0))


### Bug Fixes

* rabbit hearthbeat and log type of client conn on redis/valkey; ([9607bf5](https://github.com/LerianStudio/lib-commons/v2/commit/9607bf5c0abf21603372d32ea8d66b5d34c77ec0))

## [1.17.0-beta.10](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.9...v1.17.0-beta.10) (2025-06-24)


### Bug Fixes

* adjust camel case time name; ([5ba77b9](https://github.com/LerianStudio/lib-commons/v2/commit/5ba77b958a0386a2ab9f8197503bbd4bd57235f0))
* Merge pull request [#123](https://github.com/LerianStudio/lib-commons/v2/issues/123) from LerianStudio/fix/COMMONS-52-5 ([788915b](https://github.com/LerianStudio/lib-commons/v2/commit/788915b8c333156046e1d79860f80dc84f9aa08b))

## [1.17.0-beta.9](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.8...v1.17.0-beta.9) (2025-06-24)


### Bug Fixes

* adjust redis key to use {} to calculate slot on cluster; ([318f269](https://github.com/LerianStudio/lib-commons/v2/commit/318f26947ee847aebfc600ed6e21cb903ee6a795))
* Merge pull request [#122](https://github.com/LerianStudio/lib-commons/v2/issues/122) from LerianStudio/feat/COMMONS-52-4 ([46f5140](https://github.com/LerianStudio/lib-commons/v2/commit/46f51404f5f472172776abb1fbfd3bab908fc540))

## [1.17.0-beta.8](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.7...v1.17.0-beta.8) (2025-06-24)


### Features

* implements IAM refresh token; ([3d21e04](https://github.com/LerianStudio/lib-commons/v2/commit/3d21e04194a10710a1b9de46a3f3aba89804c8b8))


### Bug Fixes

* Merge pull request [#121](https://github.com/LerianStudio/lib-commons/v2/issues/121) from LerianStudio/feat/COMMONS-52-3 ([69c9e00](https://github.com/LerianStudio/lib-commons/v2/commit/69c9e002ab0a4fcd24622c79c5da7857eb22c922))

## [1.17.0-beta.7](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.6...v1.17.0-beta.7) (2025-06-24)


### Features

* merge pull request [#120](https://github.com/LerianStudio/lib-commons/v2/issues/120) from LerianStudio/feat/COMMONS-52-2 ([4293e11](https://github.com/LerianStudio/lib-commons/v2/commit/4293e11ae36942afd7a376ab3ee3db3981922ebf))


### Bug Fixes

* adjust to create tls on redis using variable; ([e78ae20](https://github.com/LerianStudio/lib-commons/v2/commit/e78ae2035b5583ce59654e3c7f145d93d86051e7))
* go lint ([2499476](https://github.com/LerianStudio/lib-commons/v2/commit/249947604ed5d5382cd46e28e03c7396b9096d63))

## [1.17.0-beta.6](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.5...v1.17.0-beta.6) (2025-06-23)


### Features

* adjust to use only one host; ([22696b0](https://github.com/LerianStudio/lib-commons/v2/commit/22696b0f989eff5db22aeeff06d82df3b16230e4))


### Bug Fixes

* Merge pull request [#119](https://github.com/LerianStudio/lib-commons/v2/issues/119) from LerianStudio/feat/COMMONS-52 ([3ba9ca0](https://github.com/LerianStudio/lib-commons/v2/commit/3ba9ca0e284cf36797772967904d21947f8856a5))

## [1.17.0-beta.5](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.4...v1.17.0-beta.5) (2025-06-23)


### Features

* add TTL support to Redis/Valkey and support cluster + sentinel modes alongside standalone ([1d825df](https://github.com/LerianStudio/lib-commons/v2/commit/1d825dfefbf574bfe3db0bc718b9d0876aec5e03))
* Merge pull request [#118](https://github.com/LerianStudio/lib-commons/v2/issues/118) from LerianStudio/feat/COMMONS-52 ([e8f8917](https://github.com/LerianStudio/lib-commons/v2/commit/e8f8917b5c828c487f6bf2236b391dd4f8da5623))


### Bug Fixes

* .golangci.yml ([038bedd](https://github.com/LerianStudio/lib-commons/v2/commit/038beddbe9ed4a867f6ed93dd4e84480ed65bb1b))
* gitactions; ([7f9ebeb](https://github.com/LerianStudio/lib-commons/v2/commit/7f9ebeb1a9328a902e82c8c60428b2a8246793cf))

## [1.17.0-beta.4](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.3...v1.17.0-beta.4) (2025-06-20)


### Bug Fixes

* adjust decimal values from remains and percentage; ([e1dc4b1](https://github.com/LerianStudio/lib-commons/v2/commit/e1dc4b183d0ca2d1247f727b81f8f27d4ddcc3c7))
* adjust some code and test; ([c6aca75](https://github.com/LerianStudio/lib-commons/v2/commit/c6aca756499e8b9875e1474e4f7949bb9cc9f60c))

## [1.17.0-beta.3](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.2...v1.17.0-beta.3) (2025-06-20)


### Bug Fixes

* add fallback logging when logger is nil in shutdown handler ([800d644](https://github.com/LerianStudio/lib-commons/v2/commit/800d644d920bd54abf787d3be457cc0a1117c7a1))

## [1.17.0-beta.2](https://github.com/LerianStudio/lib-commons/v2/compare/v1.17.0-beta.1...v1.17.0-beta.2) (2025-06-20)


### Features

* add variable tableAlias variadic to ApplyCursorPagination; ([1579a9e](https://github.com/LerianStudio/lib-commons/v2/commit/1579a9e25eae1da3247422ccd64e48730c59ba31))

## [1.17.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.16.0...v1.17.0-beta.1) (2025-06-16)


### Features

* revert code that was on the main; ([c2f1772](https://github.com/LerianStudio/lib-commons/v2/commit/c2f17729bde8d2f5bbc36381173ad9226640d763))

## [1.12.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.11.0...v1.12.0) (2025-06-13)


### Features

* add log test; ([7ad741f](https://github.com/LerianStudio/lib-commons/v2/commit/7ad741f558e7a725e95dab257500d5d24b2536e5))
* add shutdown test ([9d5fb77](https://github.com/LerianStudio/lib-commons/v2/commit/9d5fb77893e10a708136767eda3f9bac99363ba4))


### Bug Fixes

* Add integer overflow protection to transaction operations; :bug: ([32904de](https://github.com/LerianStudio/lib-commons/v2/commit/32904def9bee6388f12a6e2cc997c20a594db696))
* add url for health check to read. from envs; update testes; update go mod and go sum; ([e9b8333](https://github.com/LerianStudio/lib-commons/v2/commit/e9b83330834c7c2949dfb05a4dc46f4786cd509d))
* create redis test; ([3178547](https://github.com/LerianStudio/lib-commons/v2/commit/317854731e550d222713503eecbdf26e2c26fa90))

## [1.12.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.11.0...v1.12.0-beta.1) (2025-06-13)


### Features

* add log test; ([7ad741f](https://github.com/LerianStudio/lib-commons/v2/commit/7ad741f558e7a725e95dab257500d5d24b2536e5))
* add shutdown test ([9d5fb77](https://github.com/LerianStudio/lib-commons/v2/commit/9d5fb77893e10a708136767eda3f9bac99363ba4))


### Bug Fixes

* Add integer overflow protection to transaction operations; :bug: ([32904de](https://github.com/LerianStudio/lib-commons/v2/commit/32904def9bee6388f12a6e2cc997c20a594db696))
* add url for health check to read. from envs; update testes; update go mod and go sum; ([e9b8333](https://github.com/LerianStudio/lib-commons/v2/commit/e9b83330834c7c2949dfb05a4dc46f4786cd509d))
* create redis test; ([3178547](https://github.com/LerianStudio/lib-commons/v2/commit/317854731e550d222713503eecbdf26e2c26fa90))

## [1.12.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.11.0...v1.12.0) (2025-06-13)


### Features

* add log test; ([7ad741f](https://github.com/LerianStudio/lib-commons/v2/commit/7ad741f558e7a725e95dab257500d5d24b2536e5))


### Bug Fixes

* Add integer overflow protection to transaction operations; :bug: ([32904de](https://github.com/LerianStudio/lib-commons/v2/commit/32904def9bee6388f12a6e2cc997c20a594db696))
* add url for health check to read. from envs; update testes; update go mod and go sum; ([e9b8333](https://github.com/LerianStudio/lib-commons/v2/commit/e9b83330834c7c2949dfb05a4dc46f4786cd509d))
* create redis test; ([3178547](https://github.com/LerianStudio/lib-commons/v2/commit/317854731e550d222713503eecbdf26e2c26fa90))

## [1.12.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.11.0...v1.12.0-beta.1) (2025-06-13)


### Features

* add log test; ([7ad741f](https://github.com/LerianStudio/lib-commons/v2/commit/7ad741f558e7a725e95dab257500d5d24b2536e5))


### Bug Fixes

* Add integer overflow protection to transaction operations; :bug: ([32904de](https://github.com/LerianStudio/lib-commons/v2/commit/32904def9bee6388f12a6e2cc997c20a594db696))
* add url for health check to read. from envs; update testes; update go mod and go sum; ([e9b8333](https://github.com/LerianStudio/lib-commons/v2/commit/e9b83330834c7c2949dfb05a4dc46f4786cd509d))
* create redis test; ([3178547](https://github.com/LerianStudio/lib-commons/v2/commit/317854731e550d222713503eecbdf26e2c26fa90))

## [1.12.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.11.0...v1.12.0-beta.1) (2025-06-13)


### Bug Fixes

* Add integer overflow protection to transaction operations; :bug: ([32904de](https://github.com/LerianStudio/lib-commons/v2/commit/32904def9bee6388f12a6e2cc997c20a594db696))
* add url for health check to read. from envs; update testes; update go mod and go sum; ([e9b8333](https://github.com/LerianStudio/lib-commons/v2/commit/e9b83330834c7c2949dfb05a4dc46f4786cd509d))
* create redis test; ([3178547](https://github.com/LerianStudio/lib-commons/v2/commit/317854731e550d222713503eecbdf26e2c26fa90))

## [1.12.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.11.0...v1.12.0) (2025-06-13)


### Bug Fixes

* Add integer overflow protection to transaction operations; :bug: ([32904de](https://github.com/LerianStudio/lib-commons/v2/commit/32904def9bee6388f12a6e2cc997c20a594db696))
* add url for health check to read. from envs; update testes; update go mod and go sum; ([e9b8333](https://github.com/LerianStudio/lib-commons/v2/commit/e9b83330834c7c2949dfb05a4dc46f4786cd509d))

## [1.12.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.11.0...v1.12.0-beta.1) (2025-06-13)


### Bug Fixes

* Add integer overflow protection to transaction operations; :bug: ([32904de](https://github.com/LerianStudio/lib-commons/v2/commit/32904def9bee6388f12a6e2cc997c20a594db696))
* add url for health check to read. from envs; update testes; update go mod and go sum; ([e9b8333](https://github.com/LerianStudio/lib-commons/v2/commit/e9b83330834c7c2949dfb05a4dc46f4786cd509d))

## [1.11.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.10.0...v1.11.0) (2025-05-19)


### Features

* add info and debug log levels to zap logger initializer by env name ([c132299](https://github.com/LerianStudio/lib-commons/v2/commit/c13229910647081facf9f555e4b4efa74aff60ec))
* add start app with graceful shutdown module ([21d9697](https://github.com/LerianStudio/lib-commons/v2/commit/21d9697c35686e82adbf3f41744ce25c369119ce))
* bump lib-license-go version to v1.0.8 ([4d93834](https://github.com/LerianStudio/lib-commons/v2/commit/4d93834af0dd4d4d48564b98f9d2dc766369c1be))
* move license shutdown to the end of execution and add recover from panic in graceful shutdown ([6cf1171](https://github.com/LerianStudio/lib-commons/v2/commit/6cf117159cc10b3fa97200c53fbb6a058566c7d6))


### Bug Fixes

* fix lint - remove cuddled if blocks ([cd6424b](https://github.com/LerianStudio/lib-commons/v2/commit/cd6424b741811ec119a2bf35189760070883b993))
* import corret lib license go uri ([f55338f](https://github.com/LerianStudio/lib-commons/v2/commit/f55338fa2c9ed1d974ab61f28b1c70101b35eb61))

## [1.11.0-beta.2](https://github.com/LerianStudio/lib-commons/v2/compare/v1.11.0-beta.1...v1.11.0-beta.2) (2025-05-19)


### Features

* add start app with graceful shutdown module ([21d9697](https://github.com/LerianStudio/lib-commons/v2/commit/21d9697c35686e82adbf3f41744ce25c369119ce))
* bump lib-license-go version to v1.0.8 ([4d93834](https://github.com/LerianStudio/lib-commons/v2/commit/4d93834af0dd4d4d48564b98f9d2dc766369c1be))
* move license shutdown to the end of execution and add recover from panic in graceful shutdown ([6cf1171](https://github.com/LerianStudio/lib-commons/v2/commit/6cf117159cc10b3fa97200c53fbb6a058566c7d6))


### Bug Fixes

* fix lint - remove cuddled if blocks ([cd6424b](https://github.com/LerianStudio/lib-commons/v2/commit/cd6424b741811ec119a2bf35189760070883b993))
* import corret lib license go uri ([f55338f](https://github.com/LerianStudio/lib-commons/v2/commit/f55338fa2c9ed1d974ab61f28b1c70101b35eb61))

## [1.11.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.10.0...v1.11.0-beta.1) (2025-05-19)


### Features

* add info and debug log levels to zap logger initializer by env name ([c132299](https://github.com/LerianStudio/lib-commons/v2/commit/c13229910647081facf9f555e4b4efa74aff60ec))

## [1.10.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0...v1.10.0) (2025-05-14)


### Features

* **postgres:** sets migrations path from environment variable :sparkles: ([7f9d40e](https://github.com/LerianStudio/lib-commons/v2/commit/7f9d40e88a9e9b94a8d6076121e73324421bd6e8))

## [1.10.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0...v1.10.0-beta.1) (2025-05-14)


### Features

* **postgres:** sets migrations path from environment variable :sparkles: ([7f9d40e](https://github.com/LerianStudio/lib-commons/v2/commit/7f9d40e88a9e9b94a8d6076121e73324421bd6e8))

## [1.9.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.8.0...v1.9.0) (2025-05-14)


### Bug Fixes

* add check if account is empty using accountAlias; :bug: ([d2054d8](https://github.com/LerianStudio/lib-commons/v2/commit/d2054d8e0924accd15cfcac95ef1be6e58abae93))
* **transaction:** add index variable to loop iteration ([e2974f0](https://github.com/LerianStudio/lib-commons/v2/commit/e2974f0c2cc87f39417bf42943e143188c3f9fc8))
* final adjust to use multiple identical accounts; :bug: ([b2165de](https://github.com/LerianStudio/lib-commons/v2/commit/b2165de3642c9c9949cda25d370cad9358e5f5be))
* **transaction:** improve validation in send source and distribute calculations ([625f2f9](https://github.com/LerianStudio/lib-commons/v2/commit/625f2f9598a61dbb4227722f605e1d4798a9a881))
* **transaction:** improve validation in send source and distribute calculations ([2b05323](https://github.com/LerianStudio/lib-commons/v2/commit/2b05323b81eea70278dbb2326423dedaf5078373))
* **transaction:** improve validation in send source and distribute calculations ([4a8f3f5](https://github.com/LerianStudio/lib-commons/v2/commit/4a8f3f59da5563842e0785732ad5b05989f62fb7))
* **transaction:** improve validation in send source and distribute calculations ([1cf5b04](https://github.com/LerianStudio/lib-commons/v2/commit/1cf5b04fb510594c5d13989c137cc8401ea2e23d))
* **transaction:** optimize balance operations in UpdateBalances function ([524fe97](https://github.com/LerianStudio/lib-commons/v2/commit/524fe975d125742d10920236e055db879809b01e))
* **transaction:** optimize balance operations in UpdateBalances function ([63201dd](https://github.com/LerianStudio/lib-commons/v2/commit/63201ddeb00835d8b8b9269f8a32850e4f28374e))
* **transaction:** optimize balance operations in UpdateBalances function ([8b6397d](https://github.com/LerianStudio/lib-commons/v2/commit/8b6397df3261cc0f5af190c69b16a55e215952ed))
* some more adjusts; :bug: ([af69b44](https://github.com/LerianStudio/lib-commons/v2/commit/af69b447658b0f4dfcd2e2f252dd2d0d68753094))

## [1.9.0-beta.8](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0-beta.7...v1.9.0-beta.8) (2025-05-14)


### Bug Fixes

* final adjust to use multiple identical accounts; :bug: ([b2165de](https://github.com/LerianStudio/lib-commons/v2/commit/b2165de3642c9c9949cda25d370cad9358e5f5be))

## [1.9.0-beta.7](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0-beta.6...v1.9.0-beta.7) (2025-05-13)


### Bug Fixes

* add check if account is empty using accountAlias; :bug: ([d2054d8](https://github.com/LerianStudio/lib-commons/v2/commit/d2054d8e0924accd15cfcac95ef1be6e58abae93))
* some more adjusts; :bug: ([af69b44](https://github.com/LerianStudio/lib-commons/v2/commit/af69b447658b0f4dfcd2e2f252dd2d0d68753094))

## [1.9.0-beta.6](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0-beta.5...v1.9.0-beta.6) (2025-05-12)


### Bug Fixes

* **transaction:** optimize balance operations in UpdateBalances function ([524fe97](https://github.com/LerianStudio/lib-commons/v2/commit/524fe975d125742d10920236e055db879809b01e))
* **transaction:** optimize balance operations in UpdateBalances function ([63201dd](https://github.com/LerianStudio/lib-commons/v2/commit/63201ddeb00835d8b8b9269f8a32850e4f28374e))

## [1.9.0-beta.5](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0-beta.4...v1.9.0-beta.5) (2025-05-12)


### Bug Fixes

* **transaction:** optimize balance operations in UpdateBalances function ([8b6397d](https://github.com/LerianStudio/lib-commons/v2/commit/8b6397df3261cc0f5af190c69b16a55e215952ed))

## [1.9.0-beta.4](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0-beta.3...v1.9.0-beta.4) (2025-05-09)


### Bug Fixes

* **transaction:** add index variable to loop iteration ([e2974f0](https://github.com/LerianStudio/lib-commons/v2/commit/e2974f0c2cc87f39417bf42943e143188c3f9fc8))

## [1.9.0-beta.3](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0-beta.2...v1.9.0-beta.3) (2025-05-09)


### Bug Fixes

* **transaction:** improve validation in send source and distribute calculations ([625f2f9](https://github.com/LerianStudio/lib-commons/v2/commit/625f2f9598a61dbb4227722f605e1d4798a9a881))

## [1.9.0-beta.2](https://github.com/LerianStudio/lib-commons/v2/compare/v1.9.0-beta.1...v1.9.0-beta.2) (2025-05-09)


### Bug Fixes

* **transaction:** improve validation in send source and distribute calculations ([2b05323](https://github.com/LerianStudio/lib-commons/v2/commit/2b05323b81eea70278dbb2326423dedaf5078373))

## [1.9.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.8.0...v1.9.0-beta.1) (2025-05-09)


### Bug Fixes

* **transaction:** improve validation in send source and distribute calculations ([4a8f3f5](https://github.com/LerianStudio/lib-commons/v2/commit/4a8f3f59da5563842e0785732ad5b05989f62fb7))
* **transaction:** improve validation in send source and distribute calculations ([1cf5b04](https://github.com/LerianStudio/lib-commons/v2/commit/1cf5b04fb510594c5d13989c137cc8401ea2e23d))

## [1.8.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.7.0...v1.8.0) (2025-04-24)


### Features

* update go mod and go sum and change method health visibility; :sparkles: ([355991f](https://github.com/LerianStudio/lib-commons/v2/commit/355991f4416722ee51356139ed3c4fe08e1fe47e))

## [1.8.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.7.0...v1.8.0-beta.1) (2025-04-24)


### Features

* update go mod and go sum and change method health visibility; :sparkles: ([355991f](https://github.com/LerianStudio/lib-commons/v2/commit/355991f4416722ee51356139ed3c4fe08e1fe47e))

## [1.7.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.6.0...v1.7.0) (2025-04-16)


### Bug Fixes

* fix lint cuddled code ([dcbf7c6](https://github.com/LerianStudio/lib-commons/v2/commit/dcbf7c6f26f379cec9790e14b76ee2e6868fb142))
* lint complexity over 31 in getBodyObfuscatedString ([0f9eb4a](https://github.com/LerianStudio/lib-commons/v2/commit/0f9eb4a82a544204119500db09d38fd6ec003c7e))
* obfuscate password field in the body before logging ([e35bfa3](https://github.com/LerianStudio/lib-commons/v2/commit/e35bfa36424caae3f90b351ed979d2c6e6e143f5))

## [1.7.0-beta.3](https://github.com/LerianStudio/lib-commons/v2/compare/v1.7.0-beta.2...v1.7.0-beta.3) (2025-04-16)


### Bug Fixes

* lint complexity over 31 in getBodyObfuscatedString ([0f9eb4a](https://github.com/LerianStudio/lib-commons/v2/commit/0f9eb4a82a544204119500db09d38fd6ec003c7e))

## [1.7.0-beta.2](https://github.com/LerianStudio/lib-commons/v2/compare/v1.7.0-beta.1...v1.7.0-beta.2) (2025-04-16)

## [1.7.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.6.0...v1.7.0-beta.1) (2025-04-16)


### Bug Fixes

* fix lint cuddled code ([dcbf7c6](https://github.com/LerianStudio/lib-commons/v2/commit/dcbf7c6f26f379cec9790e14b76ee2e6868fb142))
* obfuscate password field in the body before logging ([e35bfa3](https://github.com/LerianStudio/lib-commons/v2/commit/e35bfa36424caae3f90b351ed979d2c6e6e143f5))

## [1.6.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.5.0...v1.6.0) (2025-04-11)


### Bug Fixes

* **transaction:** correct percentage calculation in CalculateTotal ([02b939c](https://github.com/LerianStudio/lib-commons/v2/commit/02b939c3abf1834de2078c2d0ae40b4fd9095bca))

## [1.6.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.5.0...v1.6.0-beta.1) (2025-04-11)


### Bug Fixes

* **transaction:** correct percentage calculation in CalculateTotal ([02b939c](https://github.com/LerianStudio/lib-commons/v2/commit/02b939c3abf1834de2078c2d0ae40b4fd9095bca))

## [1.5.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.4.0...v1.5.0) (2025-04-10)


### Features

* adding accountAlias field to keep backward compatibility ([81bf528](https://github.com/LerianStudio/lib-commons/v2/commit/81bf528dfa8ceb5055714589745c1d3987cfa6da))

## [1.5.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.4.0...v1.5.0-beta.1) (2025-04-09)


### Features

* adding accountAlias field to keep backward compatibility ([81bf528](https://github.com/LerianStudio/lib-commons/v2/commit/81bf528dfa8ceb5055714589745c1d3987cfa6da))

## [1.4.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.3.0...v1.4.0) (2025-04-08)

## [1.4.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.3.1-beta.1...v1.4.0-beta.1) (2025-04-08)

## [1.3.1-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.3.0...v1.3.1-beta.1) (2025-04-08)

## [1.3.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.2.0...v1.3.0) (2025-04-08)

## [1.3.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.2.0...v1.3.0-beta.1) (2025-04-08)

## [1.2.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.1.0...v1.2.0) (2025-04-03)


### Bug Fixes

* update safe uint convertion to convert int instead of int64 ([a85628b](https://github.com/LerianStudio/lib-commons/v2/commit/a85628bb031d64d542b378180c2254c198e9ae59))
* update safe uint convertion to convert max int to uint first to validate ([c7dee02](https://github.com/LerianStudio/lib-commons/v2/commit/c7dee026532f42712eabdb3fde0c8d2b8ec7cdd8))

## [1.2.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.1.0...v1.2.0-beta.1) (2025-04-03)


### Bug Fixes

* update safe uint convertion to convert int instead of int64 ([a85628b](https://github.com/LerianStudio/lib-commons/v2/commit/a85628bb031d64d542b378180c2254c198e9ae59))
* update safe uint convertion to convert max int to uint first to validate ([c7dee02](https://github.com/LerianStudio/lib-commons/v2/commit/c7dee026532f42712eabdb3fde0c8d2b8ec7cdd8))

## [1.1.0](https://github.com/LerianStudio/lib-commons/v2/compare/v1.0.0...v1.1.0) (2025-04-03)


### Features

* add safe uint convertion ([0d9e405](https://github.com/LerianStudio/lib-commons/v2/commit/0d9e4052ebbd70b18508d68906296c35b881d85e))
* organize golangci-lint module ([8d71f3b](https://github.com/LerianStudio/lib-commons/v2/commit/8d71f3bb2079457617a5ff8a8290492fd885b30d))


### Bug Fixes

* golang lint fixed version to v1.64.8; go mod and sum update packages; :bug: ([6b825c1](https://github.com/LerianStudio/lib-commons/v2/commit/6b825c1a0162326df2abb93b128419f2ea9a4175))

## [1.1.0-beta.3](https://github.com/LerianStudio/lib-commons/v2/compare/v1.1.0-beta.2...v1.1.0-beta.3) (2025-04-03)


### Features

* add safe uint convertion ([0d9e405](https://github.com/LerianStudio/lib-commons/v2/commit/0d9e4052ebbd70b18508d68906296c35b881d85e))

## [1.1.0-beta.2](https://github.com/LerianStudio/lib-commons/v2/compare/v1.1.0-beta.1...v1.1.0-beta.2) (2025-03-27)


### Features

* organize golangci-lint module ([8d71f3b](https://github.com/LerianStudio/lib-commons/v2/commit/8d71f3bb2079457617a5ff8a8290492fd885b30d))

## [1.1.0-beta.1](https://github.com/LerianStudio/lib-commons/v2/compare/v1.0.0...v1.1.0-beta.1) (2025-03-25)


### Bug Fixes

* golang lint fixed version to v1.64.8; go mod and sum update packages; :bug: ([6b825c1](https://github.com/LerianStudio/lib-commons/v2/commit/6b825c1a0162326df2abb93b128419f2ea9a4175))

## 1.0.0 (2025-03-19)


### Features

* add transaction validations to the lib-commons; :sparkles: ([098b730](https://github.com/LerianStudio/lib-commons/v2/commit/098b730fa1686b2f683faec69fabd6aa1607cf0b))
* initial commit to lib commons; ([7d49924](https://github.com/LerianStudio/lib-commons/v2/commit/7d4992494a1328fd1c0afc4f5814fa5c63cb0f9c))
* initiate new implements from lib-commons; ([18dff5c](https://github.com/LerianStudio/lib-commons/v2/commit/18dff5cbde19bd2659368ce5665a01f79119e7ef))


### Bug Fixes

* remove midaz reference; :bug: ([27cbdaa](https://github.com/LerianStudio/lib-commons/v2/commit/27cbdaa5ad103edf903fb24d2b652e7e9f15d909))
* remove wrong tests; :bug: ([9f9d30f](https://github.com/LerianStudio/lib-commons/v2/commit/9f9d30f0d783ab3f9f4f6e7141981e3b266ba600))
* update message withBasicAuth.go ([d1dcdbc](https://github.com/LerianStudio/lib-commons/v2/commit/d1dcdbc7dfd4ef829b94de19db71e273452be425))
* update some places and adjust golint; :bug: ([db18dbb](https://github.com/LerianStudio/lib-commons/v2/commit/db18dbb7270675e87c150f3216ac9be1b2610c1c))
* update to return err instead of nil; :bug: ([8aade18](https://github.com/LerianStudio/lib-commons/v2/commit/8aade18d65bf6fe0d4e925f3bf178c51672fd7f4))
* update to use one response json objetc; :bug: ([2e42859](https://github.com/LerianStudio/lib-commons/v2/commit/2e428598b1f41f9c2de369a34510c5ed2ba21569))

## [1.0.0-beta.2](https://github.com/LerianStudio/lib-commons/v2/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2025-03-19)


### Features

* add transaction validations to the lib-commons; :sparkles: ([098b730](https://github.com/LerianStudio/lib-commons/v2/commit/098b730fa1686b2f683faec69fabd6aa1607cf0b))


### Bug Fixes

* update some places and adjust golint; :bug: ([db18dbb](https://github.com/LerianStudio/lib-commons/v2/commit/db18dbb7270675e87c150f3216ac9be1b2610c1c))
* update to use one response json objetc; :bug: ([2e42859](https://github.com/LerianStudio/lib-commons/v2/commit/2e428598b1f41f9c2de369a34510c5ed2ba21569))

## 1.0.0-beta.1 (2025-03-18)


### Features

* initial commit to lib commons; ([7d49924](https://github.com/LerianStudio/lib-commons/v2/commit/7d4992494a1328fd1c0afc4f5814fa5c63cb0f9c))
* initiate new implements from lib-commons; ([18dff5c](https://github.com/LerianStudio/lib-commons/v2/commit/18dff5cbde19bd2659368ce5665a01f79119e7ef))


### Bug Fixes

* remove midaz reference; :bug: ([27cbdaa](https://github.com/LerianStudio/lib-commons/v2/commit/27cbdaa5ad103edf903fb24d2b652e7e9f15d909))
* remove wrong tests; :bug: ([9f9d30f](https://github.com/LerianStudio/lib-commons/v2/commit/9f9d30f0d783ab3f9f4f6e7141981e3b266ba600))
* update message withBasicAuth.go ([d1dcdbc](https://github.com/LerianStudio/lib-commons/v2/commit/d1dcdbc7dfd4ef829b94de19db71e273452be425))
* update to return err instead of nil; :bug: ([8aade18](https://github.com/LerianStudio/lib-commons/v2/commit/8aade18d65bf6fe0d4e925f3bf178c51672fd7f4))

## 1.0.0 (2025-03-06)


### Features

* configuration of CI/CD ([1bb1c4c](https://github.com/LerianStudio/lib-boilerplate/commit/1bb1c4ca0659e593ff22b3b5bf919163366301a7))
* set configuration of boilerplate ([138a60c](https://github.com/LerianStudio/lib-boilerplate/commit/138a60c7947a9e82e4808fa16cc53975e27e7de5))

## 1.0.0-beta.1 (2025-03-06)


### Features

* configuration of CI/CD ([1bb1c4c](https://github.com/LerianStudio/lib-boilerplate/commit/1bb1c4ca0659e593ff22b3b5bf919163366301a7))
* set configuration of boilerplate ([138a60c](https://github.com/LerianStudio/lib-boilerplate/commit/138a60c7947a9e82e4808fa16cc53975e27e7de5))
All notable changes to lib-commons will be documented in this file.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore versioned release notes instead of a placeholder-only changelog.

This change removes all historical/versioned entries, which is risky for a major v4 migration with breaking and behavioral changes. Please add concrete release sections (at least v4.0.0 and subsequent tags) with breaking changes, migration steps, and key fixes/features so consumers can safely upgrade.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CHANGELOG.md` around lines 1 - 3, Replace the placeholder CHANGELOG.md with
versioned release sections: add at minimum a v4.0.0 heading that lists "Breaking
Changes", "Migration Steps", and "Key Fixes/Features", then add subsequent
release headings (e.g., v4.0.1, v4.1.0) with short summaries; ensure the top of
the file keeps the existing "Changelog" heading and that each release section
includes concrete items (bullet or short-line entries) describing the behavior
changes and upgrade guidance so consumers can follow migration steps for the v4
migration.

Comment on lines +141 to +155
func (asserter *Asserter) NoError(ctx context.Context, err error, msg string, kv ...any) error {
if err == nil {
return nil
}

// Prepend error and error_type to key-value pairs for richer debugging
// errorKVPairs: 2 pairs added (error + error_type), each pair = 2 elements
const errorKVPairs = 4

kvWithError := make([]any, 0, len(kv)+errorKVPairs)
kvWithError = append(kvWithError, "error", err.Error())
kvWithError = append(kvWithError, "error_type", fmt.Sprintf("%T", err))
kvWithError = append(kvWithError, kv...)

return asserter.fail(ctx, "NoError", msg, kvWithError...)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cd /tmp && find . -type f -name "*.go" -path "*/commons/assert/*" 2>/dev/null | head -20

Repository: LerianStudio/lib-commons

Length of output: 50


🏁 Script executed:

git ls-files | grep -E "commons/assert.*\.go$"

Repository: LerianStudio/lib-commons

Length of output: 279


🏁 Script executed:

cat -n commons/assert/assert.go | sed -n '1,50p'

Repository: LerianStudio/lib-commons

Length of output: 1633


🏁 Script executed:

rg "func isNil" --type go

Repository: LerianStudio/lib-commons

Length of output: 624


🏁 Script executed:

cat -n commons/assert/assert.go | sed -n '141,155p'

Repository: LerianStudio/lib-commons

Length of output: 763


🏁 Script executed:

rg "func isNil\(v any\)" -A 10 commons/assert/assert.go

Repository: LerianStudio/lib-commons

Length of output: 314


🏁 Script executed:

cat -n commons/assert/assert.go | sed -n '1,100p' | tail -50

Repository: LerianStudio/lib-commons

Length of output: 1716


🏁 Script executed:

cat -n commons/assert/assert.go | head -300 | tail -150

Repository: LerianStudio/lib-commons

Length of output: 5654


🏁 Script executed:

rg "isNil\(" commons/assert/assert.go -B 2 -A 2

Repository: LerianStudio/lib-commons

Length of output: 375


🏁 Script executed:

cat -n commons/assert/assert.go | grep -A 15 "func (asserter \*Asserter)"

Repository: LerianStudio/lib-commons

Length of output: 4401


🏁 Script executed:

cat -n commons/assert/assert.go | grep -B 5 "func isNil"

Repository: LerianStudio/lib-commons

Length of output: 293


🏁 Script executed:

rg "NoError\(" commons/assert/assert_test.go -A 5 | head -40

Repository: LerianStudio/lib-commons

Length of output: 1492


Use isNil(err) instead of err == nil to handle typed-nil errors.

Line 142's direct nil check misses interface-wrapped nil pointers, allowing line 151 to call Error() on a nil receiver and panic. The isNil() function already handles this correctly (used in NotNil at line 111) and should be applied here for consistency.

Suggested fix
 func (asserter *Asserter) NoError(ctx context.Context, err error, msg string, kv ...any) error {
-	if err == nil {
+	if isNil(err) {
 		return nil
 	}
 
 	// Prepend error and error_type to key-value pairs for richer debugging
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func (asserter *Asserter) NoError(ctx context.Context, err error, msg string, kv ...any) error {
if err == nil {
return nil
}
// Prepend error and error_type to key-value pairs for richer debugging
// errorKVPairs: 2 pairs added (error + error_type), each pair = 2 elements
const errorKVPairs = 4
kvWithError := make([]any, 0, len(kv)+errorKVPairs)
kvWithError = append(kvWithError, "error", err.Error())
kvWithError = append(kvWithError, "error_type", fmt.Sprintf("%T", err))
kvWithError = append(kvWithError, kv...)
return asserter.fail(ctx, "NoError", msg, kvWithError...)
func (asserter *Asserter) NoError(ctx context.Context, err error, msg string, kv ...any) error {
if isNil(err) {
return nil
}
// Prepend error and error_type to key-value pairs for richer debugging
// errorKVPairs: 2 pairs added (error + error_type), each pair = 2 elements
const errorKVPairs = 4
kvWithError := make([]any, 0, len(kv)+errorKVPairs)
kvWithError = append(kvWithError, "error", err.Error())
kvWithError = append(kvWithError, "error_type", fmt.Sprintf("%T", err))
kvWithError = append(kvWithError, kv...)
return asserter.fail(ctx, "NoError", msg, kvWithError...)
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commons/assert/assert.go` around lines 141 - 155, In Asserter.NoError,
replace the direct nil check (err == nil) with a call to isNil(err) so
interface-wrapped nils are detected and NoError returns nil; do this before any
use of err so you never call err.Error() on a typed-nil. Update the early-return
condition to use isNil(err) and leave the rest of the function (building
kvWithError, using err.Error(), and calling asserter.fail) unchanged so behavior
matches NotNil and avoids panics.

Comment on lines +202 to +207
if len(stack) > 0 && logger != nil {
logger.Log(context.Background(), log.LevelError, "assertion stack trace",
log.String("assertion_type", assertion),
log.String("stack_trace", string(stack)),
)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Keep the stderr fallback as informative as the structured logger path.

When logger == nil, Line 315 prints only msg, and Lines 202-207 drop the stack entirely. In goroutine + Halt flows this can be the only surviving diagnostic output, so the stderr path should emit the existing details string and stack too.

Suggested fix
-	if len(stack) > 0 && logger != nil {
-		logger.Log(context.Background(), log.LevelError, "assertion stack trace",
-			log.String("assertion_type", assertion),
-			log.String("stack_trace", string(stack)),
-		)
+	if len(stack) > 0 {
+		if logger != nil {
+			logger.Log(context.Background(), log.LevelError, "assertion stack trace",
+				log.String("assertion_type", assertion),
+				log.String("stack_trace", string(stack)),
+			)
+		} else {
+			fmt.Fprintln(os.Stderr, "ASSERTION STACK TRACE:")
+			fmt.Fprintln(os.Stderr, string(stack))
+		}
 	}
@@
 	if logger == nil {
-		// Fall back to stderr for emergency visibility
-		fmt.Fprintln(os.Stderr, "ASSERTION FAILED: "+msg)
+		formatted := "ASSERTION FAILED: " + msg
+		if details != "" {
+			formatted += "\n" + details
+		}
+		fmt.Fprintln(os.Stderr, formatted)
 
 		return
 	}
Based on learnings, assertion key-value context should stay collapsed into the opaque `details` string.

Also applies to: 312-318

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commons/assert/assert.go` around lines 202 - 207, When logger == nil the
stderr fallback currently only prints msg and drops the assertion context/stack;
update the stderr path to mirror the structured-logger output by emitting the
collapsed details string and the stack trace as well (i.e., print details and
string(stack) alongside msg), while preserving the existing behavior when logger
!= nil; apply the same change to the other fallback block that handles
msg/details/stack (the second occurrence around the Halt/goroutine flow) so both
non-logger paths include details and stack for diagnostics.

Comment on lines +17 to +37
func BenchmarkThat_True(b *testing.B) {
asserter := New(context.Background(), nil, "", "")
for i := 0; i < b.N; i++ {
_ = asserter.That(context.Background(), true, "benchmark test")
}
}

func BenchmarkThat_TrueWithContext(b *testing.B) {
asserter := New(context.Background(), nil, "", "")
for i := 0; i < b.N; i++ {
_ = asserter.That(
context.Background(),
true,
"benchmark test",
"key1",
"value1",
"key2",
42,
)
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Hoist context.Background() out of tight benchmark loops.

This keeps measurements focused on assertion/predicate cost rather than repeated setup calls.

📉 Benchmark noise reduction pattern
 func BenchmarkThat_True(b *testing.B) {
+ ctx := context.Background()
- asserter := New(context.Background(), nil, "", "")
+ asserter := New(ctx, nil, "", "")
   for i := 0; i < b.N; i++ {
-    _ = asserter.That(context.Background(), true, "benchmark test")
+    _ = asserter.That(ctx, true, "benchmark test")
   }
 }

Apply the same pattern to the other asserter.* benchmark loops.

Also applies to: 44-46, 65-67, 72-74, 148-156

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commons/assert/benchmark_test.go` around lines 17 - 37, Benchmarks like
BenchmarkThat_True and BenchmarkThat_TrueWithContext repeatedly call
context.Background() inside tight loops, adding noise; hoist a single ctx :=
context.Background() (or separate ctxs where different contexts are used)
outside each b.N loop and pass that ctx into asserter.That (and similarly for
other benchmark helpers referenced around lines 44-46, 65-67, 72-74, 148-156) so
the timed section measures only the assertion/predicate work rather than context
allocation.

Comment on lines +216 to +217
{"one second future invalid", now.Add(time.Second), false},
{"one hour future invalid", now.Add(time.Hour), false},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use a wider future offset to prevent timing flakes.

The one-second future case is brittle in parallel CI; it can become “not future” before evaluation.

🧪 Stable test tweak
- {"one second future invalid", now.Add(time.Second), false},
+ {"one minute future invalid", now.Add(time.Minute), false},
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{"one second future invalid", now.Add(time.Second), false},
{"one hour future invalid", now.Add(time.Hour), false},
{"one minute future invalid", now.Add(time.Minute), false},
{"one hour future invalid", now.Add(time.Hour), false},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@commons/assert/predicates_test.go` around lines 216 - 217, The test case
entries in predicates_test.go that use now.Add(time.Second) (the "one second
future invalid" case in the test table) are flaky in CI; update that entry to
use a wider offset (e.g., time.Minute or time.Hour) so the value remains in the
future during evaluation—locate the table of test cases in predicates_test.go
and replace time.Second with a larger duration for the future-case rows (e.g.,
change now.Add(time.Second) to now.Add(time.Minute)).

Comment on lines +77 to +79
GOTESTSUM_VERSION ?= v1.12.0
GOSEC_VERSION ?= v2.22.4
GOLANGCI_LINT_VERSION ?= v2.1.6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Version mismatch: golangci-lint in Makefile vs workflow.

GOLANGCI_LINT_VERSION is pinned to v2.1.6 here, but the workflow (.github/workflows/go-combined-analysis.yml) uses v2.11.2. This mismatch could cause different linting behavior locally vs CI.

🔧 Proposed fix to align versions
-GOLANGCI_LINT_VERSION ?= v2.1.6
+GOLANGCI_LINT_VERSION ?= v2.11.2
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GOTESTSUM_VERSION ?= v1.12.0
GOSEC_VERSION ?= v2.22.4
GOLANGCI_LINT_VERSION ?= v2.1.6
GOTESTSUM_VERSION ?= v1.12.0
GOSEC_VERSION ?= v2.22.4
GOLANGCI_LINT_VERSION ?= v2.11.2
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 77 - 79, The Makefile's GOLANGCI_LINT_VERSION variable
is misaligned with the CI workflow; update the GOLANGCI_LINT_VERSION definition
(symbol: GOLANGCI_LINT_VERSION) to match the version used in the workflow
(v2.11.2) so local and CI linting use the same golangci-lint release, and ensure
any related references (e.g., in targets that consume GOLANGCI_LINT_VERSION)
continue to work with the updated value.


TEST_REPORTS_DIR ?= ./reports
GOTESTSUM = $(shell command -v gotestsum 2>/dev/null)
RETRY_ON_FAIL ?= 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider documenting RETRY_ON_FAIL usage carefully.

The retry mechanism can mask flaky tests. Ensure this is used intentionally (e.g., for transient container startup issues in integration tests) rather than to hide genuine test failures.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` at line 83, Add clear inline documentation and usage guidance for
the RETRY_ON_FAIL Makefile variable: update the Makefile near the RETRY_ON_FAIL
definition to include a comment describing its purpose, allowed values, and
recommended use cases (only for transient infra issues like container startup in
integration tests), and add a short note in the project README or CONTRIBUTING
that warns that enabling RETRY_ON_FAIL can mask flaky tests and should be used
sparingly with examples of acceptable use (e.g., retry count 1-3 for CI jobs
that depend on non-deterministic external services). Ensure references to
RETRY_ON_FAIL appear alongside any test or CI targets that honor it (search for
its usage in test targets) and clarify the default value and how to override it
in CI pipelines.

### HTTP and server utilities

- `commons/net/http`: Fiber HTTP helpers -- response (`Respond`/`RespondStatus`/`RespondError`/`RenderError`), health (`Ping`/`HealthWithDependencies`), SSRF-protected reverse proxy (`ServeReverseProxy` with `ReverseProxyPolicy`), pagination (offset/opaque cursor/timestamp cursor/sort cursor), validation (`ParseBodyAndValidate`/`ValidateStruct`/`ValidateSortDirection`/`ValidateLimit`), context/ownership (`ParseAndVerifyTenantScopedID`/`ParseAndVerifyResourceScopedID`), middleware (`WithHTTPLogging`/`WithGrpcLogging`/`WithCORS`/`WithBasicAuth`/`NewTelemetryMiddleware`), `FiberErrorHandler`
- `commons/net/http/ratelimit`: Redis-backed distributed rate limiting middleware for Fiber — `New(conn, opts...)` returns a `*RateLimiter` (nil when disabled, nil-safe for pass-through), `WithDefaultRateLimit(conn, opts...)` as a one-liner that wires `New` + `DefaultTier` into a ready-to-use `fiber.Handler`, fixed-window counter via atomic Lua script (INCR + PEXPIRE), `WithRateLimit(tier)` for static tiers, `WithDynamicRateLimit(TierFunc)` for per-request tier selection, `MethodTierSelector` for write-vs-read split, preset tiers (`DefaultTier` / `AggressiveTier` / `RelaxedTier`) configurable via env vars, identity extractors (`IdentityFromIP` / `IdentityFromHeader` / `IdentityFromIPAndHeader` — uses `#` separator to avoid conflict with IPv6 colons), fail-open/fail-closed policy, `WithOnLimited` callback, and standard `X-RateLimit-*` / `Retry-After` headers; also exports `RedisStorage` (`NewRedisStorage`) for use with third-party Fiber middleware
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use hyphenation for the compound adjective on this line.
For readability/grammar consistency, prefer “Redis-backed distributed rate-limiting middleware”.

✏️ Suggested doc tweak
-- `commons/net/http/ratelimit`: Redis-backed distributed rate limiting middleware for Fiber — `New(conn, opts...)` returns a `*RateLimiter` (nil when disabled, nil-safe for pass-through), `WithDefaultRateLimit(conn, opts...)` as a one-liner that wires `New` + `DefaultTier` into a ready-to-use `fiber.Handler`, fixed-window counter via atomic Lua script (INCR + PEXPIRE), `WithRateLimit(tier)` for static tiers, `WithDynamicRateLimit(TierFunc)` for per-request tier selection, `MethodTierSelector` for write-vs-read split, preset tiers (`DefaultTier` / `AggressiveTier` / `RelaxedTier`) configurable via env vars, identity extractors (`IdentityFromIP` / `IdentityFromHeader` / `IdentityFromIPAndHeader` — uses `#` separator to avoid conflict with IPv6 colons), fail-open/fail-closed policy, `WithOnLimited` callback, and standard `X-RateLimit-*` / `Retry-After` headers; also exports `RedisStorage` (`NewRedisStorage`) for use with third-party Fiber middleware
+- `commons/net/http/ratelimit`: Redis-backed distributed rate-limiting middleware for Fiber — `New(conn, opts...)` returns a `*RateLimiter` (nil when disabled, nil-safe for pass-through), `WithDefaultRateLimit(conn, opts...)` as a one-liner that wires `New` + `DefaultTier` into a ready-to-use `fiber.Handler`, fixed-window counter via atomic Lua script (INCR + PEXPIRE), `WithRateLimit(tier)` for static tiers, `WithDynamicRateLimit(TierFunc)` for per-request tier selection, `MethodTierSelector` for write-vs-read split, preset tiers (`DefaultTier` / `AggressiveTier` / `RelaxedTier`) configurable via env vars, identity extractors (`IdentityFromIP` / `IdentityFromHeader` / `IdentityFromIPAndHeader` — uses `#` separator to avoid conflict with IPv6 colons), fail-open/fail-closed policy, `WithOnLimited` callback, and standard `X-RateLimit-*` / `Retry-After` headers; also exports `RedisStorage` (`NewRedisStorage`) for use with third-party Fiber middleware
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- `commons/net/http/ratelimit`: Redis-backed distributed rate limiting middleware for Fiber — `New(conn, opts...)` returns a `*RateLimiter` (nil when disabled, nil-safe for pass-through), `WithDefaultRateLimit(conn, opts...)` as a one-liner that wires `New` + `DefaultTier` into a ready-to-use `fiber.Handler`, fixed-window counter via atomic Lua script (INCR + PEXPIRE), `WithRateLimit(tier)` for static tiers, `WithDynamicRateLimit(TierFunc)` for per-request tier selection, `MethodTierSelector` for write-vs-read split, preset tiers (`DefaultTier` / `AggressiveTier` / `RelaxedTier`) configurable via env vars, identity extractors (`IdentityFromIP` / `IdentityFromHeader` / `IdentityFromIPAndHeader` — uses `#` separator to avoid conflict with IPv6 colons), fail-open/fail-closed policy, `WithOnLimited` callback, and standard `X-RateLimit-*` / `Retry-After` headers; also exports `RedisStorage` (`NewRedisStorage`) for use with third-party Fiber middleware
- `commons/net/http/ratelimit`: Redis-backed distributed rate-limiting middleware for Fiber — `New(conn, opts...)` returns a `*RateLimiter` (nil when disabled, nil-safe for pass-through), `WithDefaultRateLimit(conn, opts...)` as a one-liner that wires `New` + `DefaultTier` into a ready-to-use `fiber.Handler`, fixed-window counter via atomic Lua script (INCR + PEXPIRE), `WithRateLimit(tier)` for static tiers, `WithDynamicRateLimit(TierFunc)` for per-request tier selection, `MethodTierSelector` for write-vs-read split, preset tiers (`DefaultTier` / `AggressiveTier` / `RelaxedTier`) configurable via env vars, identity extractors (`IdentityFromIP` / `IdentityFromHeader` / `IdentityFromIPAndHeader` — uses `#` separator to avoid conflict with IPv6 colons), fail-open/fail-closed policy, `WithOnLimited` callback, and standard `X-RateLimit-*` / `Retry-After` headers; also exports `RedisStorage` (`NewRedisStorage`) for use with third-party Fiber middleware
🧰 Tools
🪛 LanguageTool

[uncategorized] ~54-~54: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...tp/ratelimit: Redis-backed distributed rate limiting middleware for Fiber — New(conn, opts....

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 54, Update the README line describing the package (the
paragraph that starts with "commons/net/http/ratelimit") to hyphenate the
compound adjective: change "Redis-backed distributed rate limiting middleware"
to "Redis-backed distributed rate-limiting middleware"; keep the rest of the
sentence intact (the list of symbols like New, WithDefaultRateLimit,
WithRateLimit, WithDynamicRateLimit, MethodTierSelector,
DefaultTier/AggressiveTier/RelaxedTier,
IdentityFromIP/IdentityFromHeader/IdentityFromIPAndHeader, WithOnLimited,
RedisStorage/NewRedisStorage should remain unchanged).

@@ -0,0 +1,388 @@
# Review Findings

Generated from 54 reviewer-agent runs (6 reviewers x 9 slices). Empty severity buckets are omitted. Similar findings are intentionally preserved when multiple reviewer lenses surfaced them independently.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Make this report actionable instead of intentionally duplicative.

Keeping duplicate findings “intentionally preserved” creates triage noise and slows remediation. Please deduplicate by canonical key (file + symbol + root-cause) and keep one entry with occurrence count.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@REVIEW.md` at line 3, The report currently preserves intentionally duplicated
findings; update the generation step that produces the "Generated from 54
reviewer-agent runs..." section to deduplicate entries by a canonical key
composed of file path + symbol (e.g., function/class/line identifier) +
root-cause, collapsing duplicates into a single entry and adding an
occurrence_count field for how many times it appeared; locate the report
assembly logic that emits the findings list (the code that produces the
"Generated from ..." block in REVIEW.md) and change it to build a map keyed by
(file, symbol, root-cause), emit one canonical entry per key with
occurrence_count, and omit the original duplicate entries.

Comment on lines +8 to +388
- [nil-safety] `references/lib-commons/commons/opentelemetry/metrics/metrics.go:105`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:119`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:133`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:179`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:214`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:251`, `references/lib-commons/commons/opentelemetry/metrics/account.go:10`, `references/lib-commons/commons/opentelemetry/metrics/transaction.go:10`, `references/lib-commons/commons/opentelemetry/metrics/operation_routes.go:10`, `references/lib-commons/commons/opentelemetry/metrics/transaction_routes.go:10`, `references/lib-commons/commons/opentelemetry/metrics/system.go:25`, `references/lib-commons/commons/opentelemetry/metrics/system.go:35` - exported `*MetricsFactory` methods are not nil-safe and can panic on nil receivers.
- [nil-safety] `references/lib-commons/commons/opentelemetry/metrics/builders.go:29`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:47`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:63`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:74`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:87`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:105`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:125`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:144`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:162`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:178` - nil builder receivers panic before the intended `ErrNil*` guard can run.

### High
- [code] `references/lib-commons/commons/opentelemetry/otel.go:134`, `references/lib-commons/commons/opentelemetry/otel.go:139`, `references/lib-commons/commons/opentelemetry/otel.go:144`, `references/lib-commons/commons/opentelemetry/otel.go:153` - `NewTelemetry` allocates exporters/providers incrementally but does not roll back already-created resources if a later step fails.
- [code] `references/lib-commons/commons/opentelemetry/metrics/metrics.go:180`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:191`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:215`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:226` - counter and gauge caching is keyed only by metric name, so later callers can silently get the wrong description/unit metadata.
- [business] `references/lib-commons/commons/opentelemetry/obfuscation.go:122`, `references/lib-commons/commons/opentelemetry/obfuscation.go:125`, `references/lib-commons/commons/opentelemetry/obfuscation.go:128`, `references/lib-commons/commons/opentelemetry/obfuscation.go:132` - `PathPattern`-only redaction rules are not truly path-only; if `FieldPattern` is empty, matching falls back to `security.IsSensitiveField`, so custom path-scoped rules for non-default-sensitive keys silently do not apply.
- [business] `references/lib-commons/commons/opentelemetry/metrics/builders.go:63`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:68` - `CounterBuilder.Add` accepts negative values, violating monotonic counter semantics.
- [business] `references/lib-commons/commons/opentelemetry/metrics/metrics.go:162`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:163`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:164`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:169`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:170` - default histogram bucket selection prioritizes `transaction` over `latency`/`duration`/`time`, so names like `transaction.processing.latency` get the wrong bucket strategy.
- [security] `references/lib-commons/commons/opentelemetry/otel.go:366`, `references/lib-commons/commons/opentelemetry/otel.go:384`, `references/lib-commons/commons/opentelemetry/otel.go:385` - unsanitized `err.Error()` content and `span.RecordError(err)` are exported directly into spans, bypassing redaction.
- [test] `references/lib-commons/commons/opentelemetry/obfuscation_test.go:979`, `references/lib-commons/commons/opentelemetry/obfuscation_test.go:986` - `TestObfuscateStruct_FieldWithDotsInKey` has no real assertion.
- [test] `references/lib-commons/commons/opentelemetry/otel_test.go:927`, `references/lib-commons/commons/opentelemetry/otel_test.go:938` - processor tests start spans but never inspect exported attributes, so the behaviors they claim to test are not actually validated.
- [test] `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1088`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1118`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1146`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1175`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1179`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1209`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1213`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1235`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1239`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1265`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1270`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1275` - several concurrency tests silently discard returned errors or return early on failure.
- [nil-safety] `references/lib-commons/commons/opentelemetry/otel.go:172`, `references/lib-commons/commons/opentelemetry/otel.go:181`, `references/lib-commons/commons/opentelemetry/otel.go:182`, `references/lib-commons/commons/opentelemetry/otel.go:183`, `references/lib-commons/commons/opentelemetry/otel.go:184` - `ApplyGlobals` only rejects a nil `Telemetry` pointer, not a zero-value or partially initialized `Telemetry`, so it can poison global OTEL state.
- [nil-safety] `references/lib-commons/commons/opentelemetry/otel.go:362`, `references/lib-commons/commons/opentelemetry/otel.go:366`, `references/lib-commons/commons/opentelemetry/otel.go:371`, `references/lib-commons/commons/opentelemetry/otel.go:375`, `references/lib-commons/commons/opentelemetry/otel.go:380`, `references/lib-commons/commons/opentelemetry/otel.go:384`, `references/lib-commons/commons/opentelemetry/otel.go:385`, `references/lib-commons/commons/opentelemetry/otel.go:390`, `references/lib-commons/commons/opentelemetry/otel.go:400` - span helpers use `span == nil` on an interface and can still panic on typed-nil spans.
- [consequences] `references/lib-commons/commons/opentelemetry/otel.go:172`, `references/lib-commons/commons/opentelemetry/otel.go:184`, `references/lib-commons/commons/opentelemetry/otel.go:498`, `references/lib-commons/commons/opentelemetry/otel.go:507` - propagation helpers are hard-wired to the global propagator, so `TelemetryConfig.Propagator` only takes effect if callers also mutate globals.
- [consequences] `references/lib-commons/commons/opentelemetry/otel.go:639`, `references/lib-commons/commons/opentelemetry/otel.go:646`, `references/lib-commons/commons/opentelemetry/otel.go:647` - `ExtractTraceContextFromQueueHeaders` only accepts string values and drops valid upstream headers represented as `[]byte` or typed AMQP values.
- [consequences] `references/lib-commons/commons/opentelemetry/obfuscation.go:59`, `references/lib-commons/commons/opentelemetry/obfuscation.go:64`, `references/lib-commons/commons/opentelemetry/obfuscation.go:104`, `references/lib-commons/commons/opentelemetry/otel.go:92` - if default redactor construction fails, `NewDefaultRedactor()` returns a redactor with no compiled rules instead of failing closed, so sensitive fields may be exported.

### Medium
- [code] `references/lib-commons/commons/opentelemetry/otel.go:423`, `references/lib-commons/commons/opentelemetry/otel.go:428`, `references/lib-commons/commons/opentelemetry/otel.go:429`, `references/lib-commons/commons/opentelemetry/otel.go:470` - `BuildAttributesFromValue` round-trips through JSON without `UseNumber`, so integers become `float64` and large values lose precision.
- [code] `references/lib-commons/commons/opentelemetry/otel.go:464`, `references/lib-commons/commons/opentelemetry/otel.go:465`, `references/lib-commons/commons/opentelemetry/otel.go:466` - sanitization happens before byte truncation, so truncation can split a multibyte rune and reintroduce invalid UTF-8.
- [code] `references/lib-commons/commons/opentelemetry/metrics/metrics.go:252`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:263`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:287`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:295`, `references/lib-commons/commons/opentelemetry/metrics/metrics.go:341` - histogram cache keys sort bucket boundaries, but instrument creation keeps caller order, so semantically different configs collide.
- [business] `references/lib-commons/commons/opentelemetry/otel.go:423`, `references/lib-commons/commons/opentelemetry/otel.go:428`, `references/lib-commons/commons/opentelemetry/otel.go:429`, `references/lib-commons/commons/opentelemetry/otel.go:470` - trace attributes can carry incorrect business values because numeric precision is lost during JSON flattening.
- [business] `references/lib-commons/commons/opentelemetry/metrics/system.go:25`, `references/lib-commons/commons/opentelemetry/metrics/system.go:31`, `references/lib-commons/commons/opentelemetry/metrics/system.go:35`, `references/lib-commons/commons/opentelemetry/metrics/system.go:41` - percentage helpers accept any integer and do not validate the 0..100 range.
- [security] `references/lib-commons/commons/opentelemetry/metrics/builders.go:29`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:47`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:87`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:105`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:144`, `references/lib-commons/commons/opentelemetry/metrics/builders.go:162` - metric builders accept arbitrary caller-supplied labels/attributes with no sanitization or cardinality guard.
- [security] `references/lib-commons/commons/opentelemetry/otel.go:125`, `references/lib-commons/commons/opentelemetry/otel.go:126`, `references/lib-commons/commons/opentelemetry/otel.go:127`, `references/lib-commons/commons/opentelemetry/otel.go:266`, `references/lib-commons/commons/opentelemetry/otel.go:275`, `references/lib-commons/commons/opentelemetry/otel.go:284` - plaintext OTLP export is allowed in non-dev environments with only a warning instead of failing closed.
- [test] `references/lib-commons/commons/opentelemetry/otel_test.go:805`, `references/lib-commons/commons/opentelemetry/otel_test.go:818`, `references/lib-commons/commons/opentelemetry/otel_test.go:831` - tests only assert `NotPanics` and do not verify emitted events, recorded errors, or span status.
- [test] `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1104`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1195`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1254`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1218`, `references/lib-commons/commons/opentelemetry/metrics/v2_test.go:1280` - several concurrency tests mostly equate success with “no race/no panic” and have weak postconditions.
- [consequences] `references/lib-commons/commons/opentelemetry/otel.go:423`, `references/lib-commons/commons/opentelemetry/otel.go:429`, `references/lib-commons/commons/opentelemetry/otel.go:470` - precision loss in attribute flattening can misalign dashboards and queries that expect exact IDs and counters.
- [consequences] `references/lib-commons/commons/opentelemetry/otel.go:434`, `references/lib-commons/commons/opentelemetry/otel.go:460`, `references/lib-commons/commons/opentelemetry/otel.go:469`, `references/lib-commons/commons/opentelemetry/otel.go:479` - top-level scalars can emit an empty attribute key and top-level slices can emit keys like `.0`.
- [consequences] `references/lib-commons/commons/opentelemetry/otel.go:134`, `references/lib-commons/commons/opentelemetry/otel.go:139`, `references/lib-commons/commons/opentelemetry/otel.go:144`, `references/lib-commons/commons/opentelemetry/otel.go:158` - failed `NewTelemetry` calls do not clean up partially created exporters, so retries can accumulate orphaned resources.

### Low
- [code] `references/lib-commons/commons/opentelemetry/otel.go:459`, `references/lib-commons/commons/opentelemetry/otel.go:460` - flattening a top-level slice with an empty prefix produces keys like `.0`.
- [security] `references/lib-commons/commons/opentelemetry/otel.go:483`, `references/lib-commons/commons/opentelemetry/otel.go:494` - `SetSpanAttributeForParam` writes raw request parameter values into span attributes without sensitivity checks.
- [test] `references/lib-commons/commons/opentelemetry/v2_test.go:166` - `TestHandleSpanHelpers_NoPanicsOnNil` bundles multiple helper behaviors into a single no-panic test, reducing failure isolation.
- [consequences] `references/lib-commons/commons/opentelemetry/otel.go:379`, `references/lib-commons/commons/opentelemetry/otel.go:384` - `HandleSpanError` can emit malformed status descriptions like `": ..."` when message is empty.

## 2. HTTP Surface + Server Lifecycle

### Critical
- [nil-safety] `references/lib-commons/commons/net/http/proxy.go:119` - `ServeReverseProxy` checks `req != nil` but not `req.URL != nil`, so `&http.Request{}` can panic.
- [nil-safety] `references/lib-commons/commons/net/http/withTelemetry.go:85`, `references/lib-commons/commons/net/http/withTelemetry.go:164` - middleware dereferences `effectiveTelemetry.TracerProvider` directly, so a partially initialized telemetry instance crashes the first request.

### High
- [code] `references/lib-commons/commons/server/shutdown.go:181`, `references/lib-commons/commons/server/shutdown.go:334`, `references/lib-commons/commons/server/shutdown.go:345` - `StartWithGracefulShutdownWithError()` logs startup failures but still returns `nil`.
- [code] `references/lib-commons/commons/net/http/withTelemetry.go:262`, `references/lib-commons/commons/net/http/withTelemetry.go:309`, `references/lib-commons/commons/server/shutdown.go:395` - telemetry middleware starts a process-global metrics collector that is not stopped before telemetry shutdown.
- [code] `references/lib-commons/commons/server/shutdown.go:395`, `references/lib-commons/commons/server/shutdown.go:402` - shutdown order is inverted for gRPC, so telemetry is torn down before in-flight RPCs finish.
- [code] `references/lib-commons/commons/net/http/health.go:92`, `references/lib-commons/commons/net/http/health.go:123` - dependencies with a circuit breaker but empty `ServiceName` are silently treated as healthy.
- [business] `references/lib-commons/commons/server/shutdown.go:181`, `references/lib-commons/commons/server/shutdown.go:246`, `references/lib-commons/commons/server/shutdown.go:271`, `references/lib-commons/commons/server/shutdown.go:331` - `StartWithGracefulShutdownWithError()` cannot distinguish clean shutdown from bind/listen failure.
- [business] `references/lib-commons/commons/net/http/health.go:87`, `references/lib-commons/commons/net/http/health.go:92`, `references/lib-commons/commons/net/http/health.go:118`, `references/lib-commons/commons/net/http/health.go:124` - `HealthWithDependencies` false-greens misconfigured dependencies when `ServiceName` is missing.
- [business] `references/lib-commons/commons/net/http/pagination.go:133`, `references/lib-commons/commons/net/http/pagination.go:159` - `EncodeTimestampCursor` accepts `uuid.Nil` even though `DecodeTimestampCursor` rejects it.
- [business] `references/lib-commons/commons/net/http/pagination.go:216`, `references/lib-commons/commons/net/http/pagination.go:244`, `references/lib-commons/commons/net/http/pagination.go:248` - `EncodeSortCursor` can emit cursors that `DecodeSortCursor` later rejects.
- [test] `references/lib-commons/commons/net/http/proxy_test.go:794`, `references/lib-commons/commons/net/http/proxy_test.go:897`, `references/lib-commons/commons/net/http/proxy.go:280` - SSRF/DNS rebinding coverage is shallow and misses key `validateResolvedIPs` branches.
- [test] `references/lib-commons/commons/net/http/withLogging_test.go:229`, `references/lib-commons/commons/net/http/withLogging_test.go:246`, `references/lib-commons/commons/net/http/withLogging_test.go:282` - logging middleware tests never inject/capture a logger or assert logged fields/body obfuscation.
- [nil-safety] `references/lib-commons/commons/net/http/health.go:92`, `references/lib-commons/commons/net/http/health.go:93`, `references/lib-commons/commons/net/http/health.go:94`, `references/lib-commons/commons/net/http/health.go:103` - interface-nil checks on `CircuitBreaker` miss typed-nil managers and can panic.
- [nil-safety] `references/lib-commons/commons/net/http/context.go:323`, `references/lib-commons/commons/net/http/context.go:327`, `references/lib-commons/commons/net/http/context.go:336`, `references/lib-commons/commons/net/http/context.go:340`, `references/lib-commons/commons/net/http/context.go:345`, `references/lib-commons/commons/net/http/context.go:349`, `references/lib-commons/commons/net/http/context.go:355`, `references/lib-commons/commons/net/http/context.go:359` - span helpers rely on `span == nil` and can still panic on typed-nil spans.
- [nil-safety] `references/lib-commons/commons/server/shutdown.go:152`, `references/lib-commons/commons/server/shutdown.go:153` - `ServersStarted()` is not nil-safe; nil receivers panic and zero-value managers can return a nil channel that blocks forever.
- [consequences] `references/lib-commons/commons/net/http/withTelemetry.go:33`, `references/lib-commons/commons/net/http/withTelemetry.go:249`, `references/lib-commons/commons/net/http/withTelemetry.go:263`, `references/lib-commons/commons/net/http/withTelemetry.go:279`, `references/lib-commons/commons/server/shutdown.go:395` - host-metrics collection is process-global and can leak a collector goroutine / publish against stale telemetry after shutdown.
- [consequences] `references/lib-commons/commons/net/http/withTelemetry.go:252`, `references/lib-commons/commons/net/http/withTelemetry.go:263`, `references/lib-commons/commons/server/shutdown.go:76`, `references/lib-commons/commons/server/shutdown.go:87`, `references/lib-commons/commons/server/shutdown.go:99` - once the process-global collector starts, later telemetry instances never bind their own meter provider.
- [consequences] `references/lib-commons/commons/server/shutdown.go:181`, `references/lib-commons/commons/server/shutdown.go:192`, `references/lib-commons/commons/server/shutdown.go:246`, `references/lib-commons/commons/server/shutdown.go:271`, `references/lib-commons/commons/server/shutdown.go:283`, `references/lib-commons/commons/server/shutdown.go:334` - startup/listen failures are logged but not returned to embedders/tests/orchestrators.

### Medium
- [code] `references/lib-commons/commons/net/http/pagination.go:27`, `references/lib-commons/commons/net/http/pagination.go:38`, `references/lib-commons/commons/net/http/pagination.go:47` - `ParsePagination` documentation says invalid values are coerced to defaults, but malformed numerics actually return errors.
- [code] `references/lib-commons/commons/net/http/withTelemetry.go:33`, `references/lib-commons/commons/net/http/withTelemetry.go:240` - metrics collector is managed through package-level singleton state, reducing composability and test isolation.
- [code] `references/lib-commons/commons/net/http/health.go:84`, `references/lib-commons/commons/net/http/health.go:124` - dependency statuses are keyed only by name without validation for empty or duplicate names.
- [business] `references/lib-commons/commons/net/http/withLogging.go:286` - middleware only echoes a correlation ID if it generated it, not when the client supplied a valid request ID.
- [business] `references/lib-commons/commons/net/http/pagination.go:27`, `references/lib-commons/commons/net/http/pagination.go:38`, `references/lib-commons/commons/net/http/pagination.go:47` - comment/behavior mismatch can push callers into the wrong error-handling path.
- [security] `references/lib-commons/commons/net/http/withCORS.go:15`, `references/lib-commons/commons/net/http/withCORS.go:46`, `references/lib-commons/commons/net/http/withCORS.go:66`, `references/lib-commons/commons/net/http/withCORS.go:83` - `WithCORS` defaults `Access-Control-Allow-Origin` to `*` when no trusted origins are configured.
- [security] `references/lib-commons/commons/net/http/handler.go:52`, `references/lib-commons/commons/net/http/handler.go:61`, `references/lib-commons/commons/net/http/handler.go:67` - `ExtractTokenFromHeader` accepts non-`Bearer` authorization headers and can return the auth scheme itself as a token fallback.
- [security] `references/lib-commons/commons/net/http/withLogging.go:82`, `references/lib-commons/commons/net/http/withLogging.go:124`, `references/lib-commons/commons/net/http/withLogging.go:224` - raw `Referer` is logged without sanitization.
- [security] `references/lib-commons/commons/net/http/health.go:33`, `references/lib-commons/commons/net/http/health.go:84`, `references/lib-commons/commons/net/http/health.go:127` - health responses expose dependency names, breaker state, and counters that aid reconnaissance.
- [test] `references/lib-commons/commons/net/http/handler_test.go:19`, `references/lib-commons/commons/net/http/handler_test.go:26` - `File()` tests are brittle and barely verify served content or missing-file behavior.
- [test] `references/lib-commons/commons/net/http/withTelemetry_test.go:35` - test setup mutates global OTEL state and does not restore it.
- [test] `references/lib-commons/commons/server/shutdown_integration_test.go:337` - in-flight shutdown test relies on a fixed sleep and is timing-sensitive.
- [test] `references/lib-commons/commons/net/http/health_integration_test.go:428` - circuit recovery is validated with a fixed sleep instead of polling.
- [test] `references/lib-commons/commons/net/http/error_test.go:577` - method-not-allowed test accepts either `404` or `405`, weakening regression detection.
- [nil-safety] `references/lib-commons/commons/net/http/withTelemetry.go:168`, `references/lib-commons/commons/net/http/withTelemetry.go:177`, `references/lib-commons/commons/net/http/withTelemetry.go:192` - gRPC interceptor assumes `info *grpc.UnaryServerInfo` is always non-nil.
- [consequences] `references/lib-commons/commons/server/shutdown.go:395`, `references/lib-commons/commons/server/shutdown.go:402`, `references/lib-commons/commons/net/http/withTelemetry.go:177`, `references/lib-commons/commons/net/http/withTelemetry.go:178` - telemetry can be torn down before `grpc.Server.GracefulStop()` drains requests, losing final spans/metrics.
- [consequences] `references/lib-commons/commons/net/http/withTelemetry.go:71`, `references/lib-commons/commons/net/http/withTelemetry.go:101`, `references/lib-commons/commons/net/http/withTelemetry.go:240`, `references/lib-commons/commons/net/http/withTelemetry.go:323` - `excludedRoutes` are ignored when `WithTelemetry` is called on a nil receiver with an explicit telemetry argument.

### Low
- [code] `references/lib-commons/commons/net/http/handler.go:61`, `references/lib-commons/commons/net/http/handler.go:63` - `ExtractTokenFromHeader` uses `strings.Split` and permissively accepts malformed authorization headers like `Bearer token extra`.
- [business] `references/lib-commons/commons/net/http/handler.go:61`, `references/lib-commons/commons/net/http/handler.go:64` - bearer-token parsing is less tolerant than common implementations for flexible whitespace.
- [security] `references/lib-commons/commons/net/http/handler.go:23` - `Version` publicly exposes the exact deployed version.

## 3. Tenant Manager Domain

### Critical
- [security] `references/lib-commons/commons/tenant-manager/middleware/tenant.go:116`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:129`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:147`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:336`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:340`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:350` - unverified JWT claims are used to choose tenant databases, enabling cross-tenant DB resolution if another auth path merely sets `c.Locals("user_id")`.
- [nil-safety] `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:278`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:805`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:1012` - `Register` accepts a nil `HandlerFunc`, which later panics on first message delivery.
- [nil-safety] `references/lib-commons/commons/tenant-manager/client/client.go:130`, `references/lib-commons/commons/tenant-manager/client/client.go:281`, `references/lib-commons/commons/tenant-manager/client/client.go:367`, `references/lib-commons/commons/tenant-manager/client/client.go:487`, `references/lib-commons/commons/tenant-manager/cache/memory.go:61`, `references/lib-commons/commons/tenant-manager/cache/memory.go:87`, `references/lib-commons/commons/tenant-manager/cache/memory.go:104`, `references/lib-commons/commons/tenant-manager/cache/memory.go:114` - `WithCache` accepts typed-nil caches and later panics on method calls.
- [nil-safety] `references/lib-commons/commons/tenant-manager/postgres/manager.go:826`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:944` - `CreateDirectConnection` dereferences a nil `*core.PostgreSQLConfig`.

### High
- [code] `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:214`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:1091`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:1145`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:763` - requests can spawn long-lived background consumers for unknown/suspended tenants before tenant resolution succeeds.
- [code] `references/lib-commons/commons/tenant-manager/client/client.go:323`, `references/lib-commons/commons/tenant-manager/client/client.go:337`, `references/lib-commons/commons/tenant-manager/client/client.go:345` - 403 handling only returns `*core.TenantSuspendedError` when the response body contains a parseable JSON `status`, otherwise it degrades to a generic error.
- [business] `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:214`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:219`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:1102`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:1128`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:1145` - middleware can start consumers for nonexistent, purged, or unauthorized tenants.
- [business] `references/lib-commons/commons/tenant-manager/rabbitmq/manager.go:185`, `references/lib-commons/commons/tenant-manager/rabbitmq/manager.go:190`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:869`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:876`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:883` - tenant-manager RabbitMQ connection creation wraps suspension/purge errors as generic retryable failures, causing infinite reconnect loops.
- [business] `references/lib-commons/commons/tenant-manager/middleware/tenant.go:173`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:189`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:207`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:223`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:479`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:495`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:504` - `TenantMiddleware` and `MultiPoolMiddleware` map the same domain errors to different HTTP status codes.
- [security] `references/lib-commons/commons/tenant-manager/rabbitmq/manager.go:201`, `references/lib-commons/commons/tenant-manager/rabbitmq/manager.go:205`, `references/lib-commons/commons/tenant-manager/rabbitmq/manager.go:398`, `references/lib-commons/commons/tenant-manager/rabbitmq/manager.go:403` - RabbitMQ connections are hard-wired to plaintext `amqp://` with no TLS/`amqps` path.
- [security] `references/lib-commons/commons/tenant-manager/client/client.go:147`, `references/lib-commons/commons/tenant-manager/client/client.go:161`, `references/lib-commons/commons/tenant-manager/client/client.go:172`, `references/lib-commons/commons/tenant-manager/client/client.go:433`, `references/lib-commons/commons/tenant-manager/client/client.go:547` - tenant-manager client accepts any URL scheme/host and permits `http://`, so tenant credentials can be fetched over cleartext transport.
- [test] `references/lib-commons/commons/tenant-manager/middleware/tenant.go:116`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:156`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:173`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:207`, `references/lib-commons/commons/tenant-manager/middleware/tenant_test.go:190` - middleware tests miss fail-closed auth enforcement, invalid `tenantId` format, suspended-tenant mapping, and PG/Mongo resolution failures.
- [test] `references/lib-commons/commons/tenant-manager/client/client.go:276`, `references/lib-commons/commons/tenant-manager/client/client.go:361`, `references/lib-commons/commons/tenant-manager/client/client.go:480`, `references/lib-commons/commons/tenant-manager/client/client_test.go:152` - client cache tests miss cache-hit, malformed cached JSON, `WithSkipCache`, invalidation, and `Close` paths.
- [consequences] `references/lib-commons/commons/tenant-manager/client/client.go:323`, `references/lib-commons/commons/tenant-manager/client/client.go:337`, `references/lib-commons/commons/tenant-manager/client/client.go:345`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:381`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:386`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:488` - degraded 403 handling means suspended/purged tenants can be misclassified as generic connection failures and surfaced as 5xx/503.
- [consequences] `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:111`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:218`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:275`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:282`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:392` - `WithCrossModuleInjection` promises resolution for all registered routes, but only injects PostgreSQL after matched-route PG resolution.

### Medium
- [code] `references/lib-commons/commons/tenant-manager/postgres/manager.go:633`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:646`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:878`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:896`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:900` - removing tenant `connectionSettings` does not restore defaults; existing pools keep stale limits until recreated.
- [code] `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:253`, `references/lib-commons/commons/tenant-manager/client/client.go:183`, `references/lib-commons/commons/tenant-manager/cache/memory.go:47`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:1174` - internal fallback `pmClient` allocates an `InMemoryCache` cleanup goroutine that `MultiTenantConsumer.Close` never stops.
- [business] `references/lib-commons/commons/tenant-manager/core/errors.go:15`, `references/lib-commons/commons/tenant-manager/client/client.go:323`, `references/lib-commons/commons/tenant-manager/client/client.go:337`, `references/lib-commons/commons/tenant-manager/client/client.go:345` - `ErrTenantServiceAccessDenied` is documented as the 403 sentinel but is never actually returned or wrapped.
- [security] `references/lib-commons/commons/tenant-manager/postgres/manager.go:827`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:829`, `references/lib-commons/commons/tenant-manager/postgres/manager.go:843` - PostgreSQL DSNs default to `sslmode=prefer`, allowing silent non-TLS downgrade.
- [security] `references/lib-commons/commons/tenant-manager/core/types.go:17`, `references/lib-commons/commons/tenant-manager/core/types.go:29`, `references/lib-commons/commons/tenant-manager/core/types.go:42`, `references/lib-commons/commons/tenant-manager/client/client.go:366`, `references/lib-commons/commons/tenant-manager/client/client.go:367` - full tenant configs, including plaintext DB and RabbitMQ passwords, are cached wholesale for the default 1h TTL.
- [test] `references/lib-commons/commons/tenant-manager/client/client_test.go:423`, `references/lib-commons/commons/tenant-manager/client/client_test.go:462` - half-open circuit-breaker tests rely on `time.Sleep(cbTimeout + 10*time.Millisecond)` and are timing-sensitive.
- [test] `references/lib-commons/commons/tenant-manager/consumer/multi_tenant_test.go:535` - lazy sync test waits a fixed `3 * syncInterval` instead of polling.
- [test] `references/lib-commons/commons/tenant-manager/postgres/manager_test.go:1033`, `references/lib-commons/commons/tenant-manager/postgres/manager_test.go:1191`, `references/lib-commons/commons/tenant-manager/postgres/manager_test.go:1249` - async revalidation tests infer goroutine completion with fixed sleeps.
- [test] `references/lib-commons/commons/tenant-manager/middleware/tenant_test.go:207`, `references/lib-commons/commons/tenant-manager/middleware/tenant_test.go:232`, `references/lib-commons/commons/tenant-manager/middleware/tenant_test.go:262` - unauthorized-path assertions only check status code plus a generic `Unauthorized` substring instead of structured payload.
- [consequences] `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:417`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:427`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:434`, `references/lib-commons/commons/tenant-manager/core/context.go:108` - cross-module resolution failures are only logged and then dropped, so downstream code later fails with `ErrTenantContextRequired` and loses the real cause.
- [consequences] `references/lib-commons/commons/tenant-manager/middleware/tenant.go:116`, `references/lib-commons/commons/tenant-manager/middleware/tenant.go:238`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:336` - both middleware variants hard-code upstream auth to `c.Locals("user_id")`, making integration brittle with alternative auth middleware.

### Low
- [code] `references/lib-commons/commons/tenant-manager/client/client.go:287`, `references/lib-commons/commons/tenant-manager/client/client.go:296`, `references/lib-commons/commons/tenant-manager/client/client.go:301` - corrupt cached tenant config JSON is logged and refetched, but the bad cache entry is left in place.
- [code] `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:66`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:299`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:302` - route selection is “first prefix wins” instead of longest-prefix matching.
- [business] `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:456`, `references/lib-commons/commons/tenant-manager/consumer/multi_tenant.go:540` - `identifyNewTenants` repeatedly logs known-but-not-yet-started lazy tenants as newly discovered.
- [test] `references/lib-commons/commons/tenant-manager/cache/memory_test.go:224`, `references/lib-commons/commons/tenant-manager/cache/memory_test.go:226`, `references/lib-commons/commons/tenant-manager/cache/memory_test.go:228` - concurrent cache test discards returned errors.
- [test] `references/lib-commons/commons/tenant-manager/client/client_test.go:417`, `references/lib-commons/commons/tenant-manager/client/client_test.go:456`, `references/lib-commons/commons/tenant-manager/client/client_test.go:634`, `references/lib-commons/commons/tenant-manager/client/client_test.go:635`, `references/lib-commons/commons/tenant-manager/client/client_test.go:636` - several circuit-breaker setup calls intentionally ignore returned errors.
- [consequences] `references/lib-commons/commons/tenant-manager/core/errors.go:13`, `references/lib-commons/commons/tenant-manager/client/client.go:329`, `references/lib-commons/commons/tenant-manager/client/client.go:345`, `references/lib-commons/commons/tenant-manager/middleware/multi_pool.go:495` - `ErrTenantServiceAccessDenied` is effectively dead contract surface.

## 4. Messaging + Outbox

### Critical
- [consequences] `references/lib-commons/commons/outbox/postgres/schema_resolver.go:164`, `references/lib-commons/commons/outbox/postgres/schema_resolver.go:167`, `references/lib-commons/commons/outbox/dispatcher.go:461`, `references/lib-commons/commons/outbox/dispatcher.go:481`, `references/lib-commons/commons/outbox/postgres/schema_resolver.go:118` - `DiscoverTenants()` can inject a default tenant schema that is absent, and `ApplyTenant()` then drives unqualified queries against `public.outbox_events`, causing cross-tenant reads/writes.

### High
- [code] `references/lib-commons/commons/outbox/postgres/schema_resolver.go:141` - `DiscoverTenants` enumerates every UUID-shaped schema without checking whether it actually contains the outbox table.
- [code] `references/lib-commons/commons/outbox/postgres/schema_resolver.go:110`, `references/lib-commons/commons/outbox/postgres/schema_resolver.go:164` - discovered “default tenant” dispatch cycles can run against the connection’s default `search_path` instead of the configured schema.
- [code] `references/lib-commons/commons/rabbitmq/rabbitmq.go:925` - `AllowInsecureHealthCheck` disables host allowlist enforcement even when basic-auth credentials are attached.
- [business] `references/lib-commons/commons/rabbitmq/rabbitmq.go:211`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:222`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:245`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:255` - reconnect failures leave stale `Connected`/`Connection`/`Channel` state visible after a failed reconnect attempt.
- [business] `references/lib-commons/commons/rabbitmq/publisher.go:724`, `references/lib-commons/commons/rabbitmq/publisher.go:756`, `references/lib-commons/commons/rabbitmq/publisher.go:813` - `Reconnect` restores the channel but never resets publisher health to `HealthStateConnected`.
- [security] `references/lib-commons/commons/rabbitmq/rabbitmq.go:79`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:552`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:557`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:922`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:940` - health-check client allows any `HealthCheckURL` host when no allowlist is configured and strict mode is off, leaving SSRF open by default.
- [test] `references/lib-commons/commons/outbox/postgres/repository.go:617`, `references/lib-commons/commons/outbox/postgres/repository_integration_test.go:240` - `ListFailedForRetry` has no direct tests for the core retry-selection query semantics.
- [test] `references/lib-commons/commons/outbox/postgres/column_resolver.go:120`, `references/lib-commons/commons/outbox/postgres/column_resolver.go:131`, `references/lib-commons/commons/outbox/postgres/column_resolver_test.go:56`, `references/lib-commons/commons/outbox/postgres/repository_integration_test.go:429` - tenant discovery cache-miss, `singleflight`, and timeout behavior are effectively untested.
- [test] `references/lib-commons/commons/rabbitmq/publisher.go:606`, `references/lib-commons/commons/rabbitmq/publisher.go:611`, `references/lib-commons/commons/rabbitmq/publisher_test.go:221`, `references/lib-commons/commons/rabbitmq/publisher_test.go:678` - timeout/cancel tests assert only the returned error and do not verify the critical invalidation side effect.
- [nil-safety] `references/lib-commons/commons/rabbitmq/rabbitmq.go:837`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:209`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:371`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:543`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:814` - `logger()` only checks interface-nil and can return a typed-nil logger that later panics.
- [consequences] `references/lib-commons/commons/outbox/postgres/schema_resolver.go:110`, `references/lib-commons/commons/outbox/postgres/schema_resolver.go:112`, `references/lib-commons/commons/outbox/postgres/repository.go:1243`, `references/lib-commons/commons/outbox/postgres/repository.go:1278` - combining `WithAllowEmptyTenant()` with `WithDefaultTenantID(...)` routes default-tenant repository calls to `public`.
- [consequences] `references/lib-commons/commons/rabbitmq/publisher.go:606`, `references/lib-commons/commons/rabbitmq/publisher.go:611`, `references/lib-commons/commons/rabbitmq/publisher.go:580`, `references/lib-commons/commons/rabbitmq/publisher.go:588` - one confirm timeout or canceled publish context permanently closes the publisher unless the caller rebuilds it.

### Medium
- [code] `references/lib-commons/commons/rabbitmq/rabbitmq.go:209`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:213`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:371`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:543` - context-aware API drops caller context for operational logging by hardcoding `context.Background()`.
- [business] `references/lib-commons/commons/outbox/tenant.go:35`, `references/lib-commons/commons/outbox/tenant.go:50`, `references/lib-commons/commons/outbox/tenant.go:59`, `references/lib-commons/commons/outbox/tenant.go:67` - whitespace-wrapped tenant IDs are silently discarded instead of trimmed or rejected.
- [security] `references/lib-commons/commons/rabbitmq/dlq.go:15`, `references/lib-commons/commons/rabbitmq/dlq.go:100`, `references/lib-commons/commons/rabbitmq/dlq.go:106`, `references/lib-commons/commons/rabbitmq/dlq.go:107`, `references/lib-commons/commons/rabbitmq/dlq.go:160`, `references/lib-commons/commons/rabbitmq/dlq.go:171` - default DLQ topology uses `#` with no TTL or max-length cap, allowing indefinite poison-message retention.
- [test] `references/lib-commons/commons/rabbitmq/rabbitmq_integration_test.go:102`, `references/lib-commons/commons/rabbitmq/rabbitmq_integration_test.go:122`, `references/lib-commons/commons/rabbitmq/rabbitmq_integration_test.go:151`, `references/lib-commons/commons/rabbitmq/rabbitmq_integration_test.go:172`, `references/lib-commons/commons/rabbitmq/trace_propagation_integration_test.go:86`, `references/lib-commons/commons/rabbitmq/trace_propagation_integration_test.go:188`, `references/lib-commons/commons/rabbitmq/trace_propagation_integration_test.go:260`, `references/lib-commons/commons/rabbitmq/trace_propagation_integration_test.go:327`, `references/lib-commons/commons/rabbitmq/trace_propagation_integration_test.go:344`, `references/lib-commons/commons/rabbitmq/trace_propagation_integration_test.go:409` - multiple integration tests ignore teardown errors.
- [test] `references/lib-commons/commons/outbox/event_test.go:33`, `references/lib-commons/commons/outbox/event_test.go:37`, `references/lib-commons/commons/outbox/event_test.go:42`, `references/lib-commons/commons/outbox/event_test.go:47`, `references/lib-commons/commons/outbox/event_test.go:58`, `references/lib-commons/commons/outbox/event_test.go:63` - many validation branches are packed into one test and rely on substring matching.
- [test] `references/lib-commons/commons/rabbitmq/rabbitmq_test.go:696`, `references/lib-commons/commons/rabbitmq/rabbitmq_test.go:713`, `references/lib-commons/commons/rabbitmq/rabbitmq_test.go:731`, `references/lib-commons/commons/rabbitmq/rabbitmq_test.go:766` - health-check error-path tests use only generic `assert.Error` / `assert.False` assertions.
- [consequences] `references/lib-commons/commons/rabbitmq/publisher.go:756`, `references/lib-commons/commons/rabbitmq/publisher.go:765`, `references/lib-commons/commons/rabbitmq/publisher.go:814` - `Reconnect()` never restores `health` to `HealthStateConnected`, so health probes can keep treating a recovered publisher as unhealthy.

### Low
- [security] `references/lib-commons/commons/outbox/postgres/schema_resolver.go:36`, `references/lib-commons/commons/outbox/postgres/schema_resolver.go:40`, `references/lib-commons/commons/outbox/postgres/schema_resolver.go:102`, `references/lib-commons/commons/outbox/postgres/schema_resolver.go:107`, `references/lib-commons/commons/outbox/postgres/schema_resolver.go:110` - `WithAllowEmptyTenant` makes empty tenant ID a silent no-op and can accidentally reuse an active `search_path`.
- [test] `references/lib-commons/commons/outbox/postgres/repository_integration_test.go:231` - non-priority fixture event is intentionally ignored, so the test only proves the positive match.
- [test] `references/lib-commons/commons/rabbitmq/trace_propagation_integration_test.go:482` - multiple-message trace test hard-codes FIFO ordering instead of focusing only on trace propagation.
- [consequences] `references/lib-commons/commons/rabbitmq/rabbitmq.go:151`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:177`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:211`, `references/lib-commons/commons/rabbitmq/rabbitmq.go:255` - `Connect()` opens a new AMQP connection/channel before checking whether an existing live connection is already installed.

## 5. Data Connectors

### High
- [code] `references/lib-commons/commons/redis/redis.go:426`, `references/lib-commons/commons/redis/redis.go:432`, `references/lib-commons/commons/redis/redis.go:451` - reconnect logic closes the current client before replacement is created and pinged, so a failed reconnect can discard a healthy client and turn recovery into outage.
- [code] `references/lib-commons/commons/redis/lock.go:372`, `references/lib-commons/commons/redis/lock.go:374`, `references/lib-commons/commons/redis/lock.go:378` - `TryLock` treats any error containing `failed to acquire lock` as normal contention, masking real infrastructure faults.
- [business] `references/lib-commons/commons/postgres/postgres.go:760`, `references/lib-commons/commons/postgres/postgres.go:850`, `references/lib-commons/commons/postgres/postgres.go:857` - missing migration files are treated as a warning and `Migrator.Up()` returns `nil`, allowing services to boot against unmigrated schemas.
- [business] `references/lib-commons/commons/redis/lock.go:299`, `references/lib-commons/commons/redis/lock.go:310`, `references/lib-commons/commons/redis/lock.go:319` - `WithLockOptions()` unlocks with the caller context; if it is already canceled, unlock fails and the method still returns success while the lock remains held until TTL expiry.
- [business] `references/lib-commons/commons/redis/redis.go:911`, `references/lib-commons/commons/redis/redis.go:830`, `references/lib-commons/commons/redis/redis.go:1047` - `AllowLegacyMinVersion=true` is accepted and logged as retained, but runtime TLS construction still forces TLS 1.2 unless exactly TLS 1.3.
- [test] `references/lib-commons/commons/redis/resilience_integration_test.go:195`, `references/lib-commons/commons/redis/resilience_integration_test.go:223`, `references/lib-commons/commons/backoff/backoff.go:83` - Redis backoff resilience test is nondeterministic because full jitter can legitimately produce repeated zero delays.
- [test] `references/lib-commons/commons/postgres/resilience_integration_test.go:208`, `references/lib-commons/commons/postgres/resilience_integration_test.go:236`, `references/lib-commons/commons/backoff/backoff.go:83` - Postgres backoff resilience test has the same full-jitter flake vector.
- [test] `references/lib-commons/commons/mongo/mongo.go:358`, `references/lib-commons/commons/mongo/mongo_integration_test.go:181` - Mongo reconnect-storm protection in `ResolveClient` is effectively untested.
- [consequences] `references/lib-commons/commons/postgres/postgres.go:760`, `references/lib-commons/commons/postgres/postgres.go:763`, `references/lib-commons/commons/postgres/postgres.go:850`, `references/lib-commons/commons/postgres/postgres.go:857` - missing migrations become warn-and-skip behavior across consuming services.
- [consequences] `references/lib-commons/commons/postgres/postgres.go:359`, `references/lib-commons/commons/postgres/postgres.go:630`, `references/lib-commons/commons/postgres/postgres.go:679`, `references/lib-commons/commons/postgres/postgres.go:693` - `SanitizedError` wrappers drop unwrap semantics, so `errors.Is` / `errors.As` stop matching driver/network causes.
- [consequences] `references/lib-commons/commons/redis/redis.go:811`, `references/lib-commons/commons/postgres/postgres.go:834`, `references/lib-commons/commons/redis/redis.go:1047`, `references/lib-commons/commons/redis/redis.go:1052` - explicit legacy TLS compatibility claims do not match actual runtime behavior, breaking integrations that rely on them.

### Medium
- [code] `references/lib-commons/commons/postgres/postgres.go:841`, `references/lib-commons/commons/postgres/postgres.go:850`, `references/lib-commons/commons/postgres/postgres.go:860` - `migrate.Migrate` created by `migrate.NewWithDatabaseInstance` is never closed.
- [code] `references/lib-commons/commons/redis/redis.go:176`, `references/lib-commons/commons/redis/redis.go:378`, `references/lib-commons/commons/redis/redis.go:393` - `Status` / `IsConnected` expose a cached connected flag instead of probing real liveness.
- [code] `references/lib-commons/commons/redis/lock_interface.go:26`, `references/lib-commons/commons/redis/lock_interface.go:45`, `references/lib-commons/commons/redis/lock_interface.go:61` - exported `LockManager` abstraction increases API surface with little demonstrated production value.
- [business] `references/lib-commons/commons/mongo/connection_string.go:122`, `references/lib-commons/commons/mongo/connection_string.go:128` - `BuildURI()` turns username-only auth into `user:@`, changing semantics for external-auth flows.
- [security] `references/lib-commons/commons/mongo/mongo.go:272`, `references/lib-commons/commons/mongo/mongo.go:274`, `references/lib-commons/commons/mongo/mongo.go:276`, `references/lib-commons/commons/mongo/mongo.go:283`, `references/lib-commons/commons/mongo/mongo.go:288`, `references/lib-commons/commons/mongo/mongo.go:290` - Mongo connection and ping failures are logged/returned with raw driver errors, which may include URI or auth details.
- [security] `references/lib-commons/commons/redis/redis.go:120`, `references/lib-commons/commons/redis/redis.go:123`, `references/lib-commons/commons/redis/redis.go:811`, `references/lib-commons/commons/redis/redis.go:830`, `references/lib-commons/commons/redis/redis.go:834`, `references/lib-commons/commons/redis/redis.go:900`, `references/lib-commons/commons/redis/redis.go:911`, `references/lib-commons/commons/redis/redis.go:912` - Redis explicitly allows TLS versions below 1.2 when `AllowLegacyMinVersion=true`.
- [test] `references/lib-commons/commons/mongo/mongo_test.go:312`, `references/lib-commons/commons/mongo/mongo.go:256` - config propagation test only verifies captured options, not that they were applied.
- [test] `references/lib-commons/commons/postgres/postgres_test.go:1416`, `references/lib-commons/commons/postgres/postgres.go:175` - `TestValidateDSN` misses malformed URL cases.
- [test] `references/lib-commons/commons/postgres/postgres_test.go:1448`, `references/lib-commons/commons/postgres/postgres.go:191` - insecure DSN warning test only asserts “does not panic”.
- [consequences] `references/lib-commons/commons/redis/lock.go:366`, `references/lib-commons/commons/redis/lock.go:372`, `references/lib-commons/commons/redis/lock.go:376`, `references/lib-commons/commons/redis/lock.go:378` - `TryLock` collapses true contention and backend/quorum failures into the same `(nil, false, nil)` outcome.
- [consequences] `references/lib-commons/commons/mongo/connection_string.go:111`, `references/lib-commons/commons/mongo/connection_string.go:114`, `references/lib-commons/commons/mongo/connection_string.go:119` - `BuildURI` blindly concatenates raw IPv6 literals and can emit invalid Mongo URIs.

### Low
- [code] `references/lib-commons/commons/mongo/connection_string.go:34`, `references/lib-commons/commons/mongo/connection_string.go:111` - `BuildURI` claims canonical validation but intentionally defers host validation downstream.
- [security] `references/lib-commons/commons/postgres/postgres.go:151`, `references/lib-commons/commons/postgres/postgres.go:181`, `references/lib-commons/commons/postgres/postgres.go:184`, `references/lib-commons/commons/postgres/postgres.go:191`, `references/lib-commons/commons/postgres/postgres.go:319`, `references/lib-commons/commons/postgres/postgres.go:320` - Postgres allows `sslmode=disable` with only a warning.
- [security] `references/lib-commons/commons/mongo/mongo.go:91`, `references/lib-commons/commons/mongo/mongo.go:104`, `references/lib-commons/commons/mongo/mongo.go:263`, `references/lib-commons/commons/mongo/mongo.go:269`, `references/lib-commons/commons/mongo/mongo.go:295`, `references/lib-commons/commons/mongo/mongo.go:297` - Mongo connects without TLS whenever the URI/TLS config does not force it, only warning afterward.
- [security] `references/lib-commons/commons/redis/redis.go:475`, `references/lib-commons/commons/redis/redis.go:476`, `references/lib-commons/commons/redis/redis.go:955`, `references/lib-commons/commons/redis/redis.go:965` - Redis allows non-TLS operation for non-GCP-IAM modes with only a warning.
- [test] `references/lib-commons/commons/redis/lock_test.go:650`, `references/lib-commons/commons/redis/lock.go:274` - tracing/context propagation test for `WithLock` only checks that callback context is non-nil.
- [consequences] `references/lib-commons/commons/mongo/mongo.go:660`, `references/lib-commons/commons/mongo/mongo.go:661`, `references/lib-commons/commons/mongo/mongo.go:662` - TLS detection for warning suppression is case-sensitive and can emit misleading warnings.

## 6. Resilience + Execution Safety

### Critical
- [nil-safety] `references/lib-commons/commons/circuitbreaker/manager.go:145`, `references/lib-commons/commons/circuitbreaker/types.go:117` - `Execute` forwards `fn` without a nil guard, so nil callbacks panic.
- [nil-safety] `references/lib-commons/commons/backoff/backoff.go:106` - `WaitContext` calls `ctx.Done()` unconditionally and panics on nil context.

### High
- [code] `references/lib-commons/commons/circuitbreaker/manager.go:307`, `references/lib-commons/commons/circuitbreaker/manager.go:310`, `references/lib-commons/commons/circuitbreaker/types.go:168` - listener timeout is ineffective because derived context is never passed to `OnStateChange` and the listener interface has no context parameter.
- [code] `references/lib-commons/commons/runtime/tracing.go:72`, `references/lib-commons/commons/runtime/tracing.go:84`, `references/lib-commons/commons/runtime/tracing.go:95` - panic tracing writes raw panic values and full stack traces into span events with no redaction/size cap.
- [code] `references/lib-commons/commons/circuitbreaker/types.go:64`, `references/lib-commons/commons/circuitbreaker/types.go:69`, `references/lib-commons/commons/circuitbreaker/types.go:73` - `Config.Validate` does not reject negative `Interval` or `Timeout` values.
- [business] `references/lib-commons/commons/circuitbreaker/types.go:35`, `references/lib-commons/commons/circuitbreaker/manager.go:206`, `references/lib-commons/commons/circuitbreaker/healthchecker.go:159`, `references/lib-commons/commons/circuitbreaker/healthchecker.go:236` - `IsHealthy` is documented as “not open” but implemented as “closed only”, so half-open breakers look unhealthy and can be reset prematurely.
- [business] `references/lib-commons/commons/circuitbreaker/manager.go:283`, `references/lib-commons/commons/circuitbreaker/manager.go:307` - listener timeout comments/behavior do not match reality.
- [security] `references/lib-commons/commons/runtime/tracing.go:69-75`, `references/lib-commons/commons/runtime/tracing.go:84-87` - recovered panics are written into OTEL as raw `panic.value`, full `panic.stack`, and `RecordError(...)` payloads.
- [test] `references/lib-commons/commons/runtime/metrics.go:51`, `references/lib-commons/commons/runtime/metrics.go:86`, `references/lib-commons/commons/runtime/metrics.go:100` - panic-metrics init/reset/recording paths are effectively untested.
- [test] `references/lib-commons/commons/circuitbreaker/manager.go:154`, `references/lib-commons/commons/circuitbreaker/manager.go:156`, `references/lib-commons/commons/circuitbreaker/manager.go:158` - no test covers half-open `ErrTooManyRequests` rejection or its metric label.
- [test] `references/lib-commons/commons/circuitbreaker/types.go:73` - config validation lacks negative tests for `MinRequests > 0` with `FailureRatio <= 0`.
- [nil-safety] `references/lib-commons/commons/circuitbreaker/manager.go:244`, `references/lib-commons/commons/circuitbreaker/manager.go:310` - `RegisterStateChangeListener` accepts typed-nil listeners and can later panic during notification.
- [nil-safety] `references/lib-commons/commons/runtime/error_reporter.go:149`, `references/lib-commons/commons/runtime/error_reporter.go:170` - typed-nil `error` values can reintroduce panic risk inside panic-reporting code.
- [nil-safety] `references/lib-commons/commons/errgroup/errgroup.go:61`, `references/lib-commons/commons/errgroup/errgroup.go:90` - `Go` and `Wait` assume non-nil `*Group` and panic on nil receivers.
- [consequences] `references/lib-commons/commons/circuitbreaker/manager.go:103`, `references/lib-commons/commons/circuitbreaker/manager.go:108`, `references/lib-commons/commons/circuitbreaker/manager.go:120`, `references/lib-commons/commons/circuitbreaker/manager.go:128` - `GetOrCreate` keys breakers only by `serviceName`, so later calls with different config silently reuse stale breaker settings.
- [consequences] `references/lib-commons/commons/runtime/error_reporter.go:108`, `references/lib-commons/commons/runtime/error_reporter.go:120`, `references/lib-commons/commons/runtime/recover.go:53`, `references/lib-commons/commons/runtime/recover.go:86`, `references/lib-commons/commons/runtime/recover.go:139`, `references/lib-commons/commons/runtime/recover.go:216`, `references/lib-commons/commons/runtime/tracing.go:73`, `references/lib-commons/commons/runtime/tracing.go:74`, `references/lib-commons/commons/runtime/tracing.go:84`, `references/lib-commons/commons/circuitbreaker/manager.go:287`, `references/lib-commons/commons/circuitbreaker/healthchecker.go:99`, `references/lib-commons/commons/errgroup/errgroup.go:64` - `SetProductionMode(true)` redacts the external error-reporter path but not panic logs/spans in recovery flows.

### Medium
- [code] `references/lib-commons/commons/assert/predicates.go:316`, `references/lib-commons/commons/assert/predicates.go:318`, `references/lib-commons/commons/assert/predicates.go:333` - `TransactionOperationsMatch` checks subset inclusion, but its name/doc imply full matching.
- [code] `references/lib-commons/commons/assert/assert.go:309`, `references/lib-commons/commons/assert/assert.go:311`, `references/lib-commons/commons/assert/assert.go:315` - assertion failures are emitted as a single multiline string instead of structured fields.
- [business] `references/lib-commons/commons/circuitbreaker/types.go:62` - `Config.Validate` accepts nonsensical negative durations.
- [security] `references/lib-commons/commons/runtime/recover.go:156-167` - panic recovery logs raw panic values and full stack traces on every recovery path.
- [security] `references/lib-commons/commons/assert/assert.go:141-155`, `references/lib-commons/commons/assert/assert.go:188-199`, `references/lib-commons/commons/assert/assert.go:230-243`, `references/lib-commons/commons/assert/assert.go:290-312` - assertion failures log caller-supplied key/value data, `err.Error()`, and stack traces by default, making secret/PII exposure easy.
- [security] `references/lib-commons/commons/circuitbreaker/healthchecker.go:169-180`, `references/lib-commons/commons/circuitbreaker/healthchecker.go:244-253` - health-check failures are logged verbatim and may include connection strings, usernames, or hostnames.
- [test] `references/lib-commons/commons/backoff/backoff.go:48`, `references/lib-commons/commons/backoff/backoff.go:50`, `references/lib-commons/commons/backoff/backoff.go:71`, `references/lib-commons/commons/backoff/backoff.go:73` - fallback path for crypto-rand failure is untested.
- [test] `references/lib-commons/commons/circuitbreaker/types.go:113`, `references/lib-commons/commons/circuitbreaker/types.go:122`, `references/lib-commons/commons/circuitbreaker/types.go:131` - nil/uninitialized `CircuitBreaker` guard paths are uncovered.
- [test] `references/lib-commons/commons/assert/assert_extended_test.go:294`, `references/lib-commons/commons/assert/assert_extended_test.go:305` - metric-recording test only proves “no panic” and never asserts that a metric was emitted.
- [test] `references/lib-commons/commons/errgroup/errgroup_test.go:61`, `references/lib-commons/commons/errgroup/errgroup_test.go:63`, `references/lib-commons/commons/errgroup/errgroup_test.go:156`, `references/lib-commons/commons/errgroup/errgroup_test.go:158` - tests use `time.Sleep(50 * time.Millisecond)` to force goroutine ordering.
- [test] `references/lib-commons/commons/assert/predicates_test.go:205`, `references/lib-commons/commons/assert/predicates_test.go:225`, `references/lib-commons/commons/assert/predicates_test.go:228` - `TestDateNotInFuture` depends on `time.Now()` and a 1 ms tolerance.
- [nil-safety] `references/lib-commons/commons/runtime/goroutine.go:28`, `references/lib-commons/commons/runtime/goroutine.go:66` - `SafeGo` and `SafeGoWithContextAndComponent` invoke `fn` without validating it.
- [nil-safety] `references/lib-commons/commons/circuitbreaker/manager.go:74` - `NewManager` executes each `ManagerOption` blindly, so a nil option panics during construction.
- [consequences] `references/lib-commons/commons/circuitbreaker/manager.go:287`, `references/lib-commons/commons/circuitbreaker/manager.go:307`, `references/lib-commons/commons/circuitbreaker/manager.go:310`, `references/lib-commons/commons/circuitbreaker/types.go:170` - slow/blocking listeners leak one goroutine per state transition because the advertised timeout is ineffective.
- [consequences] `references/lib-commons/commons/circuitbreaker/healthchecker.go:161`, `references/lib-commons/commons/circuitbreaker/healthchecker.go:176`, `references/lib-commons/commons/circuitbreaker/manager.go:179`, `references/lib-commons/commons/circuitbreaker/manager.go:222` - health checker behavior depends on registration order and can probe forever against missing breakers.

### Low
- [business] `references/lib-commons/commons/safe/regex.go:119` - `FindString` comment says invalid patterns return empty string, but implementation returns `("", err)`.
- [security] `references/lib-commons/commons/assert/assert.go:230-243` - stack-trace emission is opt-out rather than opt-in.
- [test] `references/lib-commons/commons/assert/assert_extended_test.go:22`, `references/lib-commons/commons/assert/assert_extended_test.go:26` - helper panics on setup failure instead of failing the test normally.
- [test] `references/lib-commons/commons/circuitbreaker/manager_test.go:354`, `references/lib-commons/commons/circuitbreaker/manager_test.go:368` - existing-breaker test only compares state and not instance identity.
- [consequences] `references/lib-commons/commons/safe/regex.go:40`, `references/lib-commons/commons/safe/regex.go:41`, `references/lib-commons/commons/safe/regex.go:44` - once the regex cache reaches 1024 entries, adding one more pattern flushes the entire shared cache.

## 7. Logging Stack

### Critical
- [nil-safety] `references/lib-commons/commons/zap/zap.go:166-167` - `(*Logger).Level()` dereferences `l.atomicLevel` without the nil-safe `must()` pattern used elsewhere.

### High
- [code] `references/lib-commons/commons/log/go_logger.go:135`, `references/lib-commons/commons/log/go_logger.go:145` - `GoLogger` only sanitizes plain `string`, `error`, and `fmt.Stringer`; composite values passed through `log.Any(...)` can still emit raw newlines and forge multi-line entries.
- [code] `references/lib-commons/commons/zap/injector.go:114`, `references/lib-commons/commons/zap/injector.go:133`, `references/lib-commons/commons/zap/zap.go:44`, `references/lib-commons/commons/zap/zap.go:141` - console encoding permits raw newline messages and bypasses single-entry-per-line assumptions in non-JSON mode.
- [business] `references/lib-commons/commons/log/go_logger.go:135`, `references/lib-commons/commons/log/go_logger.go:145-155` - `GoLogger`’s injection protection is incomplete for non-string composite values.
- [security] `references/lib-commons/commons/log/go_logger.go:129`, `references/lib-commons/commons/log/go_logger.go:135`, `references/lib-commons/commons/log/go_logger.go:145` - stdlib logger never consults `commons/security` for key-based redaction, so sensitive fields are emitted verbatim.
- [security] `references/lib-commons/commons/zap/zap.go:45`, `references/lib-commons/commons/zap/zap.go:221`, `references/lib-commons/commons/zap/zap.go:224` - zap adapter converts all fields with unconditional `zap.Any` and performs no sensitive-field masking.
- [test] `references/lib-commons/commons/zap/zap_test.go:457` - `TestWithGroupNamespacesFields` never asserts the namespaced field structure.
- [test] `references/lib-commons/commons/zap/zap.go:107` - panic-recovery branch inside `Sync` is untested.
- [nil-safety] `references/lib-commons/commons/log/go_logger.go:149-152` - typed-nil `error` or `fmt.Stringer` values can panic when `sanitizeFieldValue` calls `Error()` / `String()`.
- [nil-safety] `references/lib-commons/commons/log/sanitizer.go:11-24` - `SafeError` only checks `logger == nil`, so a typed-nil `Logger` interface can still panic.
- [consequences] `references/lib-commons/commons/log/go_logger.go:135`, `references/lib-commons/commons/log/go_logger.go:145`, `references/lib-commons/commons/log/log.go:88` - backend swap does not preserve the same single-line hygiene for `Any` payloads containing nested strings.

### Medium
- [code] `references/lib-commons/commons/zap/zap.go:83`, `references/lib-commons/commons/log/go_logger.go:82` - `WithGroup("")` has backend-dependent semantics between stdlib and zap implementations.
- [business] `references/lib-commons/commons/zap/zap.go:83-87`, `references/lib-commons/commons/log/go_logger.go:74-84` - grouped logging behavior changes depending on the backend behind the same `commons/log.Logger` interface.
- [security] `references/lib-commons/commons/log/go_logger.go:135`, `references/lib-commons/commons/log/go_logger.go:145`, `references/lib-commons/commons/log/go_logger.go:154` - log-injection hardening is incomplete for composite values.
- [security] `references/lib-commons/commons/log/sanitizer.go:10`, `references/lib-commons/commons/log/sanitizer.go:23`, `references/lib-commons/commons/log/sanitizer.go:28` - `SafeError` depends on a caller-supplied `production` boolean, so one misuse can leak raw upstream error strings.
- [test] `references/lib-commons/commons/zap/zap_test.go:159`, `references/lib-commons/commons/zap/zap_test.go:182`, `references/lib-commons/commons/zap/zap_test.go:197`, `references/lib-commons/commons/zap/zap_test.go:209`, `references/lib-commons/commons/zap/zap_test.go:220`, `references/lib-commons/commons/zap/zap_test.go:231`, `references/lib-commons/commons/zap/zap_test.go:247`, `references/lib-commons/commons/zap/zap_test.go:265`, `references/lib-commons/commons/zap/zap_test.go:403`, `references/lib-commons/commons/zap/zap_test.go:404` - several tests silently discard returned errors.
- [test] `references/lib-commons/commons/log/sanitizer_test.go:35` - `TestSafeError_NilGuards` asserts only `NotPanics`.
- [test] `references/lib-commons/commons/security/sensitive_fields_test.go:435` - concurrent-access test proves only liveness, not correctness of returned values.
- [consequences] `references/lib-commons/commons/zap/zap.go:83`, `references/lib-commons/commons/zap/zap.go:221`, `references/lib-commons/commons/log/go_logger.go:82`, `references/lib-commons/commons/log/go_logger.go:130` - zap path forwards empty group names and empty field keys that stdlib path drops, creating schema drift for ingestion pipelines.
- [consequences] `references/lib-commons/commons/zap/zap.go:65`, `references/lib-commons/commons/log/go_logger.go:31`, `references/lib-commons/commons/log/log.go:48`, `references/lib-commons/commons/log/log.go:67` - unknown log levels diverge by backend: stdlib suppresses them while zap downgrades them to `info`.

### Low
- [code] `references/lib-commons/commons/zap/zap.go:56`, `references/lib-commons/commons/log/go_logger.go:31`, `references/lib-commons/commons/log/log.go:48` - unknown `log.Level` values behave inconsistently between implementations.
- [business] `references/lib-commons/commons/log/log.go:67-79` - `ParseLevel` lowercases input but does not trim surrounding whitespace.
- [security] `references/lib-commons/commons/security/sensitive_fields.go:12` - default sensitive-field catalog misses common PII keys like `email`, `phone`, and address-style fields.
- [test] `references/lib-commons/commons/log/log_test.go:120` - source-text scan test is brittle and implementation-coupled.
- [test] `references/lib-commons/commons/security/sensitive_fields_test.go:223` - exact field-count assertion makes list evolution noisy.
- [test] `references/lib-commons/commons/zap/injector_test.go:57` - constant-value assertion tests an implementation detail rather than observable behavior.
- [test] `references/lib-commons/commons/zap/zap_test.go:100` - `TestSyncReturnsErrorFromUnderlyingLogger` is misleadingly named because it asserts `NoError`.

## 8. Domain + Security Utilities

### Critical
- [nil-safety] `references/lib-commons/commons/license/manager.go:63` - `New(opts ...ManagerOption)` calls each option without guarding against nil function values.
- [nil-safety] `references/lib-commons/commons/jwt/jwt.go:258` - `Token.ValidateTimeClaims()` is a value-receiver method on `Token`, so calling it through a nil `*Token` panics before entering the body.
- [nil-safety] `references/lib-commons/commons/jwt/jwt.go:264` - `Token.ValidateTimeClaimsAt()` has the same nil-pointer panic surface.
- [nil-safety] `references/lib-commons/commons/crypto/crypto.go:120` - `Encrypt` only checks `c.Cipher == nil`, missing typed-nil `cipher.AEAD` values.
- [nil-safety] `references/lib-commons/commons/crypto/crypto.go:150` - `Decrypt` has the same typed-nil interface panic risk.
- [nil-safety] `references/lib-commons/commons/secretsmanager/m2m.go:127` - `GetM2MCredentials` only checks interface-nil client and can still panic on typed-nil implementations.
- [consequences] `references/lib-commons/commons/transaction/validations.go:263`, `references/lib-commons/commons/transaction/validations.go:268`, `references/lib-commons/commons/transaction/validations.go:209`, `references/lib-commons/commons/transaction/validations.go:219` - planner/applicator contract is internally broken for pending destination cancellations, which resolve to a debit that `applyDebit` rejects for `StatusCanceled`.

### High
- [code] `references/lib-commons/commons/jwt/jwt.go:274` - token expiry check uses `now.After(exp)`, so a token is still valid at the exact expiration instant.
- [code] `references/lib-commons/commons/transaction/validations.go:77` - `ValidateBalanceEligibility` never compares `posting.Amount` with source balance availability / hold state.
- [code] `references/lib-commons/commons/secretsmanager/m2m.go:131`, `references/lib-commons/commons/secretsmanager/m2m.go:198` - path segment validation checks only emptiness, so embedded `/` lets callers escape the intended secret namespace.
- [business] `references/lib-commons/commons/jwt/jwt.go:273-276` - `exp` semantics are off by one at the exact expiry instant.
- [business] `references/lib-commons/commons/transaction/validations.go:71-94`, `references/lib-commons/commons/transaction/validations.go:241-248` - balance eligibility never checks whether sources can actually cover the posting amount, so preflight validation can succeed and `ApplyPosting` can still fail for insufficient funds.
- [business] `references/lib-commons/commons/secretsmanager/m2m.go:131-145`, `references/lib-commons/commons/secretsmanager/m2m.go:192-199` - secret path segments are concatenated without trimming or rejecting embedded `/`.
- [security] `references/lib-commons/commons/secretsmanager/m2m.go:131-145`, `references/lib-commons/commons/secretsmanager/m2m.go:192-198` - path traversal through secret path building can retrieve the wrong tenant/service secret.
- [security] `references/lib-commons/commons/license/manager.go:35-40`, `references/lib-commons/commons/license/manager.go:57-60`, `references/lib-commons/commons/license/manager.go:87-112` - default license-failure behavior is fail-open; `DefaultHandler` only records an assertion and does not stop execution.
- [security] `references/lib-commons/commons/transaction/validations.go:72-121`, `references/lib-commons/commons/transaction/validations.go:146-167`, `references/lib-commons/commons/transaction/transaction.go:109-126` - transaction validation never checks `OrganizationID` or `LedgerID`, so callers can assemble postings across unrelated ledgers/tenants as long as asset and allow flags match.
- [test] `references/lib-commons/commons/jwt/jwt.go:110`, `references/lib-commons/commons/jwt/jwt.go:116` - `ParseAndValidate` has no direct integration test locking down combined parse + time-claim behavior.
- [test] `references/lib-commons/commons/crypto/crypto.go:172`, `references/lib-commons/commons/crypto/crypto_test.go:230`, `references/lib-commons/commons/crypto/crypto_test.go:304` - `Decrypt` auth-failure path is not tested with tampered ciphertext or wrong key.
- [test] `references/lib-commons/commons/secretsmanager/m2m.go:131`, `references/lib-commons/commons/secretsmanager/m2m.go:135`, `references/lib-commons/commons/secretsmanager/m2m.go:139`, `references/lib-commons/commons/secretsmanager/m2m_test.go:393` - input-validation tests cover empty strings only, not whitespace-only values.
- [consequences] `references/lib-commons/commons/transaction/validations.go:96`, `references/lib-commons/commons/transaction/validations.go:106`, `references/lib-commons/commons/transaction/validations.go:110`, `references/lib-commons/commons/transaction/validations.go:115`, `references/lib-commons/commons/transaction/validations.go:263`, `references/lib-commons/commons/transaction/validations.go:268` - destination validation is hard-coded as receiver-only even when canceled pending destinations are debits.
- [consequences] `references/lib-commons/commons/transaction/validations.go:77`, `references/lib-commons/commons/transaction/validations.go:87`, `references/lib-commons/commons/transaction/validations.go:124`, `references/lib-commons/commons/transaction/validations.go:141`, `references/lib-commons/commons/transaction/validations.go:242`, `references/lib-commons/commons/transaction/validations.go:247` - `ValidateBalanceEligibility` and `ApplyPosting` disagree on liquidity requirements, increasing late-stage failure risk.
- [consequences] `references/lib-commons/commons/license/manager.go:82`, `references/lib-commons/commons/license/manager.go:87`, `references/lib-commons/commons/license/manager.go:101`, `references/lib-commons/commons/license/manager.go:108` - `Terminate` can fail open on nil or zero-value managers and has no error channel.

### Medium
- [code] `references/lib-commons/commons/transaction/validations.go:78`, `references/lib-commons/commons/transaction/validations.go:97` - balance eligibility lookup is keyed only by `BalanceID` and does not verify that resolved balances belong to the posting target account.
- [code] `references/lib-commons/commons/crypto/crypto.go:75`, `references/lib-commons/commons/crypto/crypto.go:109` - `InitializeCipher` accepts 16/24/32-byte AES keys, but docs describe encryption as requiring a 32-byte key.
- [code] `references/lib-commons/commons/secretsmanager/m2m.go:156`, `references/lib-commons/commons/secretsmanager/m2m.go:164` - nil/binary/non-string secret payloads are misclassified as JSON unmarshal failures.
- [code] `references/lib-commons/commons/license/manager.go:117`, `references/lib-commons/commons/license/manager.go:123` - `TerminateWithError` docs promise `ErrLicenseValidationFailed` regardless of initialization state, but nil receiver returns `ErrManagerNotInitialized`.
- [business] `references/lib-commons/commons/transaction/validations.go:77-80`, `references/lib-commons/commons/transaction/validations.go:96-99`, `references/lib-commons/commons/transaction/validations.go:151-157` - ownership validation is skipped during eligibility precheck, so it can approve a plan that later fails in `ApplyPosting`.
- [business] `references/lib-commons/commons/secretsmanager/m2m.go:156-166` - binary secrets are treated as malformed JSON instead of unsupported/alternate-format secrets.
- [security] `references/lib-commons/commons/jwt/jwt.go:272-289`, `references/lib-commons/commons/jwt/jwt.go:304-321` - malformed `exp`, `nbf`, or `iat` values fail open because unsupported types/parse errors simply skip validation.
- [security] `references/lib-commons/commons/jwt/jwt.go:69-103`, `references/lib-commons/commons/jwt/jwt.go:196-226`, `references/lib-commons/commons/crypto/crypto.go:62-73` - cryptographic operations accept empty secrets and turn misconfiguration into weak-but-valid auth/signing behavior.
- [security] `references/lib-commons/commons/secretsmanager/m2m.go:165`, `references/lib-commons/commons/secretsmanager/m2m.go:179`, `references/lib-commons/commons/secretsmanager/m2m.go:205-216` - returned errors include the full secret path and leak tenant/service naming metadata.
- [test] `references/lib-commons/commons/crypto/crypto.go:62`, `references/lib-commons/commons/crypto/crypto_test.go:32`, `references/lib-commons/commons/crypto/crypto_test.go:73` - `GenerateHash` lacks known-vector assertions and only checks length/consistency.
- [test] `references/lib-commons/commons/transaction/transaction_test.go:786`, `references/lib-commons/commons/transaction/transaction_test.go:796`, `references/lib-commons/commons/transaction/transaction_test.go:809`, `references/lib-commons/commons/transaction/transaction_test.go:817`, `references/lib-commons/commons/transaction/transaction_test.go:826`, `references/lib-commons/commons/transaction/transaction_test.go:845`, `references/lib-commons/commons/transaction/transaction_test.go:854`, `references/lib-commons/commons/transaction/transaction_test.go:866` - several tests ignore `decimal.NewFromString` errors during setup.
- [test] `references/lib-commons/commons/jwt/jwt.go:274`, `references/lib-commons/commons/jwt/jwt.go:280`, `references/lib-commons/commons/jwt/jwt.go:286`, `references/lib-commons/commons/jwt/jwt_test.go:316`, `references/lib-commons/commons/jwt/jwt_test.go:331` - exact equality boundaries for `exp == now`, `nbf == now`, `iat == now` are not tested.
- [consequences] `references/lib-commons/commons/license/manager.go:117`, `references/lib-commons/commons/license/manager.go:118`, `references/lib-commons/commons/license/manager.go:122`, `references/lib-commons/commons/license/manager.go:124` - nil-receiver `TerminateWithError` does not satisfy the documented `errors.Is(err, ErrLicenseValidationFailed)` contract.
- [consequences] `references/lib-commons/commons/jwt/jwt.go:272`, `references/lib-commons/commons/jwt/jwt.go:300`, `references/lib-commons/commons/jwt/jwt.go:310`, `references/lib-commons/commons/jwt/jwt.go:320` - exported time-claim validators only recognize `float64` and `json.Number`, so `int` / `int64` claims in in-memory `MapClaims` are silently skipped.

### Low
- [code] `references/lib-commons/commons/crypto/crypto.go:62` - `GenerateHash` silently returns `""` for nil receiver/input instead of failing loudly like the rest of the type.
- [security] `references/lib-commons/commons/license/manager.go:127-133`, `references/lib-commons/commons/license/manager.go:153-158` - warning logs include raw `reason` strings and can leak customer/license details.
- [test] `references/lib-commons/commons/license/manager_test.go:94` - uninitialized-manager test only asserts no panic, not observable outcome.
- [consequences] `references/lib-commons/commons/transaction/validations.go:298`, `references/lib-commons/commons/transaction/validations.go:317`, `references/lib-commons/commons/transaction/validations.go:354` - allocation field paths omit whether the failing side was source or destination.

## 9. Shared Primitives + Constants

### Critical
- [nil-safety] `references/lib-commons/commons/os.go:104`, `references/lib-commons/commons/os.go:106`, `references/lib-commons/commons/os.go:111`, `references/lib-commons/commons/os.go:117` - `SetConfigFromEnvVars` can panic on nil interface, typed-nil pointer, or pointer-to-non-struct instead of returning an error.
- [nil-safety] `references/lib-commons/commons/context.go:46`, `references/lib-commons/commons/utils.go:192`, `references/lib-commons/commons/utils.go:211` - `NewLoggerFromContext` calls `ctx.Value(...)` without guarding `ctx == nil`, so nil contexts can panic directly or via `GetCPUUsage` / `GetMemUsage`.
- [nil-safety] `references/lib-commons/commons/app.go:43`, `references/lib-commons/commons/app.go:44` - `WithLogger` option blindly assigns through `l.Logger`, so invoking it with a nil launcher panics.
- [nil-safety] `references/lib-commons/commons/app.go:52`, `references/lib-commons/commons/app.go:53`, `references/lib-commons/commons/app.go:55` - `RunApp` option appends to launcher state through a nil receiver and can panic.
- [consequences] `references/lib-commons/commons/cron/cron.go:50`, `references/lib-commons/commons/cron/cron.go:121` - package advertises standard 5-field cron but enforces day-of-month and day-of-week with AND instead of OR, so imported schedules can silently run far less often or never.

### High
- [code] `references/lib-commons/commons/cron/cron.go:121` - standard day-of-month/day-of-week cron semantics are implemented as AND, not OR.
- [code] `references/lib-commons/commons/cron/cron.go:113` - `Next` hard-limits its search to 366 days, so valid sparse schedules like leap-day jobs can return `ErrNoMatch`.
- [code] `references/lib-commons/commons/errors.go:35`, `references/lib-commons/commons/errors.go:73` - `ValidateBusinessError` uses exact error identity instead of `errors.Is`, so wrapped sentinels bypass mapping.
- [code] `references/lib-commons/commons/os.go:79`, `references/lib-commons/commons/os.go:97` - `InitLocalEnvConfig` returns `nil` outside `ENV_NAME=local`.
- [code] `references/lib-commons/commons/utils.go:191`, `references/lib-commons/commons/utils.go:204`, `references/lib-commons/commons/utils.go:210`, `references/lib-commons/commons/utils.go:222` - `GetCPUUsage` and `GetMemUsage` dereference `factory` unconditionally.
- [business] `references/lib-commons/commons/context.go:144`, `references/lib-commons/commons/context.go:191` - `NewTrackingFromContext` generates a fresh UUID whenever `HeaderID` is absent, so two extractions from the same request context can yield different correlation IDs.
- [business] `references/lib-commons/commons/errors.go:35` - wrapped business errors leak through untranslated because mapping is not `errors.Is`-aware.
- [business] `references/lib-commons/commons/os.go:72` - DI/provider-style `InitLocalEnvConfig` returns `nil` outside local runs.
- [business] `references/lib-commons/commons/cron/cron.go:121` - cron `0 0 1 * 1` will run only when the 1st is Monday, not on either condition.
- [business] `references/lib-commons/commons/cron/cron.go:113` - leap-day schedules can return `ErrNoMatch` even though they are valid.
- [test] `references/lib-commons/commons/utils.go:181`, `references/lib-commons/commons/utils.go:191`, `references/lib-commons/commons/utils.go:210` - `Syscmd.ExecCmd`, `GetCPUUsage`, and `GetMemUsage` have no test coverage.
- [consequences] `references/lib-commons/commons/cron/cron.go:32`, `references/lib-commons/commons/cron/cron.go:85` - rejecting day-of-week `7` breaks compatibility with many cron producers.
- [consequences] `references/lib-commons/commons/cron/cron.go:113` - sparse but valid schedules can be misclassified as no-match.
- [consequences] `references/lib-commons/commons/errors.go:35`, `references/lib-commons/commons/errors.go:73` - wrapped sentinels stop yielding structured business errors to downstream HTTP/API consumers.
- [consequences] `references/lib-commons/commons/os.go:79`, `references/lib-commons/commons/os.go:97` - DI consumers can receive nil `*LocalEnvConfig` and fail at startup or first dereference.
- [consequences] `references/lib-commons/commons/utils.go:191`, `references/lib-commons/commons/utils.go:210` - optional metrics dependencies become panic paths instead of safe degradation.

### Medium
- [code] `references/lib-commons/commons/os.go:104`, `references/lib-commons/commons/os.go:106`, `references/lib-commons/commons/os.go:117` - `SetConfigFromEnvVars` assumes a non-nil pointer to a struct and is fragile for callers.
- [code] `references/lib-commons/commons/utils.go:63` - `SafeIntToUint64` converts negative inputs to `1`, which is a surprising semantic default.
- [code] `references/lib-commons/commons/stringUtils.go:19`, `references/lib-commons/commons/stringUtils.go:181` - `ValidateServerAddress` does not validate port range and rejects valid IPv6 host:port forms.
- [security] `references/lib-commons/commons/os.go:32-56`, `references/lib-commons/commons/os.go:119-126` - malformed env vars silently fall back to `false` / `0` and can quietly disable protections.
- [security] `references/lib-commons/commons/errors.go:79-85` - `ValidateBusinessError` appends raw `args` into externally returned business error messages.
- [security] `references/lib-commons/commons/utils.go:180-187` - `Syscmd.ExecCmd` exposes an arbitrary process execution primitive with no allowlist or validation.
- [test] `references/lib-commons/commons/context_test.go:58`, `references/lib-commons/commons/context_test.go:80` - time-based assertions around `time.Until(...)` are scheduler-sensitive.
- [test] `references/lib-commons/commons/os.go:72`, `references/lib-commons/commons/os_test.go:192` - `ENV_NAME=local` branches and `sync.Once` behavior are untested.
- [test] `references/lib-commons/commons/context.go:76`, `references/lib-commons/commons/context.go:90`, `references/lib-commons/commons/context.go:104`, `references/lib-commons/commons/context.go:118`, `references/lib-commons/commons/context.go:280` - nil-safe branches for several context helpers are not covered.
- [test] `references/lib-commons/commons/cron/cron.go:233` - malformed range parsing is only partially exercised.
- [nil-safety] `references/lib-commons/commons/context.go:247`, `references/lib-commons/commons/context.go:249` - `ContextWithSpanAttributes(nil)` with no attrs returns nil instead of normalizing to `context.Background()`.
- [consequences] `references/lib-commons/commons/os.go:104`, `references/lib-commons/commons/os.go:117` - configuration mistakes become panics in bootstrap/DI code paths.
- [consequences] `references/lib-commons/commons/context.go:247` - nil context can leak downstream when no attributes are provided.

### Low
- [code] `references/lib-commons/commons/app.go:71` - `Add` docstring says it runs an application in a goroutine, but it only registers the app.
- [code] `references/lib-commons/commons/app.go:108`, `references/lib-commons/commons/app.go:118` - `Run` / `RunWithError` comments describe behavior that the implementation cannot provide when logger is nil.
- [security] `references/lib-commons/commons/context.go:244-260` - `ContextWithSpanAttributes` accepts arbitrary request-wide span attributes with no filtering.
- [test] `references/lib-commons/commons/pointers/pointers_test.go:42` - `Float64()` lacks a direct unit test.
- [test] `references/lib-commons/commons/app.go:110` - `Run()` wrapper itself is untested; coverage only hits `RunWithError()`.
- [test] `references/lib-commons/commons/pointers/pointers.go:26` - `Float64()` is the only exported pointer helper without a corresponding test.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use repository-relative file paths for all findings.

Most entries reference references/lib-commons/..., which is hard to navigate in this repo and breaks direct linking from code-review tooling. Normalize paths to actual repo-relative locations (for example, commons/...) so each item is immediately traceable and fixable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@REVIEW.md` around lines 8 - 388, The review file uses non-repo-relative paths
like references/lib-commons/... which are hard to navigate; update all findings
in REVIEW.md to use repository-relative paths (e.g. commons/..., net/http/...,
opentelemetry/..., tenant-manager/...) so code-review tooling links resolve
directly. Locate and replace the repeated prefix "references/lib-commons/"
across the document (search for that exact token and the listed occurrences such
as commons/opentelemetry/otel.go, commons/net/http/withTelemetry.go,
commons/tenant-manager/middleware/tenant.go, etc.), normalize any path
formatting/commas/line-wrapped lists to valid repo-relative file paths, and
add/adjust any failing links or anchors; optionally add a small validation (CI
lint) that REVIEW.md paths are repo-relative to prevent regressions.

jeffersonrodrigues92 and others added 3 commits March 21, 2026 16:17
…dation (#376)

Ports revalidation logic from tmpostgres.Manager to tmmongo.Manager. Periodically checks tenant config and evicts cached connections for suspended/purged tenants. Default interval: 30s. Includes 11 new tests.

X-Lerian-Ref: 0x1
…tale check, goleak

1. Register revalidation goroutine in WaitGroup before releasing mutex (race fix). 2. Use bounded context for CloseConnection in eviction (prevents hang). 3. Check connection identity before revalidation (stale connection fix). 4. Tests use GetConnection instead of calling revalidatePoolSettings directly. 5. Added goleak verification to detect goroutine leaks.

X-Lerian-Ref: 0x1
…idation

feat(tmmongo): add WithSettingsCheckInterval for tenant config revalidation (#376)
jeffersonrodrigues92 and others added 2 commits March 21, 2026 16:53
Extracts normalizeEndpoint, handleEmptyEndpoint, and initExporters helpers. No behavior change.

X-Lerian-Ref: 0x1
…y-complexity

refactor(otel): reduce NewTelemetry cyclomatic complexity from 20 to ≤16
jeffersonrodrigues92 and others added 2 commits March 21, 2026 17:54
Revalidation was reading from the 1h in-memory cache instead of making a fresh HTTP request. Added WithSkipCache() to detect 403 (tenant suspended/purged) promptly.

X-Lerian-Ref: 0x1
fix: revalidatePoolSettings bypasses client cache with WithSkipCache
The OTEL SDK internally reads OTEL_EXPORTER_OTLP_*_ENDPOINT env vars
via url.Parse(), which fails on bare "host:port" without a scheme,
producing noisy "parse url" errors in the SDK's internal logger.

normalizeEndpointEnvVars() runs before exporter creation and prepends
"http://" to any env var missing a scheme, matching the existing
normalizeEndpoint() behavior for the programmatic config path.
@jeffersonrodrigues92 jeffersonrodrigues92 self-requested a review March 21, 2026 21:07
…-env-vars

fix(otel): normalize OTEL endpoint env vars to prevent SDK parse errors
@ClaraTersi ClaraTersi merged commit e8bde1a into main Mar 21, 2026
4 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.

7 participants