Skip to content

v1.0.0: Public API, Observability, Testing & DX#58

Merged
FumingPower3925 merged 8 commits intomainfrom
v1.0.0
Mar 12, 2026
Merged

v1.0.0: Public API, Observability, Testing & DX#58
FumingPower3925 merged 8 commits intomainfrom
v1.0.0

Conversation

@FumingPower3925
Copy link
Copy Markdown
Contributor

@FumingPower3925 FumingPower3925 commented Mar 11, 2026

Summary

Complete v1.0.0 release implementing the full public API surface, observability layer, comprehensive test suite, and developer experience features.

Engine & Protocol

  • Add Engine.Addr() to interface for port discovery
  • H2 request body size cap (100MB) with RST_STREAM on overflow
  • Adaptive engine: remove redundant addrEngine interface

Public API (celeris package)

  • Server: New(), Start(), Shutdown(), Routes(), URL(), URLMap(), NotFound(), MethodNotAllowed()
  • Context: Full request/response API — Param/ParamInt/ParamInt64, Query/QueryDefault/QueryInt, Header/SetHeader, Cookie/SetCookie, ClientIP(), Scheme(), BasicAuth(), form handling (FormValue/FormValues/FormFile/MultipartForm/FormValueOk), response methods (String/JSON/XML/HTML/Blob/File/FileFromDir/Stream/Redirect/NoContent), Get/Set/Keys store, error-returning HandlerFunc
  • Router: Radix trie with :param and *catchAll, named routes, 405 detection, double-slash normalization, route validation
  • Config: Objective typed enum, ShutdownTimeout, MaxFormSize
  • Bridge: Adapt(http.Handler), AdaptFunc(http.HandlerFunc) with 100MB buffer cap and content-length validation
  • RouteGroup: Group(), Use(), HTTP method registration

Observability

  • Lock-free Collector with latency histogram via atomic.Int64
  • Snapshot struct for point-in-time metrics

Testing & DX

  • celeristest package: NewContext/NewContextT, ResponseRecorder, functional options
  • Comprehensive unit tests: Context, Router edge cases, Server, Bridge, Collector
  • Benchmarks and example tests
  • FileFromDir() with path traversal protection

Build & Community

  • CI updated for Go 1.26 and new package structure
  • Magefile migration
  • CONTRIBUTING.md, SECURITY.md, issue/PR templates

Closes

Test plan

  • All existing tests pass (go test ./...)
  • New celeristest package tests pass
  • Router edge case tests (catchall dedup, trailing slash, param/catchall at root)
  • Context method tests (ParamInt, QueryDefault, HTML, FileFromDir traversal, Scheme)
  • Server URLMap test
  • Bridge tests
  • Collector tests
  • Security review — no findings

- Add Engine.Addr() to interface for bound listener address discovery
- Remove redundant addrEngine interface from adaptive engine
- Add H2 HEAD response body suppression in conn/response.go (RFC 9110 §9.3.2)
- Add H2 request body size cap (100MB) with RST_STREAM on overflow
Core public API surface for the v1.0.0 release:

- Server: New, Start, StartWithContext, Shutdown, Addr, Use, Group,
  Routes, URL, URLMap, NotFound, MethodNotAllowed, Collector, EngineInfo
- Context: request introspection (Method, Path, Param, ParamInt, ParamInt64,
  Query, QueryDefault, QueryInt, Header, Body, Cookie, BasicAuth, Scheme,
  ClientIP, FormValue, FormValueOk, FormFile, Keys), response writing
  (JSON, XML, HTML, String, Blob, NoContent, Redirect, File, FileFromDir,
  Stream, SetCookie), middleware flow (Next, Abort, AbortWithStatus),
  context values (Set, Get, Context, SetContext)
- Config: Addr, Protocol, Engine, Workers, Objective, timeouts,
  MaxFormSize, ShutdownTimeout, Logger
- Router: radix trie with :param and *catchAll, static priority,
  405 detection, named routes, double-slash normalization, catchall dedup
- RouteGroup: prefix-based grouping with inherited middleware
- Bridge: Adapt/AdaptFunc for net/http Handler compatibility (100MB cap)
- HandlerFunc: func(*Context) error with error-returning middleware chain
- Engine factories: engine_linux.go (all 4 engines), engine_other.go (std)
- internal/ctxkit: hook variables for cross-package context access
- Collector: lock-free request/error/connection counters via atomic ops
- Snapshot: point-in-time copy with latency histogram (10 buckets)
- SetEngineMetricsFn: deferred engine metrics callback
- Remove Prometheus, debug, and Observer from observe/ (moved to middlewares)
…, server, bridge, benchmarks

Add celeristest/ package with NewContext/NewContextT, ResponseRecorder, and
functional options (WithBody, WithHeader, WithQuery, WithParam, WithContentType).

Add unit tests for Context (ParamInt, QueryDefault, HTML, FormValueOk,
FileFromDir traversal, Keys, Scheme), Router edge cases (catchall dedup,
trailing slash, param/catchall at root), Server (URLMap), Bridge, and
observability Collector. Add benchmarks and example tests.
Update CI workflow for Go 1.26 and new package structure.
Migrate magefile from mage.go to magefile.go.
Update go.mod dependencies.
Add CONTRIBUTING.md, SECURITY.md, issue templates, and PR template.
Update README for v1.0.0 public API.
@FumingPower3925 FumingPower3925 self-assigned this Mar 11, 2026
…lders

- Fix MaxFormSize=-1 silently ignored (handler.go: != 0, context.go: map -1 → MaxInt64)
- Remove dead queryCache nil check in Query() (url.ParseQuery never returns nil)
- Add ErrDuplicateRouteName sentinel and Route.TryName() error variant of Name()
- Add Config.DisableMetrics to opt out of built-in metrics collector
- Extract shared buildURL() helper, refactor URL() and URLMap() as wrappers
- Document streaming buffered limitation in doc.go
@FumingPower3925 FumingPower3925 merged commit 2edfc42 into main Mar 12, 2026
10 checks passed
@FumingPower3925 FumingPower3925 deleted the v1.0.0 branch March 12, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment