diff --git a/src/aipass/commons/apps/handlers/artifacts/artifact_ops.py b/src/aipass/commons/apps/handlers/artifacts/artifact_ops.py index f68d9607..595db77d 100644 --- a/src/aipass/commons/apps/handlers/artifacts/artifact_ops.py +++ b/src/aipass/commons/apps/handlers/artifacts/artifact_ops.py @@ -75,8 +75,8 @@ def _validate_metadata(metadata_str: str) -> Optional[dict]: def _resolve_branch_name(mention: str) -> Optional[str]: - """Resolve a @mention to a branch name.""" - name = mention.lstrip("@").upper() + """Resolve a @mention to a branch name (lowercase-normalized).""" + name = mention.lstrip("@").lower() if not os.path.exists(BRANCH_REGISTRY_PATH): return None @@ -85,7 +85,7 @@ def _resolve_branch_name(mention: str) -> Optional[str]: with open(BRANCH_REGISTRY_PATH, encoding="utf-8") as f: registry = json.load(f) for branch in registry.get("branches", []): - if branch.get("name") == name: + if branch.get("name", "").lower() == name: return name return None except Exception: diff --git a/src/aipass/commons/apps/handlers/artifacts/trade_ops.py b/src/aipass/commons/apps/handlers/artifacts/trade_ops.py index e90f06df..5128cf73 100644 --- a/src/aipass/commons/apps/handlers/artifacts/trade_ops.py +++ b/src/aipass/commons/apps/handlers/artifacts/trade_ops.py @@ -54,8 +54,8 @@ RARITY_COLORS = { def _resolve_branch_name(mention: str) -> Optional[str]: - """Resolve a @mention to a branch name.""" - name = mention.lstrip("@").upper() + """Resolve a @mention to a branch name (lowercase-normalized).""" + name = mention.lstrip("@").lower() if not os.path.exists(BRANCH_REGISTRY_PATH): return None @@ -64,7 +64,7 @@ def _resolve_branch_name(mention: str) -> Optional[str]: with open(BRANCH_REGISTRY_PATH, encoding="utf-8") as f: registry = json.load(f) for branch in registry.get("branches", []): - if branch.get("name") == name: + if branch.get("name", "").lower() == name: return name return None except Exception: diff --git a/src/aipass/commons/apps/handlers/profiles/profile_ops.py b/src/aipass/commons/apps/handlers/profiles/profile_ops.py index b0b75958..f7bddbb5 100644 --- a/src/aipass/commons/apps/handlers/profiles/profile_ops.py +++ b/src/aipass/commons/apps/handlers/profiles/profile_ops.py @@ -58,7 +58,7 @@ def show_profile(args: List[str]) -> dict: # Determine which branch to show if args: - target_branch = args[0].upper() + target_branch = args[0].lower() else: caller = get_caller_branch() if not caller: diff --git a/src/aipass/commons/apps/handlers/search/search_ops.py b/src/aipass/commons/apps/handlers/search/search_ops.py index 581a7a6a..9401db72 100644 --- a/src/aipass/commons/apps/handlers/search/search_ops.py +++ b/src/aipass/commons/apps/handlers/search/search_ops.py @@ -62,7 +62,7 @@ def _parse_search_args(args: List[str]) -> dict: result["room"] = remaining[i + 1].lower() i += 2 elif flag == "--author" and i + 1 < len(remaining): - result["author"] = remaining[i + 1].upper() + result["author"] = remaining[i + 1].lower() i += 2 elif flag == "--type" and i + 1 < len(remaining): search_type = remaining[i + 1].lower() diff --git a/src/aipass/commons/apps/handlers/welcome/welcome_ops.py b/src/aipass/commons/apps/handlers/welcome/welcome_ops.py index 5573a523..4b972f38 100644 --- a/src/aipass/commons/apps/handlers/welcome/welcome_ops.py +++ b/src/aipass/commons/apps/handlers/welcome/welcome_ops.py @@ -55,7 +55,7 @@ def run_welcome(args: List[str]) -> dict: conn = get_db() if filtered_args: - branch_name = filtered_args[0].upper() + branch_name = filtered_args[0].lower() if dry_run: already = has_been_welcomed(conn, branch_name) close_db(conn) @@ -114,7 +114,7 @@ def _welcome_specific(conn, branch_name: str) -> dict: Returns: Dict with success and welcome result """ - agent = conn.execute("SELECT branch_name FROM agents WHERE branch_name = ?", (branch_name,)).fetchone() + agent = conn.execute("SELECT branch_name FROM agents WHERE LOWER(branch_name) = ?", (branch_name,)).fetchone() if not agent: return {"success": False, "error": f"Branch '{branch_name}' not found in The Commons."} diff --git a/src/aipass/commons/tests/test_curation_explore_welcome_ops.py b/src/aipass/commons/tests/test_curation_explore_welcome_ops.py index 81ecb46b..5a90e252 100644 --- a/src/aipass/commons/tests/test_curation_explore_welcome_ops.py +++ b/src/aipass/commons/tests/test_curation_explore_welcome_ops.py @@ -993,7 +993,7 @@ def test_run_welcome_dry_run_specific_branch( """run_welcome --dry-run reports whether the branch would be welcomed.""" from aipass.commons.apps.handlers.welcome.welcome_ops import run_welcome - _seed_agent(initialized_db, "GAMMA") + _seed_agent(initialized_db, "gamma") mock_get_db.return_value = initialized_db mock_close.side_effect = lambda c: None @@ -1001,7 +1001,7 @@ def test_run_welcome_dry_run_specific_branch( result = run_welcome(["gamma", "--dry-run"]) assert result["success"] is True assert result["dry_run"] is True - assert result["branch"] == "GAMMA" + assert result["branch"] == "gamma" assert result["would_welcome"] is True @@ -1076,7 +1076,7 @@ def test_run_welcome_specific_branch_success( """run_welcome creates a welcome post for that branch.""" from aipass.commons.apps.handlers.welcome.welcome_ops import run_welcome - _seed_agent(initialized_db, "EPSILON") + _seed_agent(initialized_db, "epsilon") mock_get_db.return_value = initialized_db mock_close.side_effect = lambda c: None @@ -1085,7 +1085,7 @@ def test_run_welcome_specific_branch_success( assert result["success"] is True assert result["action"] == "specific" assert result["already_welcomed"] is False - assert result["branch"] == "EPSILON" + assert result["branch"] == "epsilon" assert result["post_id"] is not None diff --git a/src/aipass/commons/tests/test_search.py b/src/aipass/commons/tests/test_search.py index 4ff57dc8..9c400656 100644 --- a/src/aipass/commons/tests/test_search.py +++ b/src/aipass/commons/tests/test_search.py @@ -58,10 +58,10 @@ def test_parse_search_args_room_flag(): def test_parse_search_args_author_flag(): - """The --author flag should set the author filter and uppercase it.""" + """The --author flag should set the author filter and lowercase it.""" result = _parse_search_args(["test", "--author", "drone"]) assert result["query"] == "test" - assert result["author"] == "DRONE" + assert result["author"] == "drone" def test_parse_search_args_type_flag_valid(): @@ -94,7 +94,7 @@ def test_parse_search_args_all_flags(): ) assert result["query"] == "registry" assert result["room"] == "dev" - assert result["author"] == "FLOW" + assert result["author"] == "flow" assert result["search_type"] == "posts"