Normalise a gate's ``options`` to a stable ``list[str]`` (or ``None``). A valid gate stores a list, but an unvalidated workflow could leave a scalar or tuple. ``None`` stays ``None`` (no options); a list/tuple maps each element through ``str``; any other scalar becomes a single-element
(options: Any)
| 236 | |
| 237 | |
| 238 | def _normalize_gate_options(options: Any) -> list[str] | None: |
| 239 | """Normalise a gate's ``options`` to a stable ``list[str]`` (or ``None``). |
| 240 | |
| 241 | A valid gate stores a list, but an unvalidated workflow could leave a |
| 242 | scalar or tuple. ``None`` stays ``None`` (no options); a list/tuple maps |
| 243 | each element through ``str``; any other scalar becomes a single-element |
| 244 | list — so the emitted JSON schema is always ``list[str] | None``. A bare |
| 245 | string is treated as one option, never iterated character-by-character. |
| 246 | """ |
| 247 | if options is None: |
| 248 | return None |
| 249 | if isinstance(options, (list, tuple)): |
| 250 | return [str(o) for o in options] |
| 251 | return [str(options)] |
| 252 | |
| 253 | |
| 254 | def _run_outcome_exit_code(status_value: str) -> int: |