Fix empty branches_to_generate #64
Closed
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.
Fix AttributeError when branches_to_generate is None
Problem
The
generate_taskscommand was failing withAttributeError: 'NoneType' object has no attribute 'items'when the module config file hadbranches_to_generate: nullor the key was missing.Root Cause
In
Module.__init__,self._branches_to_generatewas assigned directly usingconfig["branches_to_generate"], which could beNone. Later,generate_task_configs()attempted to call.items()on this None value.Solution
Changed the assignment to use
config.get("branches_to_generate") or {}to ensure_branches_to_generatealways defaults to an empty dictionary when the value is None or missing.Before:
self._branches_to_generate = config["branches_to_generate"]After:
self._branches_to_generate = config.get("branches_to_generate") or {}## Additional Changes
Testing
This fix is backward compatible and allows the module system to gracefully handle configs without defined branches.