{"title":"Debug CI-Only Test Failures with Environment Evidence","excerpt":"A date test passed in India and failed on ubuntu-latest because the code asked the host what day it was. Record a fingerprint on both machines, diff it, and replay each CI value locally until one flips the result. Covers time zone, locale, the CI variable, shallow clones, case sensitivity and CPU count.","canonicalUrl":"https://automationtester.in/blog/automation-tutorials/debug-ci-only-failures-environment-evidence","category":{"name":"Automation Tutorials","slug":"automation-tutorials"},"tags":["github-actions","ci-cd","debugging","test-environment","time-zones","nodejs"],"author":{"name":"Shashank Rawlani","url":"https://shashank.rawlani.com","linkedin":"https://www.linkedin.com/in/shashankrawlani/"},"datePublished":"2026-11-15T13:30:00.000Z","dateModified":"2026-11-15T13:30:00.000Z","coverImage":{"url":"https://ik.imagekit.io/automationtester/automationtester-in/blog/covers/v3/debug-ci-only-failures-environment-evidence.webp","alt":"Dark technical illustration: two tall side-by-side panels hold matching columns of green pills, one row per line, with most rows equal in length and a few rows visibly different. From each differing row a lane runs right through a dashed vertical gate. Three lanes continue as dashed green lines ending in small green dots, while one lane, starting from an orange pill in the second column, turns solid orange and ends at a ringed orange node near the right edge. Faint rules and grey pills extend across both edges."},"contentHtml":"<div class=\"callout callout-info\"><strong>Quick answer:</strong> A test that passes on your machine and fails in CI is reporting a difference between two machines. Before you edit the assertion, record the same fingerprint on both sides (runtime and data versions, time zone, locale, CPU count, the <code>CI</code> variable, clone depth, filesystem case sensitivity), diff the two, then replay the CI values locally one at a time. The difference that flips the result is the cause, and it usually lives in the code under test, not in the test.</div>\n\n<p>The failure looks like this. On a laptop in India the suite is green. On <code>ubuntu-latest</code> the same commit fails with the output below, reproduced here on the laptop under the runner's time zone:</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">✖ an order at 01:30 IST counts toward that IST day (2.169458ms)\n  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:\n  + actual - expected\n\n  + '2026-11-15'\n  - '2026-11-16'\n              ^</code></pre>\n\n<p>The quickest way to a green build is to change <code>'2026-11-16'</code> to <code>'2026-11-15'</code>. That edit would ship a daily report that files every Indian order placed between midnight and 05:30 local time under the previous day. The expected value was correct. The code under test asked the host machine what day it was, and the two hosts gave different answers.</p>\n\n<p>This part of the series is about finding that kind of difference with evidence instead of guesswork. The platform throughout is GitHub Actions on GitHub-hosted runners; self-hosted runners have whatever you installed on them, which makes the fingerprint below more useful, not less.</p>\n\n<h2 id=\"what-the-hosted-runner-changes\">What a hosted runner changes before your first step runs</h2>\n\n<p>Several differences are fixed by the platform, and each one has broken real suites. All of these are documented, so you can check them rather than guess:</p>\n\n<ul>\n<li><strong>CPU and memory depend on repository visibility.</strong> A standard <code>ubuntu-latest</code> runner has 4 CPUs and 16 GB of RAM for a public repository, and 2 CPUs and 8 GB for a private one. <code>macos-latest</code> is a 3-core M1 with 7 GB in both cases. A laptop with ten cores runs several times more test workers than the private-repo runner.</li>\n<li><strong>The clock reads UTC.</strong> The macOS image build runs <code>ln -sf /usr/share/zoneinfo/UTC /etc/localtime</code> and the Windows build calls <code>Set-TimeZone -Id \"UTC\"</code>. The Ubuntu build scripts contain no time zone step, so the base image decides; print it rather than assume it.</li>\n<li><strong><code>CI</code> is always <code>true</code>.</strong> GitHub sets it on every job, and test runners read it to change behaviour.</li>\n<li><strong>The checkout holds one commit.</strong> <code>actions/checkout</code> fetches only the triggering commit by default (<code>fetch-depth: 1</code>), so tags and history are absent.</li>\n<li><strong><code>ubuntu-latest</code> is moving.</strong> GitHub announced that the label moves from Ubuntu 24.04 to 26.04 in a rollout beginning 19 October 2026 and planned to finish by 19 November 2026. During that window, two runs of one commit can land on different operating systems. In the 20261101 image builds, the default <code>node</code> on <code>PATH</code> is 22.23.4 on 24.04 and 24.22.2 on 26.04; Python goes from 3.12.3 to 3.14.4, and OpenSSL from 3.0.13 to 3.5.5.</li>\n<li><strong>The image changes weekly even on a pinned label.</strong> The runner-images project typically deploys software updates every week. The exact image version for a run is printed in the <code>Set up job</code> step, and the Ubuntu images also export it as <code>ImageVersion</code>, alongside <code>ImageOS</code>.</li>\n</ul>\n\n<div class=\"callout callout-warning\"><strong>Versions checked on 2026-11-09:</strong> Ubuntu 24.04 image 20261101.360.1 and Ubuntu 26.04 image 20261101.186.1 from the actions/runner-images READMEs; <code>actions/checkout</code> v7.0.1 and <code>actions/setup-node</code> v7.1.0 are the latest releases. The outputs below were produced with Node.js v26.12.1 on an arm64 Mac. The scripts also run on Node 22.</div>\n\n<h2 id=\"environment-fingerprint-script\">Record the same fingerprint on both machines</h2>\n\n<p>A fingerprint is a short JSON document of the facts that change test behaviour. The script has to run unchanged on a laptop and on a runner, so it uses only Node's standard library. It prints environment values only for an allowlist, and reports every other variable by name. GitHub redacts secret values it recognises in logs, but its own documentation says that redaction is not guaranteed once a value has been transformed, so a full <code>env</code> dump in a log is a leak waiting to happen.</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">// scripts/fingerprint.mjs\nimport { execFileSync } from \"node:child_process\";\nimport { existsSync, rmSync, writeFileSync } from \"node:fs\";\nimport { lookup } from \"node:dns/promises\";\nimport os from \"node:os\";\n\nconst SHOW_VALUES = [\n  \"CI\", \"TZ\", \"LANG\", \"LC_ALL\", \"LC_TIME\", \"NODE_OPTIONS\", \"NODE_ENV\",\n  \"ImageOS\", \"ImageVersion\", \"RUNNER_OS\", \"RUNNER_ARCH\", \"RUNNER_ENVIRONMENT\",\n];\nconst PRESENCE_ONLY = [\"HTTP_PROXY\", \"HTTPS_PROXY\", \"NO_PROXY\", \"http_proxy\", \"https_proxy\", \"no_proxy\"];\n\nfunction caseSensitive(dir) {\n  const probe = `${dir}/.Case-Probe-${process.pid}`;\n  writeFileSync(probe, \"\");\n  const sensitive = !existsSync(`${dir}/.case-probe-${process.pid}`);\n  rmSync(probe);\n  return sensitive;\n}\n\nfunction git(...args) {\n  try {\n    return execFileSync(\"git\", args, { encoding: \"utf8\", stdio: [\"ignore\", \"pipe\", \"ignore\"] }).trim();\n  } catch {\n    return null;\n  }\n}\n\nconst intl = Intl.DateTimeFormat().resolvedOptions();\nconst probeInstant = new Date(\"2026-11-15T20:00:00Z\");\n\nconsole.log(JSON.stringify({\n  runtime: { node: process.version, icu: process.versions.icu, tzdata: process.versions.tz },\n  host: {\n    platform: process.platform,\n    arch: process.arch,\n    release: os.release(),\n    parallelism: os.availableParallelism(),\n    memoryGiB: Math.round(os.totalmem() / 2 ** 30),\n  },\n  intl: {\n    timeZone: intl.timeZone,\n    locale: intl.locale,\n    offsetMinutes: -probeInstant.getTimezoneOffset(),\n    sample: probeInstant.toLocaleString(),\n  },\n  fs: { caseSensitive: caseSensitive(process.cwd()) },\n  git: {\n    shallow: git(\"rev-parse\", \"--is-shallow-repository\"),\n    describe: git(\"describe\", \"--tags\", \"--always\"),\n  },\n  network: {\n    localhost: (await lookup(\"localhost\", { all: true })).map((a) =&gt; a.address),\n    proxies: PRESENCE_ONLY.filter((name) =&gt; name in process.env),\n  },\n  env: Object.fromEntries(SHOW_VALUES.map((name) =&gt; [name, process.env[name] ?? null])),\n  envNames: Object.keys(process.env).sort(),\n}, null, 2));</code></pre>\n\n<p>Two fields carry more weight than they look. <code>intl.sample</code> formats one fixed instant with the machine's defaults, so it captures the combined effect of zone, locale and ICU data in a single string you can compare by eye. <code>runtime.tzdata</code> is the version of the time zone rules bundled with Node, worth comparing whenever a failure involves a zone whose rules changed recently.</p>\n\n<p>In the workflow, run it as a step <em>before</em> the tests. It then runs whether or not the tests later fail, so you do not need <code>if: always()</code>, and the fingerprint sits in the log of every run, green or red:</p>\n\n<pre class=\"language-yaml\"><code class=\"language-yaml\">      - name: Environment fingerprint\n        run: node scripts/fingerprint.mjs\n      - name: Tests\n        run: node --test</code></pre>\n\n<p>Keeping that output after the job ends, alongside traces and reports, is a retention question this series takes up separately. For diagnosis, copying the JSON from the log is enough.</p>\n\n<h2 id=\"diff-two-fingerprints\">Diff the two fingerprints before forming a theory</h2>\n\n<p>Reading two 40-line JSON blobs side by side is how a difference gets missed. Flatten them and print only what differs:</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">// scripts/diff-fingerprints.mjs local.json ci.json\nimport { readFileSync } from \"node:fs\";\n\nconst [a, b] = process.argv.slice(2).map((f) =&gt; JSON.parse(readFileSync(f, \"utf8\")));\n\nfunction flatten(obj, prefix = \"\", out = {}) {\n  for (const [key, value] of Object.entries(obj)) {\n    const path = prefix ? `${prefix}.${key}` : key;\n    if (value &amp;&amp; typeof value === \"object\" &amp;&amp; !Array.isArray(value)) flatten(value, path, out);\n    else out[path] = JSON.stringify(value);\n  }\n  return out;\n}\n\nconst { envNames: namesA, ...restA } = a;\nconst { envNames: namesB, ...restB } = b;\nconst fa = flatten(restA);\nconst fb = flatten(restB);\n\nfor (const key of [...new Set([...Object.keys(fa), ...Object.keys(fb)])].sort()) {\n  if (fa[key] !== fb[key]) console.log(`${key.padEnd(22)} local=${fa[key]}  ci=${fb[key]}`);\n}\nconst onlyCi = namesB.filter((n) =&gt; !namesA.includes(n));\nconsole.log(`env only in ci (${onlyCi.length}): ${onlyCi.join(\" \")}`);</code></pre>\n\n<p>To keep this example reproducible without a real runner, the CI side below was produced on the same laptop from a shallow local clone, with <code>CI=true</code>, <code>TZ=Etc/UTC</code> and <code>LANG=C.UTF-8</code> injected. On a real run, you paste the JSON from the job log instead, and the host fields (platform, CPU count, memory, Node version) will differ too.</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">env.CI                 local=null  ci=\"true\"\nenv.LANG               local=\"en_IN.UTF-8\"  ci=\"C.UTF-8\"\nenv.TZ                 local=null  ci=\"Etc/UTC\"\ngit.describe           local=\"v1.4.0-1-gdf1792d\"  ci=\"df1792d\"\ngit.shallow            local=\"false\"  ci=\"true\"\nintl.locale            local=\"en-IN\"  ci=\"en-US\"\nintl.offsetMinutes     local=330  ci=0\nintl.sample            local=\"16/11/2026, 1:30:00 AM\"  ci=\"11/15/2026, 8:00:00 PM\"\nintl.timeZone          local=\"Asia/Calcutta\"  ci=\"UTC\"\nenv only in ci (2): CI TZ</code></pre>\n\n<p>Nine differences, and nothing yet says which of them matters. The <code>intl.sample</code> line already shows the shape of the bug: the same instant is the 16th on one machine and the 15th on the other. A theory still has to be tested, because the locale and <code>CI</code> differences are plausible culprits too.</p>\n\n<h2 id=\"bisect-environment-differences\">Replay one difference at a time</h2>\n\n<p>The next script reads the CI fingerprint, picks the variables you can reproduce in a shell, and reruns the failing command once per difference, then once with all of them. It is a bisection over the environment instead of over commits:</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">// scripts/bisect-env.mjs ci.json -- &lt;test command...&gt;\nimport { spawnSync } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\n\nconst sep = process.argv.indexOf(\"--\");\nconst ci = JSON.parse(readFileSync(process.argv[2], \"utf8\"));\nconst [cmd, ...args] = process.argv.slice(sep + 1);\n\nconst candidates = {\n  TZ: ci.env.TZ ?? ci.intl.timeZone,\n  LANG: ci.env.LANG,\n  LC_ALL: ci.env.LC_ALL,\n  CI: ci.env.CI,\n  NODE_OPTIONS: ci.env.NODE_OPTIONS,\n};\nconst diffs = Object.entries(candidates).filter(\n  ([name, value]) =&gt; value != null &amp;&amp; process.env[name] !== value,\n);\n\nfunction run(label, overrides) {\n  const r = spawnSync(cmd, args, { env: { ...process.env, ...overrides }, stdio: \"ignore\" });\n  console.log(`${r.status === 0 ? \"pass\" : \"FAIL\"}  ${label}`);\n}\n\nrun(\"baseline (this shell)\", {});\nfor (const [name, value] of diffs) run(`${name}=${value}`, { [name]: value });\nrun(\"all CI values together\", Object.fromEntries(diffs));</code></pre>\n\n<p>Note the fallback on <code>TZ</code>: a runner usually has no <code>TZ</code> variable at all, because its zone comes from the system clock configuration. The fingerprint's resolved <code>intl.timeZone</code> is what you replay. Running <code>node scripts/bisect-env.mjs ci.json -- node --test</code> prints:</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">pass  baseline (this shell)\nFAIL  TZ=Etc/UTC\npass  LANG=C.UTF-8\npass  CI=true\nFAIL  all CI values together</code></pre>\n\n<p>The time zone alone reproduces it; the locale and <code>CI</code> do not. The \"all together\" line is the control: if it passed while CI still failed, the cause would be outside what a shell can replay, such as CPU count, the Node version or the clone depth, and you would move to the next section's checks.</p>\n\n<p>One more sweep is worth the ten seconds. Here is the code under test, and the same two tests run under three zones:</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">// src/day-key.mjs (the version that fails in CI)\nexport function dayKey(input) {\n  const d = new Date(input);\n  const pad = (n) =&gt; String(n).padStart(2, \"0\");\n  return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n}</code></pre>\n\n<pre class=\"language-text\"><code class=\"language-text\">TZ=Asia/Kolkata\n  ✔ a date-only string keeps its own day\n  ✔ an order at 01:30 IST counts toward that IST day\nTZ=Etc/UTC\n  ✔ a date-only string keeps its own day\n  ✖ an order at 01:30 IST counts toward that IST day\nTZ=America/Los_Angeles\n  ✖ a date-only string keeps its own day\n  ✖ an order at 01:30 IST counts toward that IST day</code></pre>\n\n<p>The second test, <code>dayKey(\"2026-11-15\")</code>, passes in India and in UTC and fails in California, returning <code>2026-11-14</code>. That follows from a rule in the ECMAScript specification that surprises people who have used <code>Date</code> for years: when a string has no UTC offset, <em>date-only forms are interpreted as UTC and date-time forms as local time</em>. <code>\"2026-11-15\"</code> is midnight UTC, which is still the 14th west of Greenwich, and <code>getDate()</code> reads it in local time. A contributor in California would have hit a different failure from the same function, and CI would never have shown it.</p>\n\n<h2 id=\"fix-host-dependent-dates\">Remove the host from the answer, then prove it</h2>\n\n<p>The fix belongs in the code. A business day is defined in the business's zone, so name that zone instead of inheriting one from whichever machine runs the code:</p>\n\n<pre class=\"language-javascript\"><code class=\"language-javascript\">// src/day-key.mjs (fixed)\nconst parts = new Intl.DateTimeFormat(\"en\", {\n  timeZone: \"Asia/Kolkata\",\n  year: \"numeric\",\n  month: \"2-digit\",\n  day: \"2-digit\",\n});\n\nexport function dayKey(input) {\n  if (/^\\d{4}-\\d{2}-\\d{2}$/.test(input)) return input; // already a day\n  const p = Object.fromEntries(\n    parts.formatToParts(new Date(input)).map(({ type, value }) =&gt; [type, value]),\n  );\n  return `${p.year}-${p.month}-${p.day}`;\n}</code></pre>\n\n<p><code>formatToParts</code> is used instead of formatting with a locale whose pattern happens to look like <code>YYYY-MM-DD</code>, because that pattern comes from CLDR data, and the fingerprint already showed that locale data varies between machines.</p>\n\n<p>The tempting alternative is <code>\"test\": \"TZ=UTC node --test\"</code> in <code>package.json</code>. That makes every machine agree, which feels like a fix, and it removes the only signal you had: production servers and users' browsers do not run with your test script's environment. Pin the zone if you must, but also run the suite under zones far from UTC in both directions so a host dependency cannot hide. <code>Pacific/Kiritimati</code> runs at UTC+14, so it catches the mistakes that UTC-8 misses:</p>\n\n<pre class=\"language-yaml\"><code class=\"language-yaml\">jobs:\n  test:\n    runs-on: ubuntu-24.04\n    strategy:\n      fail-fast: false\n      matrix:\n        tz: [Etc/UTC, Asia/Kolkata, America/Los_Angeles, Pacific/Kiritimati]\n    env:\n      TZ: ${{ matrix.tz }}\n    steps:\n      - uses: actions/checkout@v7\n      - uses: actions/setup-node@v7\n        with:\n          node-version: 24\n      - name: Environment fingerprint\n        run: node scripts/fingerprint.mjs\n      - name: Tests\n        run: node --test</code></pre>\n\n<p><code>fail-fast: false</code> matters here. The default is <code>true</code>, which cancels the rest of the matrix on the first failure, and the point of this job is to see <em>which</em> zones fail. With the fixed code, all four zones pass locally:</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">TZ=Asia/Kolkata ℹ pass 2 ℹ fail 0\nTZ=Etc/UTC ℹ pass 2 ℹ fail 0\nTZ=America/Los_Angeles ℹ pass 2 ℹ fail 0\nTZ=Pacific/Kiritimati ℹ pass 2 ℹ fail 0</code></pre>\n\n<p>The <code>runs-on</code> and <code>node-version</code> pins are deliberate as well. <code>actions/setup-node</code> documents that without <code>node-version</code> it uses whatever Node is on <code>PATH</code>, which on <code>ubuntu-latest</code> changed major version during the 26.04 migration. If you want a preview of the next label, add <code>ubuntu-26.04</code> as a second <code>runs-on</code> value; matrix shapes like that are easier to check before you push with the <a href=\"/blog/tools-reviews/preview-github-actions-matrix-include-exclude\">matrix include and exclude preview</a>.</p>\n\n<h2 id=\"ci-only-causes-and-tells\">Other differences, and the check that singles each one out</h2>\n\n<p>The time zone was this failure. Each cause below shows up in a different fingerprint field and needs its own check, so you can rule it in or out in one command.</p>\n\n<h3 id=\"default-locale-from-lang\">The default locale follows <code>LANG</code></h3>\n\n<p>Node ships with full ICU data by default, so every locale is available, and in practice the default one follows the locale variables. The same Node v26.12.1 binary on macOS prints the resolved locale and formats one instant like this, with only <code>LANG</code> changed and the zone left at IST:</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">C.UTF-8      en-US  11/16/2026\nen_IN.UTF-8  en-IN  16/11/2026\nde_DE.UTF-8  de-DE  16.11.2026</code></pre>\n\n<p>The tell is a failure that mentions number or date <em>formatting</em> rather than a different value: commas against full stops, day and month swapped, or a sort order that changed. Check by replaying <code>LANG</code> and <code>LC_ALL</code> from the CI fingerprint. The fix is to pass an explicit locale to every <code>toLocale*</code>, <code>Intl.*</code> and <code>localeCompare</code> call whose output a test asserts.</p>\n\n<h3 id=\"ci-variable-switches-behaviour\">The <code>CI</code> variable changes what your tools do</h3>\n\n<p>Jest's default for its <code>ci</code> option is the result of the <code>ci-info</code> package's detection, so on a runner it is on without any flag. In that mode a missing snapshot is a failure instead of a new file:</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">New snapshot was not written. The update flag must be explicitly passed to write a new snapshot.\n\nThis is likely because this test is run in a continuous integration (CI) environment in which snapshots are not written by default.</code></pre>\n\n<p>Locally the same test writes the snapshot and passes, so the snapshot file was never committed. Check with <code>CI=true</code> in your shell. Fix by committing the snapshot. Search your own config for <code>process.env.CI</code> as well. The example configuration in Playwright's documentation uses it three times: <code>forbidOnly: !!process.env.CI</code>, <code>retries: process.env.CI ? 2 : 0</code> and <code>workers: process.env.CI ? 1 : undefined</code>, so a copied config runs one worker with retries on CI and the default worker count without retries on the laptop.</p>\n\n<h3 id=\"case-insensitive-imports\">Imports that only resolve on a case-insensitive disk</h3>\n\n<p>Apple's Disk Utility documentation describes case sensitivity as a separate APFS variant, so a default Mac volume ignores case, and Microsoft documents the same default for Windows. Linux filesystems are case-sensitive. On a Mac, <code>import(\"./src/Day-Key.mjs\")</code> loads <code>day-key.mjs</code> without complaint; on a Linux runner the ESM loader cannot resolve it and throws <code>ERR_MODULE_NOT_FOUND</code>. The fingerprint's <code>fs.caseSensitive</code> tells you whether this class of bug is even possible on a machine. Check with <code>git ls-files src</code>, which shows the name git actually tracks, and fix the import to match.</p>\n\n<h3 id=\"one-commit-checkout\">A checkout with no tags or history</h3>\n\n<p>Anything that derives a version from git breaks on the default checkout. A depth-1 clone of a tagged repository gives:</p>\n\n<pre class=\"language-text\"><code class=\"language-text\">$ git describe --tags\nfatal: No names found, cannot describe anything.</code></pre>\n\n<p>The tell is <code>git.shallow: \"true\"</code> and a <code>git.describe</code> that is a bare hash. Set <code>fetch-depth: 0</code> on <code>actions/checkout</code> for the job that needs history, rather than for every job, because a full clone costs time on large repositories.</p>\n\n<h3 id=\"worker-count-from-cpu\">Fewer CPUs means fewer, different workers</h3>\n\n<p>Runners size their parallelism from the CPU count unless told otherwise. <code>node --test</code> runs <code>os.availableParallelism() - 1</code> files at once, Jest uses the available cores minus one, and Playwright defaults to half the logical cores. On a 10-core laptop that is 9 concurrent test files under <code>node --test</code>; on a private-repo runner with 2 CPUs it is 1. A suite whose timeouts were tuned on the laptop, or whose tests only pass in a particular order, behaves differently on the runner. Compare <code>host.parallelism</code>, then reproduce with <code>--test-concurrency=1</code>, <code>--maxWorkers=1</code> or <code>--workers=1</code>. If the failure appears only when <em>more</em> workers share a database or account, that is a collision problem, covered in <a href=\"/blog/automation-tutorials/eliminate-ci-test-data-collisions\">eliminating CI test data collisions</a>.</p>\n\n<h3 id=\"localhost-and-proxies\">Name resolution and proxies</h3>\n\n<p><code>network.localhost</code> records the order in which <code>localhost</code> resolves. On the laptop above it is <code>::1</code> before <code>127.0.0.1</code>. A test server that binds only one of those, contacted by a client that tries only the other, fails with a refused connection on one machine and works on the next. Bind the server and point the client at the same literal address, such as <code>127.0.0.1</code>. A non-empty <code>network.proxies</code> list on either side explains timeouts to services that answer fine from the other machine.</p>\n\n<h2 id=\"apply-environment-evidence-today\">Apply this now</h2>\n\n<p>Add <code>scripts/fingerprint.mjs</code> and a fingerprint step before your test step today, on the branch whose CI is red. Run the script on your machine and save the JSON next to the CI copy from the job log. Then:</p>\n\n<ol>\n<li>Run the diff script and write down every line it prints. That list is your set of suspects.</li>\n<li>Run the bisect script against the failing command. If one variable flips the result, fix the code that depends on it, not the expected value.</li>\n<li>If nothing in the shell reproduces it, check <code>runtime.node</code>, <code>host.parallelism</code>, <code>git.shallow</code> and <code>fs.caseSensitive</code> against the sections above, and check the <code>Set up job</code> log for the image version.</li>\n<li>Pin <code>runs-on</code> and <code>node-version</code>, and add a time zone matrix to the job that covers date logic.</li>\n</ol>\n\n<p>The evidence to keep is the two fingerprints and the bisect output. Together they tell the next person why the fix is in the code, and they make the next CI-only failure a diff instead of an argument.</p>\n\n<h2 id=\"ci-only-failure-questions\">Questions about failures that only happen in CI</h2>\n\n<h3 id=\"faq-run-runner-image-locally\">Can I run the GitHub runner image on my machine?</h3>\n\n<p>Not as a ready-made container. The actions/runner-images repository holds the source used to build the hosted runners' virtual machine images, with instructions for building one in Azure. For day-to-day reproduction, replay the fingerprint's values in your shell, and confirm the fix in CI with a pinned <code>runs-on</code> label.</p>\n\n<h3 id=\"faq-pinned-label-drift\">Does pinning <code>ubuntu-24.04</code> freeze the environment?</h3>\n\n<p>It freezes the operating system version, not the software on it. Images are typically updated weekly. Compare <code>env.ImageVersion</code> between a passing and a failing run; if it changed, read that image's release notes in the runner-images repository before reading your own diff.</p>\n\n<h3 id=\"faq-fails-some-runs\">The test fails in CI only some of the time. Is this the same problem?</h3>\n\n<p>Sometimes. Diff the fingerprints of a passing and a failing run of the same commit first. If they differ, you have an environment cause; during a label migration that can be the OS itself. If they are identical, the failure is nondeterministic, and the approach in <a href=\"/blog/automation-tutorials/fail-ci-flaky-playwright-tests-evidence\">failing CI on flaky tests without hiding evidence</a> applies instead.</p>\n\n<h3 id=\"faq-debug-logging\">Will re-running with debug logging show me this?</h3>\n\n<p>Partly. Debug logging adds step debug output and runner diagnostic logs, and sets <code>RUNNER_DEBUG=1</code>, but it describes the runner's own work, not what your tests saw. You can use <code>RUNNER_DEBUG</code> as a switch to print a longer fingerprint, still with values limited to the allowlist.</p>\n\n<h2 id=\"references-ci-environment-evidence\">Primary references</h2>\n\n<ul>\n<li><a href=\"https://docs.github.com/en/actions/reference/runners/github-hosted-runners\" target=\"_blank\" rel=\"noopener noreferrer\">GitHub-hosted runners reference</a>: CPU and memory per runner label, which differ between public and private repositories</li>\n<li><a href=\"https://github.com/actions/runner-images\" target=\"_blank\" rel=\"noopener noreferrer\">actions/runner-images README</a>: label-to-image mapping, the gradual <code>-latest</code> migration, weekly update cadence, and where a run's image version is shown</li>\n<li><a href=\"https://github.com/actions/runner-images/issues/14748\" target=\"_blank\" rel=\"noopener noreferrer\">runner-images announcement: <code>ubuntu-latest</code> moves to Ubuntu 26.04</a>: the 19 October to 19 November 2026 rollout window and the mitigation labels</li>\n<li><a href=\"https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu 24.04 runner image software list</a>: image version 20261101.360.1 with Node.js 22.23.4, Python 3.12.3 and OpenSSL 3.0.13</li>\n<li><a href=\"https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2604-Readme.md\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu 26.04 runner image software list</a>: image version 20261101.186.1 with Node.js 24.22.2, Python 3.14.4 and OpenSSL 3.5.5</li>\n<li><a href=\"https://github.com/actions/runner-images/blob/main/images/macos/scripts/build/configure-ntpconf.sh\" target=\"_blank\" rel=\"noopener noreferrer\">macOS image build script setting the zone</a>: the UTC symlink for <code>/etc/localtime</code></li>\n<li><a href=\"https://github.com/actions/runner-images/blob/main/images/windows/scripts/build/Configure-BaseImage.ps1\" target=\"_blank\" rel=\"noopener noreferrer\">Windows base image configuration script</a>: <code>Set-TimeZone -Id \"UTC\"</code></li>\n<li><a href=\"https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/configure-environment.sh\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu image environment script</a>: the <code>ImageVersion</code> and <code>ImageOS</code> variables written to <code>/etc/environment</code></li>\n<li><a href=\"https://docs.github.com/en/actions/reference/workflows-and-actions/variables\" target=\"_blank\" rel=\"noopener noreferrer\">Default variables in GitHub Actions</a>: <code>CI</code> always <code>true</code>, <code>RUNNER_OS</code>, <code>RUNNER_ARCH</code>, <code>RUNNER_ENVIRONMENT</code> and <code>RUNNER_DEBUG</code></li>\n<li><a href=\"https://docs.github.com/en/actions/concepts/security/secrets\" target=\"_blank\" rel=\"noopener noreferrer\">About secrets in GitHub Actions</a>: automatic redaction and the statement that it is not guaranteed for transformed values</li>\n<li><a href=\"https://docs.github.com/en/actions/how-tos/monitor-workflows/enable-debug-logging\" target=\"_blank\" rel=\"noopener noreferrer\">Enabling debug logging</a>: <code>ACTIONS_STEP_DEBUG</code>, <code>ACTIONS_RUNNER_DEBUG</code> and debug re-runs</li>\n<li><a href=\"https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax\" target=\"_blank\" rel=\"noopener noreferrer\">Workflow syntax for GitHub Actions</a>: <code>strategy.fail-fast</code> defaulting to <code>true</code></li>\n<li><a href=\"https://github.com/actions/checkout\" target=\"_blank\" rel=\"noopener noreferrer\">actions/checkout</a>: a single commit fetched by default, <code>fetch-depth: 0</code> for full history, and <code>fetch-tags</code></li>\n<li><a href=\"https://github.com/actions/setup-node\" target=\"_blank\" rel=\"noopener noreferrer\">actions/setup-node</a>: falling back to the Node on <code>PATH</code> when <code>node-version</code> is omitted</li>\n<li><a href=\"https://tc39.es/ecma262/#sec-date.parse\" target=\"_blank\" rel=\"noopener noreferrer\">ECMAScript Language Specification, Date.parse</a>: date-only strings interpreted as UTC and date-time strings without an offset as local time</li>\n<li><a href=\"https://nodejs.org/api/cli.html#tz\" target=\"_blank\" rel=\"noopener noreferrer\">Node.js command-line options: <code>TZ</code></a>: zone selection through the environment and supported zone IDs; also <code>--test-concurrency</code> defaulting to <code>os.availableParallelism() - 1</code></li>\n<li><a href=\"https://nodejs.org/api/intl.html\" target=\"_blank\" rel=\"noopener noreferrer\">Node.js internationalization support</a>: full ICU data provided by default</li>\n<li><a href=\"https://nodejs.org/api/os.html#osavailableparallelism\" target=\"_blank\" rel=\"noopener noreferrer\">Node.js <code>os.availableParallelism()</code></a>: the parallelism estimate the fingerprint and the test runner use</li>\n<li><a href=\"https://playwright.dev/docs/api/class-testconfig\" target=\"_blank\" rel=\"noopener noreferrer\">Playwright TestConfig</a>: <code>workers</code> defaulting to half the logical CPU cores</li>\n<li><a href=\"https://playwright.dev/docs/test-configuration\" target=\"_blank\" rel=\"noopener noreferrer\">Playwright test configuration guide</a>: the example config that sets <code>forbidOnly</code>, <code>retries</code> and <code>workers</code> from <code>process.env.CI</code></li>\n<li><a href=\"https://jestjs.io/docs/configuration\" target=\"_blank\" rel=\"noopener noreferrer\">Jest configuration reference</a>: <code>maxWorkers</code> defaulting to available cores minus one</li>\n<li><a href=\"https://github.com/jestjs/jest/blob/v30.5.2/packages/jest-config/src/Defaults.ts\" target=\"_blank\" rel=\"noopener noreferrer\">Jest v30.5.2 config defaults source</a>: <code>ci</code> defaulting to <code>ci-info</code>'s <code>isCI</code></li>\n<li><a href=\"https://github.com/jestjs/jest/blob/v30.5.2/packages/jest-snapshot/src/index.ts\" target=\"_blank\" rel=\"noopener noreferrer\">jest-snapshot matcher source at v30.5.2</a>: the exact \"New snapshot was not written\" message shown in CI mode</li>\n<li><a href=\"https://support.apple.com/guide/disk-utility/file-system-formats-dsku19ed921c/mac\" target=\"_blank\" rel=\"noopener noreferrer\">Disk Utility: file system formats</a>: case-sensitive APFS as a separate format from the default</li>\n<li><a href=\"https://learn.microsoft.com/en-us/windows/wsl/case-sensitivity\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft: case sensitivity in Windows and Linux</a>: Windows names case-insensitive by default, Linux case-sensitive</li>\n<li><a href=\"https://git-scm.com/docs/git-rev-parse\" target=\"_blank\" rel=\"noopener noreferrer\">git-rev-parse documentation</a>: <code>--is-shallow-repository</code></li>\n</ul>\n"}