You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CI inference: step if: comparisons are case-sensitive, GitHub's are not #169
evaluateCondition (src/ci-inference/expression.ts) compares == and != operands with ===. GitHub Actions ignores case when comparing strings, so for matrix.os: ubuntu-latest GitHub evaluates if: matrix.os == 'Ubuntu-Latest' as true. DiffCI evaluates it as FALSE.
Impact
FALSE is the one result that inferPipeline acts on as "the step does not run". The operation gets willExecute: false and becomes executable by omission (infer.ts: condition?.result === "FALSE" ? { executable: true, missingRequirements: [], blockedBy: [] }). A test or build step that CI really runs then drops out of the reproduced path, while the pipeline still reports itself complete and optimisable. The module's own header calls this failure mode out as the dangerous one ("UNRESOLVED is not FALSE").
The reverse case breaks the same way: matrix.os != 'Windows-Latest' on a windows-latest cell is TRUE in DiffCI and false in GitHub.
Repro
import{evaluateCondition}from"./src/ci-inference/expression.js";evaluateCondition("matrix.os == 'Ubuntu-Latest'",{matrix: {os: "ubuntu-latest"}}).result;// main (40aa308): "FALSE" GitHub: true
Through inferPipeline, a npm test step with if: matrix.os == 'Ubuntu-Latest' in a { os: [ubuntu-latest] } matrix comes out as condition.result: "FALSE" and willExecute: false.
Failing test
tests/ci-inference/expression.test.ts in the linked PR. Output on main:
✖ `==` and `!=` compare strings ignoring case, as GitHub does
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
'FALSE' !== 'TRUE'
at TestContext.<anonymous> (tests/ci-inference/expression.test.ts:13:10)
✖ a step whose condition differs from the matrix value only in case still runs
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
'FALSE' !== 'TRUE'
at TestContext.<anonymous> (tests/ci-inference/expression.test.ts:27:10)
Not in scope
GitHub's number and boolean coercion is a separate question. For example, matrix.experimental == 'true' on a YAML boolean true is false in GitHub, because the string becomes NaN. matrix.ts stringifies scalars, so that type information is already gone before evaluation.
Activity
fix(ci-inference): compare if: strings ignoring case, as GitHub does (D…