Skip to content

CI inference: step if: comparisons are case-sensitive, GitHub's are not #169

Closed

Description

@FredApps

What happens

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

  1. added a commit that references this issue on Nov 18, 2026
    93f22cb
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