fix(sandbox_envs): Restore env edit drawer and accept subgroup repo ids#1240
Merged
Conversation
The edit drawer is rendered by HTMX into the list page, so the Alpine components used by the form fragment must already be registered on that page. `list.html` enumerated scripts manually and was missing `repo-ids-editor.js`, causing "repoIdsEditor is not defined" errors when editing an env. Replace the manual list with the shared `_scripts.html` include already used by chat, schedules, and activity pages, so the script set cannot drift again.
…side GitLab subgroup paths like `group/subgroup/repo` were rejected by the chip-editor's regex (which only accepted exactly one slash) and had no backend check at all, so bypassing the JS could persist anything. Loosen the client regex to `^[^\s/]+(/[^\s/]+)+$` and enforce the same shape in both the model (`_validate_repo_ids`) and the form (`clean_repo_ids_json`, so invalid input surfaces as a per-field error rather than bubbling up from `full_clean`). Also clear the stale Alpine error when the chip editor sees empty input, so dismissing a previous error works as expected.
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
list.htmlenumerated scripts manually and was missingrepo-ids-editor.js, throwingrepoIdsEditor is not definedwhen editing an env. Swapped the manual list for the sharedsandbox_envs/_scripts.htmlinclude (already used by chat/schedules/activity) so the script set can't drift again.group/subgroup/repo. Loosened to^[^\s/]+(/[^\s/]+)+$._validate_repo_ids(defense-in-depth for non-form paths) andclean_repo_ids_json(so invalid input surfaces as a per-field error instead of bubbling up fromfull_clean).Test plan
uv run pytest tests/unit_tests/sandbox_envs/(145 passed, including 9 new parametrized cases on the model regex and 1 new form-level test).dipcode/omd/wordpress/omd-theme; invalid input (foo,foo/,https://...) shows the field-scoped error from the form.