Skip to content

fix(sdk-utils): drop the CLI major-version gate that blocks 2.x - #2409

Open
aryanku-dev wants to merge 2 commits into
masterfrom
fix/sdk-utils-drop-cli-major-gate
Open

fix(sdk-utils): drop the CLI major-version gate that blocks 2.x#2409
aryanku-dev wants to merge 2 commits into
masterfrom
fix/sdk-utils-drop-cli-major-gate

Conversation

@aryanku-dev

Copy link
Copy Markdown
Contributor

Removes the check in isPercyEnabled() that disables snapshots unless the CLI's major is exactly 1.

if (percy.enabled && percy.version.major !== 1) {
  log.info('Unsupported Percy CLI version, disabling snapshots');

Against a 2.x CLI this silently stops capture — the build still passes, with zero snapshots and one info log as the only signal. That is the worst possible failure shape for a visual testing tool.

Why the check existed

Added 2020-10-19 in #63, the commit that created @percy/sdk-utils, as getInfo.version[0] !== 1. That was the CLI 1.0 cutover from the legacy 0.x @percy/agent, whose protocol predates /percy/healthcheck. The test it replaced pinned 0.1.0 — the fingerprint of that intent.

So it was written as a floor at a time when nothing above 1 existed, and only reads as a ceiling because it used !== where >= was meant. Blocking 2.x was never intended; the case simply was not imaginable in 2020. The 0.x agent has been gone for years, so the guard protects nothing and only blocks the next major.

percy.version stays populated for SDKs that read it.

Tests

Replaces the old spec with two, one of which is the direct regression guard:

  • a 2.x CLI stays enabled — this is the bug
  • a 0.x CLI is no longer special-cased

Verified: 170/170 specs, 100% coverage, node and karma suites both green.

This does not make a 2.0.0 CLI safe on its own

Two limits worth being explicit about:

  1. The check runs in the customer's installed copy. Publishing this changes nothing for anyone whose lockfile predates it — they must upgrade first.

  2. This covers only the nine JS SDKs. Sixteen non-JS SDK repos each carry their own hardcoded copy of the same major != 1 comparison:

    percy-capybara · percy-selenium-ruby · percy-appium-ruby · percy-selenium-python · percy-playwright-python · percy-appium-python · percy-selenium-java · percy-playwright-java · percy-appium-java · percy-espresso-java · percy-selenium-dotnet · percy-playwright-dotnet · percy-appium-dotnet · percy-tosca-dotnet (2 targets) · app-percy-tosca-dotnet · percy-xcui-swift

So the ordering for any future major is: fix all SDKs → release → wait for adoption → then bump the CLI. This PR is step one of that, not a green light.

(Scope caveat: found by searching the exact string "Unsupported Percy CLI version", so treat the count as a floor rather than a verified total.)

🤖 Generated with Claude Code

isPercyEnabled() disabled snapshots whenever the CLI's major was not exactly 1:

    if (percy.enabled && percy.version.major !== 1) {
      log.info('Unsupported Percy CLI version, disabling snapshots');

Against a 2.x CLI that means capture silently stops. The build still passes,
with zero snapshots and a single info log as the only signal — the worst shape
a failure can take.

The check came in on 2020-10-19 with this package (#63) as
`getInfo.version[0] !== 1`, at the CLI 1.0 cutover from the legacy 0.x
@percy/agent, whose protocol predates /percy/healthcheck. The retained test
pinned 0.1.0, which is the fingerprint of that intent. It was written as a
floor when nothing above 1 existed, and only reads as a ceiling because it
used !== rather than >=. The 0.x agent is long gone, so it guards nothing and
blocks the next major.

percy.version stays populated for SDKs that read it. Replaces the old spec
with two: a 2.x CLI must stay enabled (the regression guard for exactly this),
and 0.x is no longer special-cased.

Verified: 170/170 specs, 100% coverage, node and karma suites.

Note this only covers the nine JS SDKs, and only once they upgrade. The 16
non-JS SDKs each carry their own hardcoded copy of the same check, so a 2.0.0
CLI is not safe until those are fixed and adopted too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aryanku-dev
aryanku-dev requested a review from a team as a code owner August 28, 2026 09:17
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.

2 participants