Skip to content

Remove configurable serverless min ready#110

Merged
arjunkomath merged 1 commit into
mainfrom
feat/remove-serverless-min-ready
Jul 7, 2026
Merged

Remove configurable serverless min ready#110
arjunkomath merged 1 commit into
mainfrom
feat/remove-serverless-min-ready

Conversation

@techulus-agent

@techulus-agent techulus-agent commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Removes Min Ready / minReadyReplicas entirely from serverless configuration and routing. The wake gateway now resumes queued requests when the first upstream is ready.

Why

minReadyReplicas was being treated like a cluster-level replica setting, but serverless wake behavior is proxy-local. Keeping it around as a fixed value still left a ghost configuration knob in the control-plane/agent contract, so this removes the field instead of pinning it to one.

Changes

  • Removed the Serverless Min Ready input and action payload field.
  • Removed validation and placement-time clamping against configured replicas.
  • Removed minReadyReplicas from current/deployed serverless config, expected state, and the agent serverless route payload.
  • Simplified the agent wake gateway to release on the first ready upstream.
  • Dropped the serverless_min_ready_replicas schema column.
  • Trimmed the now-unused serverlessMinReadyReplicas select/type plumbing from agent status handling.
  • Updated docs to describe the fixed one-ready-upstream behavior.

Validation

  • pnpm test -- tests/service-config.test.ts tests/expected-state.test.ts
  • pnpm exec tsc --noEmit
  • pnpm test
  • go test ./... from agent
  • pnpm exec biome check lib/agent-status.ts actions/projects.ts components/service/details/serverless-section.tsx lib/agent/expected-state.ts lib/service-config.ts tests/expected-state.test.ts tests/service-config.test.ts
  • git diff --check
  • rg -n "minReadyReplicas|MinReadyReplicas|serverlessMinReadyReplicas|serverless_min_ready_replicas" . -g '!web/pnpm-lock.yaml'

Biome exits successfully but still reports existing warnings in lib/agent/expected-state.ts and tests/expected-state.test.ts.

@techulus-agent techulus-agent force-pushed the feat/agent-disk-cleanup branch from a277a48 to a3e9d74 Compare July 7, 2026 09:08
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit f329e07.

@techulus-agent techulus-agent force-pushed the feat/remove-serverless-min-ready branch from 8f4d13d to c25f2b4 Compare July 7, 2026 09:10
@arjunkomath arjunkomath marked this pull request as ready for review July 7, 2026 11:10

@techulus-agent techulus-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review — Remove configurable serverless min ready

Reviewed the diff (base feat/agent-disk-cleanup). Clean, well-scoped removal — the "always emit minReadyReplicas: 1, keep the DB column for compat" approach is handled consistently across every read path. Ran tests/service-config.test.ts + tests/expected-state.test.ts locally: 23/23 pass.

Verified

  • No dead imports: the removed updateServiceConfig clamping block dropped the last use of Math.max(1, totalReplicas) and the LEAST(...) SQL, but sql and and are still used elsewhere in actions/projects.ts, so nothing is left dangling. totalReplicas was removed cleanly.
  • Read-path normalization is complete: buildCurrentConfig, normalizeServerlessConfig, and getCurrentServerlessConfig all now return 1, and getDeployedServerlessConfig routes through normalizeServerlessConfig/getCurrentServerlessConfig — so legacy stored values > 1 are normalized on read. The new regression tests (stored 7, deployed 51) correctly exercise this.
  • Agents never see stale values: the canonical route config in buildServerlessRoutesFromRows hardcodes minReadyReplicas: 1, and diffConfigs no longer compares the field, so a legacy DB value can't produce a spurious config diff or leak to a proxy.
  • UI fully cleaned: the only caller of updateServiceServerlessSettings (serverless-section.tsx) was updated, the input/state/validation/hasChanges were all removed, and the grid dropped md:grid-cols-3md:grid-cols-2 to match the two remaining fields. No leftover Min Ready strings anywhere in components//app/.
  • Docs (architecture.mdx, scaling.mdx) updated to match the fixed one-ready-upstream behavior.

Non-blocking notes

  1. lib/agent-status.ts still SELECTs serverlessMinReadyReplicas (lines 152, 284) and types it (~564), but nothing consumes it for behavior now that the value is fixed. Harmless (compat field intentionally kept), just a candidate to trim in a later cleanup.
  2. Stacked on #108 — base is feat/agent-disk-cleanup, so merge #108 first (or rebase onto main) to keep the diff/history clean.

Result: No correctness issues. LGTM 👍

@techulus-agent techulus-agent force-pushed the feat/remove-serverless-min-ready branch 2 times, most recently from 4830467 to 0b618d5 Compare July 7, 2026 11:27
Base automatically changed from feat/agent-disk-cleanup to main July 7, 2026 11:37

@techulus-agent techulus-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Re-review — full removal of minReadyReplicas 👍

This revision is a much cleaner approach than the previous "keep the column, always emit 1" version — it now removes minReadyReplicas end-to-end: DB column, TS/Go types, the agent ServerlessRoute struct field, the gateway wake logic, and all tests/docs. Verified locally: go build ./... clean, agent internal/serverless tests pass, web service-config + expected-state suites pass (22/22).

Verified correct

  • Gateway wake logic is a faithful collapse to min-ready = 1. In both resolveUpstreams and waitForReadyUpstreams, len(ready) >= max(1, route.MinReadyReplicas) || (…) becomes len(ready) > 0. With min-ready = 1, len(ready) >= 1len(ready) > 0 and already subsumed the OR clause, so behavior is identical for the default case. For legacy services that had min-ready > 1, requests now resume as soon as one upstream is ready — which is exactly the intended new semantics. The blocking/else branch is still reachable when len(ready) == 0, so nothing is stranded.
  • Agent ↔ control-plane rollout is safe in both directions. encoding/json ignores unknown fields, so a new agent silently ignores an old control plane still emitting minReadyReplicas; and an old agent receiving the new field-less JSON gets Go's zero value 0, which its max(1, 0) = 1 handles gracefully. No ordering constraint between web and agent deploys.
  • Complete removal — zero remaining references to minReadyReplicas / serverless_min_ready / MinReadyReplicas anywhere in web, agent, docs, or tests. The dead agent-status.ts selects I flagged last round are gone too.

Notes

  1. Dead code: hasAlwaysOnUpstream (agent/internal/serverless/gateway.go:912) is now defined but never called. Go still compiles, but staticcheck (U1000) and reviewers will flag it — worth deleting in this PR.
  2. DB column drop: since the repo uses drizzle-kit push (no versioned migrations), removing the column from schema.ts is the right mechanism — db:push will drop serverless_min_ready_replicas at deploy. Just confirm the deploy pipeline runs push with confirmation/--force since this is a destructive change (the drop itself is intended — the value is being abandoned).

Result: No correctness issues; the two notes are cleanup/ops, not blockers. LGTM 👍

@techulus-agent techulus-agent force-pushed the feat/remove-serverless-min-ready branch from 0b618d5 to f329e07 Compare July 7, 2026 11:42
@arjunkomath arjunkomath merged commit 3b09e8e into main Jul 7, 2026
10 checks passed
@arjunkomath arjunkomath deleted the feat/remove-serverless-min-ready branch July 7, 2026 11:46
@mintlify

mintlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
techulus-cloud 🔴 Failed Jul 7, 2026, 11:56 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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.

2 participants