You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(plans): fix tier-assumption tests for strict-80%-margin redesign
common #46 retired every unlimited (-1) resource limit to finite caps
(Team/Growth now finite). Four api handler tests still assumed the old
"team/growth = unlimited" reality and reded build-and-test, which broke
api master (every PR checks out common@master with the new numbers).
Fixes (TESTS only — the -1-handling production code is preserved as
correct defensive utilities, still reachable via provisions_per_day: -1
and future tiers):
- billing_usage_coverage: TestBillingUsage_UnlimitedTier_MbToBytesNegative
routed the team tier (was -1) through the HTTP usage handler to hit
mbToBytes(-1). No real tier carries -1 now, so the -1 path can't be
reached via a tier. Moved to a direct internal test
(mb_to_bytes_internal_test.go) that feeds synthetic -1/finite inputs —
keeps the defensive "-1 -> ∞" branch covered.
- misc_routes_block_integration: the "team tier short-circuits to
near_wall=false" subtest assumed the unlimited early-return. That
early-return was removed (Team is finite -> walls apply); subtest now
asserts near_wall=true with a seeded wall row.
- small_handlers_final: TestUsageWallFinal_DBError_503 used failAfter=1
(team-tier pre-query #1 then audit query #2). With the early-return
gone the audit query is the FIRST DB call -> failAfter=0.
- team_coverage_mock: TestTeamMembers_InviteMember_LegacyMemberSuccess
assumed team_members=-1 so withinMemberLimit skipped the count query.
Team is now 25 -> added the teamSeatTotal (members + pending) mock
expectations; 1 seat < 25 -> within limit -> 201.
New rule-18 guard (strict_margin_finite_limits_test.go): iterates the
LIVE plans.yaml registry and fails if any tier ships a -1 on any costed
resource limit (only provisions_per_day may be -1). Re-introducing an
unlimited resource cap — or a new tier with one — now reds here instead
of silently shipping unbounded COGS.
Team stays GATED (no checkout change). Unblocks api master.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
t.Errorf("tier %q: %s = %d — unlimited (-1) resource limits were retired in the strict-80%%-margin redesign; every resource cap must be finite (>= 0)",
70
+
name, field, v)
71
+
}
72
+
}
73
+
74
+
// ProvisionsPerDay is the ONLY field intentionally allowed at -1
75
+
// (per-day rate gate, not a resource-cost dimension). Assert it is
76
+
// either finite (>= 0) or exactly -1 — never some other negative.
77
+
ifl.ProvisionsPerDay<-1 {
78
+
t.Errorf("tier %q: provisions_per_day = %d — must be -1 (unlimited) or finite (>= 0)",
0 commit comments