Repository navigation
Conversation
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 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 & UpdateAllocationTokensCommand:
- Fix BULK_PRICING renewalPrice zero check to use Money.isZero()
instead of getAmount().intValue() == 0, which truncated $0.99 to 0.
- Reject tokenStatusTransitions updates on tokens already in terminal
status (ENDED or CANCELLED) via AllocationToken.isTerminalStatus.
- Reload and re-validate tokens inside each saveBatch() transaction
to close the TOCTOU window between init() and execute() for both
bulk-pricing domain counts and terminal transitions, and log only
the current batch rather than the full tokensToSave set.
- CI Guardrail & Tests:
- Add TimedTransitionPropertyUsageTest using ClassGraph and a minimal
JDK ClassFile InvokeInstruction check to enforce an explicit
method-level allowlist of stateless production callers of raw
TimedTransitionProperty.fromValueMap(), preventing stateful TldState
and TokenStatus paths from bypassing transition-graph validation.
- Add empirical regression tests covering every fix 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
updates (update_allocation_tokens), and model validation.
BUG= http://b/591075479
CydeWeys
force-pushed
the
timed-transition-fsm
branch
from
November 27, 2026 19:00
22ce33f to
98ce8a0
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.validateDefaultPromoTokensand 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&UpdateAllocationTokensCommand:BULK_PRICINGrenewalPricezero check to useMoney.isZero()instead ofgetAmount().intValue() == 0, which truncated$0.99to0.tokenStatusTransitionsupdates on tokens already in terminal status (ENDEDorCANCELLED) viaAllocationToken.isTerminalStatus.saveBatch()transaction to close the TOCTOU window betweeninit()andexecute()for both bulk-pricing domain counts and terminal transitions, and log only the current batch rather than the fulltokensToSaveset.TimedTransitionPropertyUsageTestusingClassGraphand a minimal JDK ClassFileInvokeInstructioncheck to enforce an explicit method-level allowlist of stateless production callers of rawTimedTransitionProperty.fromValueMap(), preventing statefulTldStateandTokenStatuspaths from bypassing transition-graph validation.Operational Justification & Blast Radius
TimedTransitionPropertydoes not implementMap.configure_tld), allocation token updates (update_allocation_tokens), and model validation.BUG= http://b/591075479
This change is