Fix agent ID validation to accept any rig prefix (gt-w0fqg)
The ValidateAgentID function was hardcoded to only accept 'gt-' prefix, but beads rig uses 'bd-' prefix. Now accepts any valid prefix. Changes: - Extract prefix dynamically instead of hardcoding 'gt-' - Accept IDs like bd-mayor, bd-beads-polecat-pearl - Update error messages to be prefix-agnostic - Add test cases for alternative prefixes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
363c5a3819
commit
eb0cc50ce6
@@ -215,9 +215,13 @@ func TestValidateAgentID(t *testing.T) {
|
||||
{"valid crew", "gt-beads-crew-dave", false, ""},
|
||||
{"valid polecat with complex name", "gt-gastown-polecat-war-boy-1", false, ""},
|
||||
|
||||
// Invalid: wrong prefix
|
||||
{"wrong prefix bd", "bd-mayor", true, "must start with 'gt-'"},
|
||||
{"wrong prefix empty", "mayor", true, "must start with 'gt-'"},
|
||||
// Valid: alternative prefixes (beads uses bd-)
|
||||
{"valid bd-mayor", "bd-mayor", false, ""},
|
||||
{"valid bd-beads-polecat-pearl", "bd-beads-polecat-pearl", false, ""},
|
||||
{"valid bd-beads-witness", "bd-beads-witness", false, ""},
|
||||
|
||||
// Invalid: no prefix (missing hyphen)
|
||||
{"no prefix", "mayor", true, "must have a prefix followed by '-'"},
|
||||
|
||||
// Invalid: empty
|
||||
{"empty id", "", true, "agent ID is required"},
|
||||
@@ -242,7 +246,7 @@ func TestValidateAgentID(t *testing.T) {
|
||||
{"refinery with name", "gt-beads-refinery-extra", true, "cannot have name suffix"},
|
||||
|
||||
// Invalid: empty components
|
||||
{"empty after gt", "gt-", true, "must include content after"},
|
||||
{"empty after prefix", "gt-", true, "must include content after prefix"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user