Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
run: uv run --only-group=tox tox run -e docs

# Upload docs:
# - on pushes to main, merge queues, and workflow dispatches
# - on pushes to main and workflow dispatches
# - on pushes to tickets/ branches if docs/ directory content changed
- uses: lsst-sqre/ltd-upload@v1
with:
Expand All @@ -181,7 +181,6 @@ jobs:
password: ${{ secrets.LTD_PASSWORD }}
if: >
(github.event_name == 'push' && github.ref_name == 'main')
|| (github.event_name == 'merge_group')
|| (github.event_name == 'workflow_dispatch')
|| (github.event_name == 'pull_request'
&& startsWith(github.head_ref, 'tickets/')
Expand Down
3 changes: 3 additions & 0 deletions changelog.d/20250808_150548_rra_DM_52140.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Bug fixes

- Allow group names where the only alphabetic character is the first character. This fixes a regression introduced in Gafaelfawr 13.0.1.
4 changes: 3 additions & 1 deletion src/gafaelfawr/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@
CURSOR_REGEX = "^p?[0-9]+_[0-9]+$"
"""Regex matching a valid cursor."""

GROUPNAME_REGEX = "^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z][a-zA-Z0-9._-]*$"
GROUPNAME_REGEX = (
"^([a-zA-Z]|[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z])[a-zA-Z0-9._-]*$"
)
"""Regex matching all valid group names."""

SCOPE_REGEX = "^[a-zA-Z0-9:._-]+$"
Expand Down
27 changes: 27 additions & 0 deletions tests/models/userinfo_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Tests for user information models."""

from __future__ import annotations

import pytest
from pydantic import ValidationError

from gafaelfawr.models.userinfo import Group


def test_group_names() -> None:
for valid in (
"g_special_users",
"rra",
"19numbers",
"G-12345",
"group.name",
"group1234",
"19numbers19",
"1-g",
"12341-g-",
):
Group(name=valid, id=1234)

for invalid in ("12345", "rra#foo", "", "-rra", "_rra", "1-"):
with pytest.raises(ValidationError):
Group(name=invalid, id=1234)