Skip to content

data ingest: strip surrounding quotes from the path prompt + clarify dataset-name rules #386

Description

@LukasWodka

Summary

Two small UX papercuts in the interactive tracebloc data ingest flow that
repeatedly trip up users — especially when the dataset path contains a space.
Both are localized to the guided-prompt code and independent of each other.


Part 1 — strip surrounding quotes from the "Where is your data?" prompt

What happens. The interactive path prompt takes input literally — it is not
shell-parsed. If a user pastes a quoted path (common: dragging a folder into a
terminal auto-quotes it, and people habitually quote paths that contain spaces),
the quote characters become part of the path and the ingest fails:

? Where is your data? (file or folder) '/home/me/my data/train'
Error: no such file or directory: "'/home/me/my data/train'" — check the path to your dataset

Note the leading ' inside the reported path.

Proposed change. In the interactive path handler
(internal/cli/interactive.go, around the pr.Input("Where is your data? …")
answer where a.LocalPath is set, ~L140–154), strip one matching pair of
surrounding single or double quotes from the answer before expandHome /
statDatasetPath. Validate the de-quoted value in validateDatasetPath so the
re-prompt message is clean too.

Keep it conservative:

  • only strip when the first and last rune are the same quote char (' or ");
  • remove at most one outer pair; leave inner quotes untouched;
  • apply only to the interactive answer, not to the flag/positional path
    (the shell already de-quotes those).

Acceptance.

  • Pasting '…' or "…" at the prompt resolves identically to the bare path.
  • An unquoted path containing spaces still works (unchanged).
  • A path whose real name contains a quote is not corrupted (only a single
    matched outer pair is removed).

Part 2 — clarify the dataset-name rules in the hint + error

What happens. Dataset names must match [A-Za-z_][A-Za-z0-9_]*
(ValidateTableName, internal/push/spec.go). Hyphens and spaces are rejected,
but users reach for kebab-case (tsc-train) — partly because tracebloc
slugifies client/namespace names with hyphens elsewhere (internal/slug). The
current hint says "letters, digits, underscores" but never states that hyphens
and spaces are not allowed, so the rejection feels surprising:

? What should we call this dataset? tsc-train
X Sorry, your reply was invalid: table name "tsc-train" is invalid: must start with a
  letter or underscore, then letters, digits, and underscores only …

Proposed change.

  • Update the name prompt hint (internal/cli/interactive.go, the PromptHint
    above the "What should we call this dataset?" input) to spell out
    "no hyphens or spaces — use _", with an example like churn_train.
  • Add the same "no hyphens or spaces (use _)" clause to the first line of
    the ValidateTableName error (internal/push/spec.go, ~L116) so it's obvious
    before the MySQL/PVC rationale.

Acceptance.

  • Both the hint and the error explicitly mention that hyphens/spaces are not
    allowed and that _ is the separator.
  • No change to what is accepted/rejected — wording only.

Files

  • internal/cli/interactive.go (both parts)
  • internal/push/spec.go (Part 2 error text)

Notes

  • Found while ingesting datasets from a folder whose path contained a space —
    the quoted-path failure and the hyphenated-name rejection hit back to back.
  • Small and well-scoped; reasonable as a good first issue. PR targets develop.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions