Skip to content

docs(provisioner): retire stale "-1 = unlimited (team/growth)" comment examples (P4-1)#49

Merged
mastermanas805 merged 2 commits into
masterfrom
docs/p4-1-retire-unlimited-comment-examples
Jun 6, 2026
Merged

docs(provisioner): retire stale "-1 = unlimited (team/growth)" comment examples (P4-1)#49
mastermanas805 merged 2 commits into
masterfrom
docs/p4-1-retire-unlimited-comment-examples

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

What & why (Bug-hunt iter4 finding P4-1)

The strict-80 margin redesign (merged to common+api master 2026-06-05) retired the -1 "no limit" sentinel from every tier's resource limits. postgres_connections and redis_memory_mb are now finite for every tier (team=100 conns / 1536 MB, growth=20 conns / 1024 MB, pro=20 conns / 512 MB). The provisioner's code is correct (it applies whatever the plans registry passes), but several comments still gave the now-misleading example -1 = unlimited (team/growth) / team: unlimited (-1).

This corrects every stale tier-attributed example to be accurate:

  • The -1 / <= 0 sentinel branches stay — they remain the wire contract, and the pool-prewarm path (internal/pool/manager.go) still passes -1 deliberately, so the branch is live.
  • Pure sentinel-mechanism docs that name no current tier were kept (accurate) with a brief post-strict-80 note added to the public entry-point docs (Backend.Provision, Regrader.Regrade, LocalBackend.Provision/Regrade).
  • The two dedicated-pod sizing literals (redis/k8s.go maxmemoryMB: -1, postgres/k8s.go connLimit: -1) are byte-identical — only their surrounding comments changed, now noting the runtime cap is reconciled to the finite registry value via Regrade.

No production behavior change.

Also: fixes a pre-existing FAILING test

make gate was already red on origin/master: TestRegradeResource_Redis_ProTier_AppliesCap/team asserted maxmemory=0 (old team redis_memory_mb=-1) while the registry now returns 1536 — a test expectation strict-80's common bump left behind. Reworked to derive expected values from the live plans registry (rule 18) so the same drift can never recur silently. The production code already applied the registry value; only the stale test expectation changed.

Coverage block

Symptom:       comment example "-1 = unlimited (team/growth)" / "team: unlimited (-1)" + test asserting team maxmemory want 0
Enumeration:   rg -n 'unlimited|connLimit.*-1|-1.*unlimited' provisioner/internal/
Sites found:   stale tier-attributed examples across 6 source files (server.go, redis/k8s.go, redis/backend.go, postgres/backend.go, postgres/local.go, postgres/k8s.go) + 2 test files
Sites touched: all stale tier attributions corrected; accurate pure-sentinel mechanism docs retained, with post-strict-80 note on entry-point docs
Coverage test: TestRegradeResource_Redis_ProTier_AppliesCap is now registry-driven (rule 18) — fails automatically if a future registry change drifts it
Live verified: doc-only / test-only change — full make gate (build + vet + go test ./... -short) GREEN locally; golangci-lint 0 issues

Latent issue surfaced (NOT fixed here — out of scope)

sizingForTier in both dedicated-pod backends still hardcodes -1 (redis/k8s.go maxmemoryMB, postgres/k8s.go connLimit) for team. At provision time the k8s postgres backend uses sz.connLimit (Provision ignores its registry-passed connLimit param — see the existing doc at K8sBackend.Provision), so a team dedicated postgres role is briefly created uncapped until the reconciler's first Regrade applies the finite registry value (100). The redis pod similarly starts with no --maxmemory flag and gets capped to 1536 on the next Regrade. This is functionally reconciled but not provision-time-correct; flagged in the comments and worth a follow-up to pass the registry value at provision time. Left out of this comment-only PR.

🤖 Generated with Claude Code

…t examples

Bug-hunt iter4 P4-1. The strict-80 margin redesign (merged to common+api
master 2026-06-05) made every tier's postgres_connections and redis_memory_mb
finite (team=100 conns/1536 MB, growth=20 conns/1024 MB, pro=20 conns/512 MB).
No tier passes the -1 "no limit" wire sentinel anymore. The comments still gave
the misleading example "-1 = unlimited (team/growth)" / "team: unlimited (-1)".

Comments-only for production code: the -1/<=0 sentinel branches stay (still the
wire contract; the pool prewarm path still passes -1 deliberately), and the two
dedicated-pod sizing literals (redis k8s maxmemoryMB, postgres k8s connLimit)
are byte-identical — only their surrounding comments are corrected to note the
runtime cap is reconciled to the finite registry value via Regrade.

Also fixes one pre-existing FAILING test left behind by the strict-80 common
bump: TestRegradeResource_Redis_ProTier_AppliesCap/team asserted maxmemory=0
(old team=-1) while the registry now returns 1536. Reworked to derive expected
values from the live plans registry (rule 18) so a future registry change can
never silently drift it again. No production behavior change — the server
already applied the registry value; only the test expectation was stale.

Coverage:
  Symptom:       comment example "-1 = unlimited (team/growth)" + test want 0
  Enumeration:   rg -n 'unlimited|connLimit.*-1|-1.*unlimited' internal/
  Sites found:   stale tier-attributed examples across 6 source files + 2 tests
  Sites touched: all stale tier attributions corrected; pure-sentinel mech docs
                 kept (accurate) with a post-strict-80 note on entry-point docs
  Coverage test: TestRegradeResource_Redis_ProTier_AppliesCap now registry-driven
  Live verified: doc-only/test-only — make gate green (build+vet+test ./...)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mastermanas805 mastermanas805 enabled auto-merge (squash) June 6, 2026 08:26
…-patch gate)

The comment-only edit in this PR re-touched the diff hunk around regradeRedis's
`if memLimitMB < 0 { targetMaxmemoryMB = 0 }` block, pulling that executable
branch into the diff. diff-cover's 100%-patch gate (coverage.yml "Patch coverage
gate") correctly flagged it uncovered — no production tier resolves a negative
redis_memory_mb post the strict-80 margin redesign, so the branch had no test.

Add a registry-seam test (SwapRegradeConnLimits + a fixture plans.yaml with
redis_memory_mb: -1) that drives the sentinel and asserts maxmemory=0 is targeted
(rule 18: registry-derived, not a hand-faked constant). The seam lives in a new
export_test.go so the external server_test package can swap the unexported
package-level registry.

diff-cover now reports internal/server/server.go (100%), Missing: 0 lines.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mastermanas805 mastermanas805 merged commit b60bed3 into master Jun 6, 2026
12 checks passed
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.

1 participant