Repository navigation
feat(hsm): let a composite state pick its entry child - #29
Conversation
- IEntrySelector: a change that ends at a composite enters it, then the child its SelectEntry names, in the same transition, until the leaf is no selector. Null, non-child entries and cycles throw. - [ExtensionFor(..., IncludeDescendants = true)] attaches while a listed state is anywhere in the active chain. - StateHierarchy reads declared parents; a cycle in them no longer hangs the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The generator-dll artifact of this PR's CI run 38882539393, as is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @RodionGayvoronskiy's task in 1m 39s —— View job Ревью PR #29
Verdict: 0 blocking, 3 minor
Проверено: инвариант factory/machine,
|
|
Verdict: 0 blocking, 3 minor |
|
Verdict: 0 blocking, 2 minor |
- IncludeDescendants matches as `is` does: a base class or an interface of a state in the chain counts, like the pattern without the flag. - Document and test a change that targets the active composite again, and that an entry is checked only after the selector was entered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Important
generator-dllCI artifact is committed in a follow-up0.0.1-alpha.5and releaseWhy. The race tree in street keeps kind-specific leaves (sprint, drift, drag…) under stage composites. A controller must change to the stage without knowing the kind, but
ChangeState<Composite>()made the composite the leaf. And a pause bound to the stage had to list every kind leaf in[ExtensionFor].What
IEntrySelector.SelectEntry(): an entered composite target descends into the child it names, same transition[ExtensionFor(..., IncludeDescendants = true)]: the host anywhere in the active chainStateHierarchy.GetParentType/IsSelfOrDescendantOf; the factory delegates to itStart with:
Unity/Runtime/StateMachines/StateMachineBase.cs(SelectEntryTypeand the descent after the enter loop), thenStateMachineBase.Async.cs, thenExtensionState/Bodies/ExtensionStateBody.csVerification
dotnet test→ 234/234 (+23):EntrySelectorTests,ExtensionWithDescendantsTests,ExtensionForDescendantsEmitTestsOnChangingState/OnChangedStatethat sees the final leaf; nested selectors; straight to a leaf skips it; siblings do not re-enter it;TransitionTo; null / non-child / grandchild / cycle errors; sync into async-only entry throws; async enter completes beforeSelectEntry; cancelled and superseded enters never ask it;OnEnteredafter the final leafAspid.Core.HSM.Runtime(C# 9) clean; Unity 6000.4.0f1 batch import clean,.metafor the two new files from itContext
Spec: street
Logs/race-hsm-books/HSM_PACKAGE_PROMPT.md. Extension flag chosen as variant (b), no change to existing[ExtensionFor].CanAttachTostill receives only the leaf: "the host is in the active chain" is "the leaf is the host or its descendant", which the leaf's type answers throughIChildState<>.Not done: item 3 (registration validation hook, low priority) — finding a selector's children needs an assembly scan; street can test it with
StateHierarchy.GetParentTypeover its own types. The generator diagnostic for a type-parameter controller argument (optional) is left for later.IsStateEnabled/IsTransitionEnabledguard the target composite, not the entries a selector picks.🤖 Generated with Claude Code