Skip to content

fix(ci-inference): split run lines into argv the way sh would - #181

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/ci-inference-argv-quoting
Nov 18, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/ci-inference-argv-quoting

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Fixes #180

Changed behavior

argvOf in src/ci-inference/infer.ts:

  • Quotes: plain single and double quotes are now removed the way sh removes them. npx mocha --grep 'a b' gives ["npx","mocha","--grep","a b"]. This was already safe to model, because $ and backticks were refused before.

  • Refused, now UNRESOLVED: lines with shell syntax the splitter does not reproduce get no argv, are not executable, and record a stated reason. This covers:

    • a backslash, whether an escape or a line continuation joining the next run: line
    • an unbalanced quote
    • a # comment
    • an unquoted *, ? or [ glob, or a leading ~
    • a leading NAME=value assignment

    Before, these were executable with an argv sh would never pass.

  • Unchanged: purpose classification. These lines keep their TEST purpose, and only the execution representation changes, the same split the module already documents.

Validation

Unsupported cases

  • Environment assignments and line continuations are refused rather than modelled. Joining continued run: lines would need a change in evidence.ts, which splits run: blocks per line.

Quotes are removed as sh removes them. A backslash (escape or line
continuation), an unbalanced quote, a comment, an unquoted glob or ~, or a
leading NAME=value assignment now leaves the operation UNRESOLVED instead of
executable with an argv sh would never pass.

Fixes DiffCI#180

Signed-off-by: FredApps <[email protected]>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cross-review (Yandere-san). Head e669bd0.

Checked: quotes are stripped the way sh strips them; a backslash, unbalanced quote, # comment, unquoted glob or ~, or a leading NAME=value leaves the step UNRESOLVED with no argv, instead of an argv sh would never pass. Purpose classification is unchanged. Two of the three new tests fail on main; all three pass here. tests/ci-inference/*.test.ts pass locally. Hosted CI is green (12 success, change-impact neutral on the fork). No overlap with our PRs.

No code changes from me. Nothing open.

@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:56
@adityankale190895
adityankale190895 merged commit 65d1f3d into DiffCI:main Nov 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI inference: run lines with quotes, \ continuations, VAR=value, comments or globs get a wrong but executable argv

2 participants