Repository navigation
Conversation
CydeWeys
force-pushed
the
timed-transition-fsm
branch
from
November 27, 2026 19:00
22ce33f to
98ce8a0
Compare
TLD launch phases and allocation token promotion lifecycles previously
relied on ad-hoc ordering checks and unvalidated deserialization paths
that permitted illegal state regressions, bypassed promo-token checks
during YAML sync, resurrected terminal tokens, and suffered a TOCTOU
race when ending bulk-pricing packages. This change replaces implicit
enum-ordinal ordering with explicit transition graphs enforced across
builders, YAML sync, CLI updates, and a bytecode CI guardrail.
Key changes:
- Tld, EntityYamlUtils & ConfigureTldCommand:
- Replace Ordering.natural() on Tld.tldStateTransitions with an
explicit VALID_TLD_STATE_TRANSITIONS graph and non-QUIET_PERIOD
progression check (forbidding regressions such as
GENERAL_AVAILABILITY -> PDT, both directly and via QUIET_PERIOD).
- Route EntityYamlUtils.TimedTransitionPropertyTldStateDeserializer
and Tld.Builder.setTldStateTransitions through
Tld.createTldStateTransitions, and re-validate in Tld.validateState.
- Extract Tld.validateDefaultPromoTokens (using batched DB loads and
honoring empty allowedTlds as all-TLD tokens) and invoke it from
both Tld.Builder.setDefaultPromoTokens and ConfigureTldCommand so
YAML sync cannot persist missing, wrong-type, or wrong-TLD promo
tokens.
- TimedTransitionProperty:
- Remove the unused forEmptyMap() method, which unconditionally threw
IllegalArgumentException.
- Add a 3-argument make() overload enforcing allowed transitions
without constraining the initial state, and reject empty maps with
IllegalArgumentException instead of NoSuchElementException.
- AllocationToken, GenerateAllocationTokensCommand &
UpdateAllocationTokensCommand:
- Fix BULK_PRICING renewalPrice zero check to use Money.isZero()
instead of getAmount().intValue() == 0, which truncated $0.99 to 0.
- Add null-checked AllocationToken.isTerminalStatus (reused in both
UpdateAllocationTokensCommand and GenerateAllocationTokensCommand).
- Reject tokenStatusTransitions updates that resurrect terminal tokens
(ENDED or CANCELLED), regress a live status backward (e.g.,
VALID -> NOT_STARTED), or shrink UNLIMITED_USE/DEFAULT_PROMO
transitions to a single NOT_STARTED entry.
- Store only token VKeys between init() and execute(), reload,
re-validate, and skip already-identical tokens inside each
saveBatch() transaction to close TOCTOU windows, and print updated
batch token names only after transaction commit.
- CI Guardrail & Tests:
- Add TimedTransitionPropertyUsageTest using ClassGraph and JDK
ClassFile inspection (covering both InvokeInstruction and
InvokeDynamicInstruction method references) to enforce an explicit
method-level allowlist of stateless production callers of raw
TimedTransitionProperty.fromValueMap().
- Add regression tests covering every fix, validateState(), and edge
case.
Operational justification & blast radius:
- Zero database schema or Flyway migrations; zero Protostuff entity
field changes; TimedTransitionProperty does not implement Map.
- Scoped to TLD configuration sync (configure_tld), allocation token
generation/updates, and model validation.
BUG= http://b/591075479
CydeWeys
force-pushed
the
timed-transition-fsm
branch
from
December 4, 2026 21:49
98ce8a0 to
9f1bf5a
Compare
This branch has not been deployed
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.
TLD launch phases and allocation token promotion lifecycles previously relied on ad-hoc ordering checks and unvalidated deserialization paths that permitted illegal state regressions, bypassed promo-token checks during YAML sync, resurrected terminal tokens, and suffered a TOCTOU race when ending bulk-pricing packages. This change replaces implicit enum-ordinal ordering with explicit transition graphs enforced across builders, YAML sync, CLI updates, and a bytecode CI guardrail.
Key Changes
Tld,EntityYamlUtils&ConfigureTldCommand:Ordering.natural()onTld.tldStateTransitionswith an explicitVALID_TLD_STATE_TRANSITIONSgraph and non-QUIET_PERIODprogression check (forbidding regressions such asGENERAL_AVAILABILITY -> PDT, both directly and viaQUIET_PERIOD).EntityYamlUtils.TimedTransitionPropertyTldStateDeserializerandTld.Builder.setTldStateTransitionsthroughTld.createTldStateTransitions, and re-validate inTld.validateState.Tld.validateDefaultPromoTokens(batching DB loads vialoadByKeysIfPresentand honoring emptyallowedTldsas all-TLD tokens) and invoke it from bothTld.Builder.setDefaultPromoTokensandConfigureTldCommandso YAML sync cannot persist missing, wrong-type, or wrong-TLD promo tokens.TimedTransitionProperty:forEmptyMap()method, which unconditionally threwIllegalArgumentException.make()overload enforcing allowed transitions without constraining the initial state, and reject empty maps withIllegalArgumentExceptioninstead ofNoSuchElementException.AllocationToken,GenerateAllocationTokensCommand&UpdateAllocationTokensCommand:BULK_PRICINGrenewalPricezero check to useMoney.isZero()instead ofgetAmount().intValue() == 0, which truncated$0.99to0.AllocationToken.isTerminalStatus(reused in bothUpdateAllocationTokensCommandandGenerateAllocationTokensCommand).tokenStatusTransitionsupdates that resurrect terminal tokens (ENDEDorCANCELLED), regress a live status backward (e.g.,VALID -> NOT_STARTED), or shrinkUNLIMITED_USE/DEFAULT_PROMOtransitions to a singleNOT_STARTEDentry.VKeys betweeninit()andexecute(), reload, re-validate, and skip already-identical tokens inside eachsaveBatch()transaction to close TOCTOU windows, and print updated batch token names only after transaction commit.TimedTransitionPropertyUsageTestusingClassGraphand JDK ClassFile inspection (covering bothInvokeInstructionandInvokeDynamicInstructionmethod references) to enforce an explicit method-level allowlist of stateless production callers of rawTimedTransitionProperty.fromValueMap(), preventing statefulTldStateandTokenStatuspaths from bypassing transition-graph validation.Tld.validateState(), and edge cases.Operational Justification & Blast Radius
TimedTransitionPropertydoes not implementMap.configure_tld), allocation token generation/updates, and model validation.BUG= http://b/591075479
This change is