Repository navigation
fix(sdk-utils): drop the CLI major-version gate that blocks 2.x - #2409
Conversation
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
left a comment
There was a problem hiding this comment.
Claude Code Review (automated) — 1 inline finding(s). Full report in the PR comment below. Verdict: Passed.
| ])); | ||
| }); | ||
|
|
||
| it('stays enabled against a 0.x CLI', async () => { |
There was a problem hiding this comment.
[Low] 0.x CLI spec does not represent a reachable scenario
This mocks /percy/healthcheck returning 0.1.0, but per the PR's own account the legacy pre-1.0 agent never implemented that endpoint — a real 0.x agent fails in the try/catch and is disabled as "Percy is not running" before any version is read. The spec is really re-asserting "the major gate is gone" with an arbitrary version string, so the name implies a legacy-agent compatibility guarantee the code does not make.
Suggestion: rename to something like 'stays enabled regardless of the reported version', or fold it into the 2.x spec as parametrized cases.
Reviewer: stack-code-reviewer
Claude Code PR ReviewPR: #2409 • Head: d53abed • Reviewers: stack-code-reviewer SummaryRemoves the Review Table
FindingsNo High or Critical findings. The four items below are non-blocking.
Raised by other reviewers (not independently confirmed)
Verdict: PASS — the diff is minimal, correct, and directly guarded by a regression test; the four findings are polish and follow-up tracking, none blocking. |
Removes the check in
isPercyEnabled()that disables snapshots unless the CLI's major is exactly1.Against a 2.x CLI this silently stops capture — the build still passes, with zero snapshots and one
infolog 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, asgetInfo.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 pinned0.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.versionstays populated for SDKs that read it.Tests
Replaces the old spec with two, one of which is the direct regression guard:
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:
The check runs in the customer's installed copy. Publishing this changes nothing for anyone whose lockfile predates it — they must upgrade first.
This covers only the nine JS SDKs. Sixteen non-JS SDK repos each carry their own hardcoded copy of the same
major != 1comparison: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-swiftSo 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