v0.2.0
[0.2.0] - 2026-09-17
Highlights
- PostgreSQL Distributed Idempotency Store (
idempotency/postgres.gowithdb.DBTX): High-performance, production-ready distributed idempotency store using two-phase atomic locking (LockandSave) over anydb.DBTXconnection pool or transaction. Features automatic lock expiration recovery, status conflict detection, SHA-256 payload fingerprint validation, and configurable lock/response TTLs. - PostgreSQL Atomic Distributed Rate Limiter (
db/ratelimit.go): Clustered, atomic sliding-window rate limiter powered by PostgreSQL CTE queries overdb.DBTX. Synchronizes request counters across multi-pod deployments without Redis or external infrastructure. - Decoupled Universal
net/httpStandard Middleware: Universal middleware implementations adhering strictly to standard Gofunc(http.Handler) http.Handlersignatures:httputil.CORS: Flexible CORS handling with credential support, exposed headers, configurable max age, and wildcard/origin validation.telemetry.Middleware: W3C distributed tracing extraction and automatic OpenTelemetry span instrumentation.logger.Middleware: Structured access logging using standard librarylog/slogwith latency tracking, status capture, and request ID correlation.idempotency.Middleware: End-to-end HTTP idempotency filter with in-memory or PostgreSQL stores, automatic payload caching, concurrent in-progress 409 Conflict handling, and replay headers.
- Pruning Standard Library Duplication from
sliceutil&maputil: Pruned redundant wrapper functions (sliceutil.Map,sliceutil.Filter,maputil.Keys,maputil.Values) in favor of idiomatic Go loops and standard library packages (slices,maps). Stabilized and expanded high-value algorithmic extensions:sliceutil.Chunk,sliceutil.GroupBy,sliceutil.Unique,sliceutil.Flatten,sliceutil.Reduce, andmaputil.Merge. - Reference Microservice (
examples/microservice) Updates: Enhanced reference implementation demonstrating production best practices, item batching viasliceutil.Chunk, clean loops, and composition of operational primitives.
Compatibility Notice
Clean-slate architecture: No backward compatibility preserved. Legacy deprecated interfaces and backwards-compatibility shims have been dropped, as no external developers or downstream production systems are actively consuming pre-release revisions.
Added
- idempotency: PostgreSQL Distributed Idempotency Store (
PGStore,NewPGStore,WithPGLockTTL,WithPGResponseTTL,WithPGTableName) backed bydb.DBTXfor distributed two-phase atomic locking, conflict mitigation, and crash recovery. - idempotency: Universal
net/httpstandard idempotency middleware (Middleware,MiddlewareOptions,MiddlewareOption,WithHeaderName,WithEnforceHeader,WithIgnoredMethods,WithStatusCodeMatcher). - db: PostgreSQL Atomic Distributed Rate Limiter (
PGRateLimiter,NewPGRateLimiter,WithPGRateLimiterTableName,WithPGRateLimiterTimeout) implementing sliding window rate limiting viaDBTX. - httputil: Decoupled universal
net/httpstandard CORS middleware (CORS,CORSConfig,DefaultCORSConfig). - telemetry: Decoupled universal
net/httpstandard OpenTelemetry tracing middleware (Middleware,MiddlewareOption,WithPropagator). - logger: Decoupled universal
net/httpstandard structured logging middleware (Middleware,MiddlewareOption,WithLogger,WithRequestIDHeader,WithExtraAttributes).
Changed
sliceutil: Pruned redundant standard library duplication (Map,Filter) in favor of idiomatic Go loops and standardslices; expanded and stabilized algorithmic utilities:Chunk,GroupBy,Unique,Flatten,Reduce,First.maputil: Pruned redundant standard library duplication (Keys,Values) in favor of standardmaps; retained zero-dependency extensions:Merge,Filter.examples/microservice: Updated reference microservice showcasingsliceutil.Chunkfor item batch processing, clean standard filtering loops, and universal middleware composition.securityheaders: Transitionedsecurityheaders.New(cfg Config)to functional optionssecurityheaders.New(opts ...Option)withWithServerName,WithHSTSMaxAge,WithCSP,WithPermissionsPolicy.telemetry: Transitionedtelemetry.NewTracerProvider(cfg Config)to functional optionstelemetry.NewTracerProvider(opts ...Option)withWithServiceName,WithServiceVersion,WithEnvironment,WithSampleRate.cryptoutil:ComparePasswordwraps malformed password hashes with sentinelErrInvalidHash.ginmw:Idempotencylogs store errors duringLock,Unlock, andSaveoperations.
Removed (BREAKING)
sliceutil: Removed redundant wrappersMapandFilter.maputil: Removed redundant wrappersKeysandValues.circuitbreaker: Removed redundant type aliasCircuitBreakerand deprecatedNew(...)constructor; useConsecutiveBreakerandNewConsecutiveBreaker(...)instead.cache: Removed redundantNewTTL[T]constructor; useNewTypedCache[T]instead.httpclient: Removed redundantWithTimeoutalias; useWithTotalTimeoutinstead.ratelimit: Removed unexported pass-through wrappersrealIP,isTrusted,extractIP,parseTrustedProxies.
Fixed
cache,circuitbreaker,ratelimit: Added lazy initialization guards toTypedCache,ConsecutiveBreaker,RatioBreaker,TokenBucketLimiter, andSlidingWindowLimitersovar x T{}zero-values execute safely without panicking.- Dependencies: Bumped
golang.org/x/cryptofromv0.55.0tov0.56.0to eliminate CVEsGO-2026-6354andGO-2026-6355.
Security
- Workflows: Pinned all GitHub Actions to immutable 40-character commit SHAs.
- Containers: Pinned base container images in
examples/microservice/Dockerfileto immutable@sha256:digests. - Least Privilege: Set top-level
permissions: read-allacross all GitHub Actions workflows. - SAST: Added automated GitHub CodeQL analysis workflow for continuous static application security testing.