Repository navigation
Commit 4f7dc60
committed
fix(server): anchor Nushell imports to the worktree
Nushell parses --commands before evaluating its leading cd. If login.nu
changes directories, relative source and use statements can select files
from the login directory even when the action runs in the worktree.
Use Nu's mktemp, save, to nuon, source, and rm commands to load the action
from a temporary .nu file in the worktree. Relative imports resolve against
that file's directory, and the child retains the user's login definitions.
Remove the file before the action runs so it does not appear in git status;
clean it up in the parent when parsing fails. Preparation errors still
report a numeric completion status. Guard null catch arguments on older Nu.
Extend the existing mocked-terminal table with source/use input and assert
the complete native wrapper. The expanded assertion fails before the fix.
vp run check:changed passes, including 12 tests in two affected files.
Runtime: 60 PTY cases and eight preparation-failure cases passed on macOS
with Nushell 0.97.1, 0.98.0, 0.99.1, and 0.116.1. Login startup changes cwd;
both directories contain conflicting setup.nu and module.nu files:
before: source ./setup.nu -> SOURCE-WRONG, status 0
before: use ./module.nu *; location -> MODULE-WRONG, status 0
after: source ./setup.nu -> SOURCE-WORKTREE, status 0
after: use ./module.nu *; location -> MODULE-WORKTREE, status 0
file present only in login cwd -> diagnostic, status 1, no leftover
exit 0 / exit 7 / error make -> statuses 0 / 7 / 1
Nested imports, login-defined commands, multiline quoting, paths with spaces
and quotes, TTY input/output, and cleanup passed. Creation and save errors
show diagnostics and report status 1 without running the action.
Model and harness: GPT-6.1 Sol through Codex in T3 Code.1 parent 7f9ac59 commit 4f7dc60
2 files changed
Lines changed: 23 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
129 | 133 | | |
130 | 134 | | |
131 | 135 | | |
| |||
143 | 147 | | |
144 | 148 | | |
145 | 149 | | |
146 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
| 193 | + | |
| 194 | + | |
197 | 195 | | |
198 | | - | |
199 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
200 | 205 | | |
201 | 206 | | |
202 | 207 | | |
| |||
0 commit comments