Summary
dataset push doesn't expand a leading ~ in the dataset path, so a ~/… path resolves relative to the current directory instead of $HOME. Found while prepping a live demo of the interactive flow (#28).
Impact
Bites the interactive prompt in particular: a user types ~/tb-fixtures/tab-reg at the "Path to your dataset directory" prompt and gets:
Error: reading dataset directory "/Users/arturo/work/cli/~/tb-fixtures/tab-reg":
stat /Users/arturo/work/cli/~/tb-fixtures/tab-reg: no such file or directory
(Also affects a quoted/literal ~ passed as the positional arg, e.g. in a --no-input script.)
Why it happens
~ is expanded by the shell, not the program:
- On the command line,
tracebloc dataset push ~/x → the shell rewrites ~ → $HOME before the CLI runs, so the flag form works.
- From the survey prompt the shell isn't involved — the CLI receives the literal
~/x, and push.Discover / push.DiscoverTabular call filepath.Abs(rootDir), which doesn't expand ~; it just prepends the CWD.
The fix already exists in spirit: cluster.expandPath (internal/cluster/kubeconfig.go) does ~→$HOME for --kubeconfig; the dataset path goes through nothing equivalent.
Proposed fix
- Expand
~ / ~/… → $HOME for the dataset path, mirroring cluster.expandPath.
- Apply it in the CLI layer (
runDatasetPush, where a.LocalPath is resolved) so it covers both the interactive prompt and a quoted ~ arg in one place — before any Discover* call.
- (Bonus) give the interactive path prompt a survey validator that checks the directory exists and re-prompts, so a typo is caught in-flow instead of after.
Acceptance criteria
Workaround (in place)
Use an absolute path in the interactive prompt; the demo run-sheet was updated accordingly. The command-line flag form already tolerates ~ (shell-expanded).
🤖 Generated with Claude Code
Summary
dataset pushdoesn't expand a leading~in the dataset path, so a~/…path resolves relative to the current directory instead of$HOME. Found while prepping a live demo of the interactive flow (#28).Impact
Bites the interactive prompt in particular: a user types
~/tb-fixtures/tab-regat the "Path to your dataset directory" prompt and gets:(Also affects a quoted/literal
~passed as the positional arg, e.g. in a--no-inputscript.)Why it happens
~is expanded by the shell, not the program:tracebloc dataset push ~/x→ the shell rewrites~→$HOMEbefore the CLI runs, so the flag form works.~/x, andpush.Discover/push.DiscoverTabularcallfilepath.Abs(rootDir), which doesn't expand~; it just prepends the CWD.The fix already exists in spirit:
cluster.expandPath(internal/cluster/kubeconfig.go) does~→$HOMEfor--kubeconfig; the dataset path goes through nothing equivalent.Proposed fix
~/~/…→$HOMEfor the dataset path, mirroringcluster.expandPath.runDatasetPush, wherea.LocalPathis resolved) so it covers both the interactive prompt and a quoted~arg in one place — before anyDiscover*call.Acceptance criteria
~/xand~resolve under$HOME; relative (./x) and absolute paths unchanged.~positional arg.~/x→$HOME/x,./x, and absolute passthrough.make cigreen.Workaround (in place)
Use an absolute path in the interactive prompt; the demo run-sheet was updated accordingly. The command-line flag form already tolerates
~(shell-expanded).🤖 Generated with Claude Code