mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-05 02:31:47 +00:00
fix(profiles): keep validate_profile_name strict; callers normalize first
Follow-up to @changchun989's cherry-pick: reverts the validate-via- normalize change so validate_profile_name remains a strict regex check on the input AS-GIVEN. Callers that accept mixed-case user input (dashboard UI, CLI args, import flows) call normalize_profile_name() first, then validate the result. This keeps validate honest about what the on-disk directory name must look like — e.g. ' jules ' (trailing whitespace) is now rejected instead of silently trimmed and accepted. - validate_profile_name: strict lowercase/regex check again, 'UPPER' back in the invalid-names parametrize - 8 call sites in profiles.py (create_profile, delete_profile, set_active_profile, export_profile, import_profile, rename_profile, resolve_profile_env, plus the clone_from branch): swap the normalize-then-validate order - scripts/release.py: add changchun989@proton.me -> changchun989 to AUTHOR_MAP so CI doesn't block on the unmapped contributor email All kanban + profile tests pass (268 across test_profiles.py + test_kanban_db.py + test_kanban_core_functionality.py, plus 73 in test_kanban_tools.py + test_kanban_dashboard_plugin.py). Closes #18498.
This commit is contained in:
parent
a31477dabb
commit
ae40fca955
3 changed files with 26 additions and 16 deletions
|
|
@ -85,10 +85,12 @@ class TestValidateProfileName:
|
|||
# Should not raise
|
||||
validate_profile_name(name)
|
||||
|
||||
def test_uppercase_accepted_via_normalization(self):
|
||||
validate_profile_name("Jules")
|
||||
def test_uppercase_rejected(self):
|
||||
# validate_profile_name is strict — callers normalize first, then validate.
|
||||
with pytest.raises(ValueError):
|
||||
validate_profile_name("Jules")
|
||||
|
||||
@pytest.mark.parametrize("name", ["has space", ".hidden", "-leading"])
|
||||
@pytest.mark.parametrize("name", ["UPPER", "has space", ".hidden", "-leading"])
|
||||
def test_invalid_names_rejected(self, name):
|
||||
with pytest.raises(ValueError):
|
||||
validate_profile_name(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue