You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Actual:**`WARNING: Cannot verify Bash redirect to variable-expanded path: "${SESSION_DIR}/squash-complete-${ISSUE_ID}"\n\nOne or more variables in the path could not be resolved.\n...`
20
20
21
21
## Root Cause
22
22
`ShellParser.expandEnvVars()` returns `null` on the first undefined variable but does not report which
23
23
variable failed. The caller in `BlockWorktreeIsolationViolation` has no way to name the undefined
24
24
variable(s) without re-scanning the target string.
25
25
26
+
The fix adds `ShellParser.findUndefinedVars()` which performs a second pass to collect the names,
27
+
called only when `expandEnvVars` already returned `null`.
28
+
26
29
## Risk Assessment
27
30
-**Risk Level:** LOW
28
-
-**Regression Risk:** Only changes the text of a warning message; no logic changes
29
-
-**Mitigation:**Add a unit test for the new `findUndefinedVars` method
31
+
-**Regression Risk:** Only changes the text of a warning message and adds a new method. No logic changes to existing methods.
32
+
-**Mitigation:**Unit tests for `findUndefinedVars`; full `mvn verify` confirms no regressions.
-`client/src/main/java/io/github/cowwoc/cat/claude/hook/bash/BlockWorktreeIsolationViolation.java` — replace "One or more variables..." with a list of the undefined variable names
34
-
-`client/src/test/java/io/github/cowwoc/cat/client/test/ShellParserTest.java` (or equivalent) — add tests for `findUndefinedVars`
35
-
36
-
## Test Cases
37
-
-[ ] Path with one undefined variable → list shows that one variable name
38
-
-[ ] Path with two undefined variables → list shows both names in order
39
-
-[ ] Path with all variables defined → returns empty list (no warning triggered)
36
+
-`client/src/main/java/io/github/cowwoc/cat/claude/hook/bash/BlockWorktreeIsolationViolation.java` — replace "One or more variables..." with specific variable names from `findUndefinedVars`
37
+
-`client/src/test/java/io/github/cowwoc/cat/client/test/ShellParserTest.java` — add tests for `findUndefinedVars`
-Build the second line of the warning from `undefinedList`:
85
+
-If `undefinedList` is non-empty (the common case): use `"Undefined variable(s): "+ undefinedList`
86
+
-If `undefinedList` is empty (e.g., the `$` comes from `$(...)` command substitution, which the pattern does not match): fall back to `"One or more variables in the path could not be resolved."`
87
+
-Implementthis as:
88
+
```java
89
+
String variableLine;
90
+
if (undefinedList.isEmpty())
91
+
variableLine ="One or more variables in the path could not be resolved.";
- [ ] Warning message names the specific undefined variable(s) (e.g., `Undefined variable(s):SESSION_DIR, ISSUE_ID`) instead of the generic "One or more variables..."
130
+
- [ ] `ShellParser.findUndefinedVars` tests pass: one undefined var, two undefined vars, all defined
68
131
- [ ] `mvn -f client/pom.xml verify -e` exits 0 with no new failures
0 commit comments