Skip to content

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 24 Oct 03:57
· 23 commits to main since this release

Added

  • Idempotency-Key on creates: a client that repeats a POST with the same key and body within 24 hours, because it lost the answer to a timeout or a dropped connection, gets the first answer back with Idempotent-Replayed: true instead of a second resource. The same key with another body answers 422, and while the first request still runs, 409. Only successful answers are kept, so a client can fix a rejected request and retry with the same key. Answers live in a new idempotency_keys table of every database, which existing projects get through a new migration, scoped by caller and route and cleaned up in the background. In workspaces the gateway forwards the key and each service keeps the answers of its own creates. The OpenAPI description documents the header.

  • gRPC clients in workspaces balance their calls round robin over every address a backend name resolves to, skipping replicas they cannot reach; the generated Kubernetes Services of the services are headless, so that is every ready replica. A replica that shuts down serves through SHUTDOWN_DELAY and then sends its clients away, so rolling updates do not fail calls. Clients ping idle connections every 30 seconds, reconnect within 5 seconds and resolve a backend again at most every 2 seconds instead of 30 when a replica goes away, and servers end connections after five minutes, so clients find new replicas and rotated certificates, with a 30-second grace for running calls. Servers bound concurrent streams, handshakes and message sizes; GRPC_MAX_MESSAGE_BYTES raises the 4 MiB limit for large pages.

  • auth.WatchPrivateKey and auth.WatchPublicKeys reread the internal token keys every 30 seconds, so key rotations no longer need restarts. New main.go files use them; in an existing workspace replace auth.LoadPrivateKey plus auth.NewSigner in gateway/cmd/gateway/main.go, and auth.LoadPublicKeys plus auth.NewVerifier in each cmd/server/main.go.

  • HTTP_REQUEST_TIMEOUT (12 seconds by default, shorter than HTTP_WRITE_TIMEOUT) gives every gateway request one time budget shared by all its backend calls, so a slow request answers 504 instead of losing its connection. Gateways whose main.go predates it get the same 12-second default from auth.Anonymous.

  • tls_certificate_expiry_timestamp_seconds and tls_reload_errors_total on /metrics, and a warning in the log, when the certificate files of a module stop loading and the previous certificate stays in use.

  • The Kubernetes base spreads replicas over nodes and zones, sets GOMEMLIMIT below the memory limit, gives services 50 seconds to shut down and a connection pool of 10 per replica, so the services sharing a database stay under its default connection limit, tolerates 30 seconds of database outage before a service replica leaves its endpoints, and adds a NetworkPolicy that lets only the pods of the workspace reach the gRPC ports of the services.

  • Generated CI workflows check dependencies for known vulnerabilities with govulncheck.

  • MIGRATE_LOCK_TIMEOUT (10 seconds by default, 0 waits forever) bounds how long a migration waits for a table lock on PostgreSQL, MySQL and SQL Server, so a migration that meets a long transaction fails and can be retried instead of queueing every query on that table behind it.

Changed

  • The circuit breaker of a workspace client counts one outcome per call, after its retries, so one failing replica no longer stops the calls to the whole backend; it ignores calls that start with less than a tenth of GRPC_CALL_TIMEOUT left, whose deadline is the caller's, and only its probe can close it again. Only the generated reads are retried, from an explicit list, instead of every method whose name starts with Get or List.
  • Backend answers the gateway cannot map: a bare ResourceExhausted, such as a message over the size limit, is 502 instead of 429, and Unimplemented, which a newer gateway gets from an older service during a rollout, is 503. A failed call from one service to another is 503 or 504 when the other service is unavailable or slow and 500 otherwise, instead of passing its status through. Monoliths and services answer 503 when the database cannot be reached.
  • offset accepts at most 2147483647; larger values wrapped around in workspaces.
  • A contract field whose wire type changes, such as a string that becomes an integer, now gets a new number and its old number is reserved, so clients built before the change ignore it instead of failing to parse every message; codebuild plan warns about it. codebuild.contracts.json records the type of every field from now on.
  • The Kubernetes Services of workspace services are headless (clusterIP: None). Kubernetes cannot change that in place: delete those Services once before applying the new base.
  • main.go of new services runs the whole shutdown within SHUTDOWN_TIMEOUT after SHUTDOWN_DELAY, and new gateways and services set their logger as the default slog logger.

Security

  • Services in a workspace accept calls with side effects only from the gateway, or from modules named in TLS_TRUSTED_CALLERS; other modules may only call the generated reads (Get, List…, Exists), which is all the generated code needs. Streaming methods added in your own .proto files now go through the same authentication, caller check and panic recovery, and clients send them the internal token, request ID and trace context.
  • Failures of the internal plumbing, such as a rejected internal token or a caller that may not call a method, reach users as 500 with a generic message and are logged by the gateway as errors, instead of a 401 that logs browser users out or a 403 without any log.
  • A password change, accounts set-password and accounts revoke now run in one transaction that holds the account row, and API key creation and logins take the same lock: a key requested with a session that the change revokes is refused instead of surviving it, a login whose password was verified just before a change no longer receives a session or refresh token, and a failure no longer leaves the new password in place with the old credentials still valid. A rehash on login only replaces the hash it verified, so it can no longer restore a password changed meanwhile.
  • With the default AUTH_LIMIT_STORE=memory the per-client limiter has its own store again, so a flood of new identities cannot evict the per-client counters that throttle it.
  • AUTH_LIMIT_STORE=database cleans up in the background and in batches of 1,000 rows, so clients that hang up cannot skip the cleanup and it never locks the table for long; under a flood it drops single-attempt counters instead of the counters that block a client. In workspaces the gateway reports limiter errors without gRPC details, rejects an AUTH_LOGIN_WINDOW above 24 hours at startup instead of answering 400 to every login, and the account service checks the window before converting it.