Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 23 Oct 23:02
· 34 commits to main since this release

Added

  • AUTH_LIMIT_STORE=database keeps the login, registration and password change rate limiter in a new auth_rate_limits table, so every replica shares the counters and they survive restarts. Keys are hashed, IPv6 clients are counted per /64, expired rows are cleaned up every minute and the table is bounded under floods. Existing projects get the table through a new migration. In workspaces the gateway asks the account service through the new AuthService.HitRateLimit and ResetRateLimit calls. The default stays memory.
  • Kubernetes manifests: every build writes a kustomize base in deploy/kubernetes/base for the monolith or for every service and the gateway of a workspace (Deployments with startup, liveness and readiness probes on /livez and /readyz, resource requests and limits, non-root read-only containers without service account tokens, Services, PodDisruptionBudgets, generated ConfigMaps, migration Jobs, and Secrets referenced by name only), plus a user-owned overlay in deploy/kubernetes/overlays/production for images, namespace and patches. The base files carry the generated header, so codebuild plan reports edits as conflicts and removed services as stale. A workflow deploys a monolith and a workspace to a kind cluster.
  • gRPC clients in workspaces retry Get, List…, Exists, Authenticate and Me when a backend is unavailable, with jittered exponential backoff inside the call deadline, and open a circuit breaker per backend after repeated failures. GRPC_CALL_TIMEOUT, GRPC_RETRY_ATTEMPTS, GRPC_RETRY_BACKOFF, GRPC_BREAKER_FAILURES and GRPC_BREAKER_COOLDOWN configure them, and /metrics exports retries and breaker state per backend.
  • Services and the gateway reload TLS_CA_FILE, TLS_CERT_FILE and TLS_KEY_FILE every 30 seconds, so certificates from your own PKI (for example cert-manager Secrets) rotate without a restart. A broken file keeps the last working certificate.
  • A load test (CODEBUILD_E2E_LOAD=1, and a manual Load test workflow) measures throughput, latency percentiles and errors of the generated API on PostgreSQL; docs/production.md records the results.
  • docs/production.md: TLS and proxies, secrets and key rotation, backups, migrations in deployments, pool sizing, timeouts, CORS, health checks, metrics, traces and alerts, rate limits, Kubernetes and the remaining limits.
  • AUTH_JWT_CONFIRM=true makes a monolith check every JWT access token against the database on every route, so logout and revocation take effect immediately everywhere. The default stays false.
  • OpenAPI 3.1: every build writes openapi.json at the project root, built from the same views as the handlers (routes, request and response bodies with their validation rules, filters, cursor and offset pagination, problem responses, security and roles), and the API, or the gateway in a workspace, serves it at GET /openapi.json. A test checks that every served route is documented and the reverse. The file opens with an x-codebuild member that marks it as generated.
  • Cursor pagination: every list response carries nextCursor, and ?cursor= returns the rows after it without a COUNT(*), using the list order as the key, so it stays fast on large tables and correct while rows are added. Offset pagination works as before. In workspaces the gateway forwards the cursor and the contracts gain cursor and next_cursor fields; existing field numbers do not change.
  • Database spans: with tracing enabled, every query of the generated repositories and account code is a child span of its request, following the OpenTelemetry database conventions, without parameter values. database.Traced wraps your own *sql.DB or *sql.Tx the same way.

Changed

  • Microservice workspaces are no longer experimental; docs/microservices.md addresses or justifies each of their limits.
  • In workspaces grpcx.Dial takes a CallPolicy (grpcx.LoadCallPolicy reads it from the environment) and grpcx.TLSConfig must come from grpcx.LoadTLSConfig. The generated internal/app code already does both; main.go files written by earlier versions keep compiling.
  • Lists are backed by indexes in their order: lx_<table> on the creation time and the primary key, and lx_<table>_<column> on each reference followed by them, so first pages, cursor pages and the lists of one parent or owner read rows in order instead of sorting the table. Cursor queries add a range bound the planner can use. Existing projects get the indexes through a new migration.
  • auth.Limiter takes a scope and a LimitStore and its Allow and Reset take a context; NewAuthHandler takes the store. Both live in generated files, so this only matters to code of yours that used the limiter directly.
  • Page.Total is an *int64, nil on cursor pages, and Page has a NextCursor *string; ListParams has a Cursor *Cursor. Code of yours that reads Total needs a dereference. In workspace contracts total is now optional.
  • Generated SQLite projects use modernc.org/sqlite v1.61.0.

Fixed

  • naming.Snake and the names derived from it no longer change when applied twice to a name with a capital letter that has no lowercase form, such as ϒ. Found by the weekly fuzz run.

Security

  • Changing the password through PUT /auth/password also deletes every API key of the account, like accounts set-password and accounts revoke already did.
  • JWT: logout, accounts revoke, a password change or reuse detection that ran while a refresh of the same family was committing could leave the refresh token issued by that refresh alive on PostgreSQL. Revocation now repeats its delete until no row is left, and a generated test reproduces the race.