test(admin): registry-drift guard for adminAllowedTiers vs plans.yaml (rule 18)#233
Merged
mastermanas805 merged 3 commits intoJun 3, 2026
Conversation
… (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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 droppedhobby_plusfor 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 inplans.yamlmust be consciously filed as either:adminAllowedTiers: free, hobby, pro, team), or*_yearlybilling variants).Adding a new tier to
plans.yamlnow reds CI until someone files it on one side. Also guards the reverse — a stale entry inadminAllowedTiers(or the exclude set) that no longer exists inplans.yamlfails too.Pure test addition — no production code change.
🤖 Generated with Claude Code