scalable: reused state inherits every behavior attached to it#16
Merged
Conversation
The existing 'don't optimize away the domain object' bullet warns against reuse that deletes the domain object. Add its mirror: reuse that silently inherits a hidden behavior. Repurposing an existing status/flag/enum/column (e.g. trialing to mean 'migration bridge') fires everything that already reads that value — webhooks, crons, entitlement gates, billing/credit grants, UI branches, cleanup jobs — not just the one property you wanted. Enumerate consumers up front (grep every reader) instead of discovering them reactively one bug at a time, and verify by diffing the whole system's response, not just the fields you predicted would change.
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
Adds one bullet to `commands/scalable.md`, right after "don't optimize away the domain object."
That existing bullet warns against reuse that deletes the domain object. This adds its mirror: reuse that silently inherits a hidden behavior.
Why
Repurposing an existing status / flag / enum / column to mean something new (e.g.
trialingto mean "currency-migration bridge") doesn't just carry the one property you want — it fires everything already wired to that value: webhooks, crons, entitlement gates, billing/credit grants, UI branches, cleanup jobs.Real case that motivated this: a subscription currency-migration reused Stripe's
trialingstatus purely to defer a charge./scalablecorrectly flagged two inherited behaviors (orphan-cancel, upgrade block) — but only reactively, after being prompted. A third —trialingsub creation emitting a$0invoice →invoice.paid→ a full plan-credit grant — went unnoticed until it had minted a duplicate month of credits for every migrated customer.The fix is mechanical, not conceptual: grep every consumer of the reused value up front and enumerate what each does, rather than validating the one behavior you wanted and discovering the rest one bug at a time. Plus a verification note: diff the whole system's response (side-effect tables, ledgers), not just the fields you predicted.