File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -564,10 +564,22 @@ func normalizeAddress(s string) string {
564564 return "deacon/"
565565 }
566566
567+ // Resolve rig-scoped town-level roles to their canonical form (gt-te23).
568+ // "gastown/mayor" → "mayor/", "gastown/deacon" → "deacon/"
569+ // Mayor and deacon are town-level singletons, not rig-level agents.
570+ parts := strings .Split (s , "/" )
571+ if len (parts ) == 2 {
572+ switch parts [1 ] {
573+ case "mayor" :
574+ return "mayor/"
575+ case "deacon" :
576+ return "deacon/"
577+ }
578+ }
579+
567580 // Normalize crew/ and polecats/ to canonical form:
568581 // "rig/crew/name" → "rig/name"
569582 // "rig/polecats/name" → "rig/name"
570- parts := strings .Split (s , "/" )
571583 if len (parts ) == 3 && (parts [1 ] == "crew" || parts [1 ] == "polecats" ) {
572584 return parts [0 ] + "/" + parts [2 ]
573585 }
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ func TestAddressToIdentity(t *testing.T) {
1717 {"deacon" , "deacon/" },
1818 {"deacon/" , "deacon/" },
1919
20+ // Rig-scoped town-level roles resolve to canonical form (gt-te23)
21+ {"gastown/mayor" , "mayor/" },
22+ {"gastown/deacon" , "deacon/" },
23+ {"laser/mayor" , "mayor/" },
24+ {"laser/deacon" , "deacon/" },
25+
2026 // Rig-level agents: crew/ and polecats/ normalized to canonical form
2127 {"gastown/polecats/Toast" , "gastown/Toast" },
2228 {"gastown/crew/max" , "gastown/max" },
You can’t perform that action at this time.
0 commit comments