fix(costs): derive session name for mayor/deacon without GT_TOWN
Error: Ran 1 stop hook
⎿ Stop hook error: Failed with non-blocking status code: Error: --session flag required (or set GT_SESSION env var, or GT_RIG/GT_ROLE)
Usage:
gt costs record [flags]
deriveSessionName() now falls back to gt-{role} when GT_ROLE is mayor
or deacon but GT_TOWN is not set. Previously this case returned empty
string, causing the Stop hook to fail.
This commit is contained in:
@@ -61,6 +61,20 @@ func TestDeriveSessionName(t *testing.T) {
|
||||
},
|
||||
expected: "gt-ai-deacon",
|
||||
},
|
||||
{
|
||||
name: "mayor session without GT_TOWN",
|
||||
envVars: map[string]string{
|
||||
"GT_ROLE": "mayor",
|
||||
},
|
||||
expected: "gt-mayor",
|
||||
},
|
||||
{
|
||||
name: "deacon session without GT_TOWN",
|
||||
envVars: map[string]string{
|
||||
"GT_ROLE": "deacon",
|
||||
},
|
||||
expected: "gt-deacon",
|
||||
},
|
||||
{
|
||||
name: "no env vars",
|
||||
envVars: map[string]string{},
|
||||
|
||||
Reference in New Issue
Block a user