Skip to content

id(repl): the trailing '-' content placeholder is never substituted — the ' -$' replace is a literal pattern, so here-string, pipe and heredoc content addressed to a trailing '-' is silently dropped #2280

Closed

Description

@dezren39

Summary

In the id REPL, the - content placeholder is only substituted when it appears mid-line (" - "). The end-of-line case was meant to be handled by a second replace, .replace(" -$", ...), but Rust's str::replace is a literal string replace — -$ is not a regex end anchor — so that pattern can only match the two literal characters -$, which never occur. The end-of-line substitution is dead code at all three sites, and content addressed to a trailing - is silently lost or misrouted.

Evidence (main 5a34fa70, verified this run)

Dead-pattern sites:

  • pkgs/id/src/repl/input.rs — here-string branch: .replace(" - ", ...) then .replace(" -$", ...)
  • pkgs/id/src/repl/input.rs — pipe branch: .replace(" - ", ...), .replace(" -\n", ...), .replace(" -$", ...) (all literal)
  • pkgs/id/src/repl/runner.rs:140-141 — heredoc completion: same " - " / " -$" pair

Laptop probe (verbatim copies of preprocess_repl_line/shell_capture from input.rs and the heredoc-completion replace chain from runner.rs, only error plumbing adapted; probe at ~/git/fleet/probe-2026-10-29-laneA-replinput/ on the laptop):

CTRL herestring mid:      Ready("put __STDIN_CONTENT__:payload name")
CTRL pipe mid:            Ready("put __STDIN_CONTENT__:hi name")
CTRL heredoc mid:         "put __STDIN_CONTENT__:BODY name"
A1 herestring dash-last:  Ready("put name -")                          <- 'payload' silently dropped
A2 pipe dash-last:        Ready("put name - __STDIN_CONTENT__:hi")     <- marker appended AFTER the '-'
A3 heredoc dash-last:     "put name -"                                 <- heredoc body silently discarded
PROOF replace:            "put name -".replace(" -$", " X") == "put name -"  (unchanged)

Downstream consequences, from repl/runner.rs:

  • Here-string (A1): the line executes as put name - — the here-string content never reaches the store; the - is treated as an ordinary argument.
  • Pipe (A2): the marker lands after the -, so handle_stdin_content (runner.rs:446) computes before == "put name -", which is not "put", and prints unknown command with content: put name - — the piped content is dropped with a misleading message.
  • Heredoc (A3): after the user types the whole heredoc body, completion leaves the line as put name -; the body is discarded and the command runs as a plain file put.

Why it matters

The REPL documents - as the content placeholder for put (module docs in input.rs), and users reasonably put it last (put name - <<< '...', ... |> put name -, put name - <<EOF). In each form the failure is silent data loss: the command appears to run, but the content the user supplied is not what gets stored — or nothing is stored and the error message points at the wrong cause. The dead " -$" pattern also misleads future readers into believing the end-of-line case is handled.

Acceptance criteria

  • A trailing - placeholder is substituted in all three paths (here-string, pipe, heredoc completion), or the trailing form is rejected with a clear error naming the placeholder position — one consistent behavior, pinned in the issue/PR.
  • No literal " -$" (or " -\n") replace patterns remain; the substitution logic is shared or identically tested at all sites it is needed.
  • Regression tests in pkgs/id/src/repl/input.rs / runner.rs covering: here-string with - last, pipe with - last, heredoc completion with - last, plus the existing mid-line controls.
  • Existing REPL preprocessing tests still pass.

Dedup / related

Activity

  1. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  2. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/normalOrdinary priority (the default)
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 29, 2026
  3. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Oct 31, 2026
  5. 98 remaining items

  6. added and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Oct 31, 2026
  7. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  8. added a commit that references this issue on Nov 1, 2026
  9. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions