Skip to content

fix(attach): treat backslash-newline as a line continuation in splitShellWords - #392

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:mainfrom
Karibhou:fix/391-backslash-newline
Oct 27, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:mainfrom
Karibhou:fix/391-backslash-newline

Conversation

@Karibhou

Copy link
Copy Markdown
Contributor

Summary

splitShellWords kept a literal newline for \ followed by a newline, both outside quotes and inside double quotes (splitShellWords('x\\\ny') returned ['x\ny']). POSIX treats this as a line continuation and removes both characters, so it now returns ['xy'].

  • src/attach.ts: in the escape branch, a newline after a backslash is dropped together with the backslash and does not start a word ('\\\n' alone yields []). Single quotes are unchanged (both characters stay literal).
  • test/attach-orchestration.test.js: new test covering unquoted, double-quoted, between-words, standalone and single-quoted cases.
  • changelog.d/fixed-split-shell-words-line-continuation.md: changelog fragment.

Testing

npm test: 618/618 pass, coverage thresholds met.

Closes #391

🤖 Generated with Claude Code

https://claude.ai/code/session_01HRH6kjqKvEtEADvCEWcAm8

— hive: backend=claude model=claude-opus-5-5


🐝 Hive Agent: contributor | SHA: e9be6c3

…hellWords

POSIX removes both characters of a backslash-newline, outside quotes and
inside double quotes. splitShellWords kept a literal newline instead
(splitShellWords('x\\\ny') => ['x\ny']); it now yields ['xy'].

Closes hivecommons#391

Hive-Run: hivecommons#391
Hive-Plan: review-backlog/correctness
Hive-Spec: pluk-attach#split-shell-words-line-continuation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HRH6kjqKvEtEADvCEWcAm8
Signed-off-by: Karibhou <[email protected]>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 27, 2026
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kellyaa for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

Copy link
Copy Markdown

Welcome to the Hive Commons community!

Thanks for opening your first PR here! We're excited to have you contributing.

Before merge, please ensure:

  • DCO Sign-off — All commits signed with git commit -s (DCO)
  • PR Title — Starts with an emoji: ✨ feature | 🐛 bug fix | 📖 docs | 🌱 infra/tests | ⚠️ breaking

A maintainer will review your PR soon. Hope you have a great time here!

@kubestellar-prow kubestellar-prow Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 27, 2026
@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read splitShellWords in full at e9be6c3 (src/attach.ts:67-111) and its eight callers (attach.ts:46,120,133,229,360,383,448, cli.ts:249). This looks correct to me.

  • Moving escaping = false ahead of the \n check (src/attach.ts:75-78) is what makes '\\\n' alone yield []: started is never set, so the end-of-input if (started) words.push(current) at :110 does nothing. Traced a \\\n b → ['a','b'] and x \\\n → ['x'], both matching POSIX.
  • Dropping \n from the double-quote kept-backslash set (:79) is consistent: the newline case is now consumed one line earlier, so the set only needs the four POSIX-special characters.
  • The trailing-lone-backslash path (:106-109) is unchanged and still only fires when the input ends in \.
  • Single-quote behaviour is unchanged because :84 already skips escape handling when quote === "'".

npm test at this head: 618/618 pass, coverage thresholds met. Resolves #391 as the issue states it.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/095-pre-merge-soak Lane admitted; the pre-merge soak window is running before the merge is attempted and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 27, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit 6c9da75 into hivecommons:main Oct 27, 2026
12 of 13 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#392e9be6c3` sha256:25a23e841a1863ae9052a309faf55916b7c41637117413faa92c4195bc9346c1 — download from the dashboard or `hivectl review evidence #392`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Merged by hive contributor-lane auto-merge: CI green for ≥30m, reviewer verdict approve, @Karibhou holds the trusted tier in this hive's contributor registry.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/095-pre-merge-soak Lane admitted; the pre-merge soak window is running before the merge is attempted labels Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review backlog (correctness): Backslash-newline is not treated as a line continuation

1 participant