Skip to content

fix(sandbox_envs): Restore env edit drawer and accept subgroup repo ids#1240

Merged
srtab merged 2 commits into
mainfrom
fix/sandbox-envs-edit-drawer
May 20, 2026
Merged

fix(sandbox_envs): Restore env edit drawer and accept subgroup repo ids#1240
srtab merged 2 commits into
mainfrom
fix/sandbox-envs-edit-drawer

Conversation

@srtab
Copy link
Copy Markdown
Owner

@srtab srtab commented May 20, 2026

Summary

  • Restore missing scripts on env list page. The edit drawer body is HTMX-loaded from the list page, so the Alpine components used in the form fragment must already be registered there. list.html enumerated scripts manually and was missing repo-ids-editor.js, throwing repoIdsEditor is not defined when editing an env. Swapped the manual list for the shared sandbox_envs/_scripts.html include (already used by chat/schedules/activity) so the script set can't drift again.
  • Accept multi-segment repo ids. The chip-editor regex only allowed exactly one slash, blocking real GitLab subgroup paths like group/subgroup/repo. Loosened to ^[^\s/]+(/[^\s/]+)+$.
  • Enforce the format server-side. Previously the backend only checked list/string/non-blank, so bypassing the JS could persist any junk. Same regex now runs in both _validate_repo_ids (defense-in-depth for non-form paths) and clean_repo_ids_json (so invalid input surfaces as a per-field error instead of bubbling up from full_clean).
  • Cleared the stale Alpine error when the chip editor receives empty input.

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).
  • Manual: open the list page → click Edit on an existing env → no Alpine errors in console; chip editor accepts dipcode/omd/wordpress/omd-theme; invalid input (foo, foo/, https://...) shows the field-scoped error from the form.

srtab added 2 commits May 20, 2026 14:53
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.
@srtab srtab merged commit df34f3f into main May 20, 2026
6 checks passed
@srtab srtab deleted the fix/sandbox-envs-edit-drawer branch May 20, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant