Fix AutoMap when creating a new project controller - #18
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5841df0e9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) | ||
| if embed_new_controller: | ||
| selected_controller_uid = controller.controller_uid | ||
| selected_controller_uid = probe.controller_uid |
There was a problem hiding this comment.
Preserve the collision-adjusted UID for new controllers
When the project already contains any hardware controller using the profile's stable UID, selecting “Create a new controller” still uses the unadjusted probe UID here. If the collision is with a Companion/OSC controller, create_automapped_project silently selects that existing controller instead of embedding the new one; if it is with another controller type, _controller_from_template adjusts the embedded UID and then rejects it because it no longer matches this value. Use a UID that accounts for all project controllers and pass that same UID to the final export and AutoMap.
Useful? React with 👍 / 👎.
What changed
Root cause
The new-controller branch referenced
controller.controller_uidbefore the final controller export assignedcontroller, raisingUnboundLocalErrorbefore any plug-in mapping began.Validation
python -m pytest -q— 224 passed.rack2SHA-256 stayed unchanged in both tests