Restrict goal-state transitions to an explicit allow-list - #19
Open
destogl wants to merge 11 commits into
Open
Conversation
# Conflicts: # foreman/foreman/adapters/__init__.py # foreman/foreman/node.py # foreman/foreman/parser.py
isort import ordering and trailing whitespace, on top of the manual merge conflict resolution.
Same goal states as scenario.yaml, with autostart_goal_state set to "running" to demonstrate starting directly into the running state.
Each goal state can declare allowed_transitions: the set of goal states it may switch to next. Empty (the default) stays unrestricted, so existing scenarios are unaffected. Enforced in ForemanEngine.request_goal, since it's domain logic. Adds scenario_profile_switching.yaml as a worked example: idle can only go to all_broadcasters, all_broadcasters only to active, and active can go to all_broadcasters or stay active.
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.
Summary
Each goal state can declare
allowed_transitions: the list of goal states it may switch to next. Any other requested transition is rejected. Empty (the default) stays unrestricted, so existing scenarios are unaffected.SystemGoal.allowed_transitions: List[str], parsed from eachgoal_statesentry, with validation that listed targets are declared goals.ForemanEngine.request_goal()— domain logic, no ROS involved. Skipped when there is no current goal yet (e.g. the first request fromAutostartAdapter).scenario_profile_switching.yaml:idle→all_broadcasters→active, withactiveallowed to loop back toall_broadcastersor stayactive.Based on
feat/foreman-autostartsince it builds on that branch.Test plan
colcon build --packages-select foremancolcon test --packages-select foreman— 51/51 passedpre-commitclean on all changed files