Skip to content

test(admin): registry-drift guard for adminAllowedTiers vs plans.yaml (rule 18)#233

Merged
mastermanas805 merged 3 commits into
masterfrom
test/admin-allowed-tiers-registry-guard-2026-06-04
Jun 3, 2026
Merged

test(admin): registry-drift guard for adminAllowedTiers vs plans.yaml (rule 18)#233
mastermanas805 merged 3 commits into
masterfrom
test/admin-allowed-tiers-registry-guard-2026-06-04

Conversation

@mastermanas805

Copy link
Copy Markdown
Member

What

adminAllowedTiers (admin_customers.go) — the closed set of tiers an admin may set on a team — is hand-maintained. The capabilities-contract regression (a hardcoded slice that silently dropped hobby_plus for 3h) is exactly the bug class this guards.

Fix (rule 18)

A registry-iterating test that walks the live plans.Default().All() registry (not a hand-typed list). Every tier in plans.yaml must be consciously filed as either:

  • admin-settable (adminAllowedTiers: free, hobby, pro, team), or
  • explicitly excluded with a documented reason (anonymous, growth, hobby_plus, and the *_yearly billing variants).

Adding a new tier to plans.yaml now reds CI until someone files it on one side. Also guards the reverse — a stale entry in adminAllowedTiers (or the exclude set) that no longer exists in plans.yaml fails too.

Symptom:        new tier added to plans.yaml silently not admin-settable (capabilities-contract bug class)
Enumeration:    plans.Default().All() iterated vs adminAllowedTiers + documented exclude set
Sites found:    1 registry (adminAllowedTiers)
Sites touched:  +1 drift-guard test
Coverage test:  TestAdminAllowedTiers_StaysInSyncWithPlanRegistry
Live verified:  passes against embedded plans registry (no DB needed)

Pure test addition — no production code change.

🤖 Generated with Claude Code

… (rule 18)

adminAllowedTiers (the closed set of tiers an admin may set on a team) is
hand-maintained. The capabilities-contract regression — a hardcoded slice
that silently dropped hobby_plus for 3h — is exactly the bug class this
guards. Per rule 18 the test iterates the LIVE plans registry
(plans.Default().All()), not a hand-typed list: every tier in plans.yaml
must be consciously filed as either admin-settable OR in a documented
exclude set (anonymous, growth, and the upsell/yearly variants). Adding a
new tier to plans.yaml now reds CI until someone makes that decision.

Also guards both directions: a stale entry left in adminAllowedTiers (or in
the test's exclude set) that no longer exists in plans.yaml fails too.

Pure test addition; passes against the embedded plans registry (no DB).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 enabled auto-merge (squash) June 3, 2026 19:20
@mastermanas805 mastermanas805 merged commit 53e312b into master Jun 3, 2026
18 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