Skip to content

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

Closed

Description

@FredApps

What happens

argvOf (src/ci-inference/infer.ts) turns a workflow run: line into an operation's command. It refuses lines with | & ; < > $ \ ( ) { }; everything else it splits on whitespace. schema.tsdocumentscommandas "argv, never a shell string, so it cannot be re-split differently later", but for ordinary shell syntax the argv is not whatsh` would pass. The operation is still marked executable with that wrong argv.

Repro with one workflow.step.run fact through inferPipeline on main (40aa308):

run: line command on main executable What sh does
npx jest --testNamePattern "user login" ["npx","jest","--testNamePattern","\"user","login\""] true one argument, user login
npx mocha --grep 'a b' ["npx","mocha","--grep","'a","b'"] true one argument, a b
npx jest --ci \ ["npx","jest","--ci","\\"] true joins the next line of the run: block
CI=true npx jest ["CI=true","npx","jest"] true sets CI and runs npx
npx jest # every test ["npx","jest","#","every","test"] true # starts a comment
npx jest src/*.test.js ["npx","jest","src/*.test.js"] true expands the glob first
npx jest ~/suite ["npx","jest","~/suite"] true expands ~

Impact

These are TEST operations reported executionRepresentation: RESOLVED and executable: true. A consumer that executes command runs something different from CI. It may pass literal quote characters to the runner, run CI=true as the program, or pass #, every, test as test patterns. The pipeline still counts as complete and optimisable. The engine's stated rule is that a command it cannot represent faithfully must be UNRESOLVED, not approximated.

Failing test

tests/ci-inference/argv.test.ts in the linked PR. Output on main:

✖ quotes are removed the way sh removes them
  + actual - expected
  +   '"user',
  +   'login"'
  -   'user login'
✖ shell syntax the splitter does not reproduce leaves the test step without argv
  + actual - expected
  + [ 'npx', 'jest', '--ci', '\\' ]
  - []
✔ plain words are still split as before

Activity

  1. added a commit that references this issue on Nov 18, 2026
    65d1f3d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions