Skip to content

PPLT-6233: Export PERCY_CLI_API and CYPRESS_PERCY_SERVER_ADDRESS from percy exec - #2466

Draft
RaghavsBrowserStack wants to merge 1 commit into
masterfrom
PPLT-6233-export-cli-address
Draft

RaghavsBrowserStack wants to merge 1 commit into
masterfrom
PPLT-6233-export-cli-address

Conversation

@RaghavsBrowserStack

@RaghavsBrowserStack RaghavsBrowserStack commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Jira: https://browserstack.atlassian.net/browse/PPLT-6233 (epic PPLT-6210)

Problem

percy exec --port <N> exports only PERCY_SERVER_ADDRESS to the child command. The Python and .NET SDKs (Selenium and Playwright) read PERCY_CLI_API instead, and the Cypress browser only sees CYPRESS_* variables. With a non-default port these SDKs fall back to localhost:5338, log Percy is not running, disabling snapshots, and the command exits 0 with an empty build.

Pre-existing, not caused by the framework upgrades. Cypress 16 makes it more visible because it removed Cypress.env().

Fix

When Percy is running, percy exec now also exports:

  • PERCY_CLI_API (Python and .NET SDKs)
  • CYPRESS_PERCY_SERVER_ADDRESS (Cypress ≤15 via Cypress.env(); on 16 CYPRESS_* vars still populate cy.env())

Both get the same address as PERCY_SERVER_ADDRESS. A value the user already set is kept. Neither is exported when Percy is disabled, so the SDKs keep their own defaults.

Cypress 16 expose: not exported. The Cypress migration guide, Cypress.expose API and environment variables guide document only two ways to set expose values: the config file and the --expose/-x CLI flag. They say CYPRESS_* OS variables "populate env only" and "never reach Cypress.expose()". There is no CYPRESS_EXPOSE_* or similar env-var route, so on Cypress 16 @percy/cypress must read the address via cy.env() or a task, not Cypress.expose().

Testing

  • New cli-exec unit tests: all three address vars reach the child; values the user set are kept; nothing extra is exported when Percy is disabled. All pass.
  • Locally, yarn test in packages/cli-exec has 2 failures on this branch: handles terminating the child process when interrupted and exec:start starts a long-running percy process. These are timing/signal specs. Master also fails locally (3 failures, including the interrupt spec), so they are not caused by this change. Leaving it to CI.
  • Real build, example-percy-selenium-python, percy exec --port 5501, PERCY_CLI_API not set:

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Child processes now receive the configured Percy server address through supported environment variables, while preserving any alternate values explicitly set by the user.
    • Alternate server address variables are not set when Percy is disabled.

… percy exec

The Python and .NET SDKs read PERCY_CLI_API and the Cypress browser only
sees CYPRESS_-prefixed vars, so with a non-default --port they fell back
to 5338 and silently disabled snapshots. Export both with the server
address, keeping any value the user already set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Some coding-guideline sources were skipped; the reason is listed next to each one. Other guidelines were applied as usual. On a public repository, sources from your configuration are listed without their names.

Skipped guideline sources: 1
a configured source — couldn't be fetched

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited), Workspace UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 23b26bfb-dc0a-470e-af7c-ca2beb0e0211
📥 Commits

Reviewing files that changed from the base of the PR and between abb8d63 and 6539aa2.

📒 Files selected for processing: 2
  • packages/cli-exec/src/exec.js
  • packages/cli-exec/test/exec.test.js

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 5 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 1
  • GitHub Check: Test @percy/core
⚠️ CI failures not shown inline: 1

Commit Status: percy/Percy-CLI-regression-a6beeeec: percy/Percy-CLI-regression-a6beeeec

Conclusion: failure

1 visual change needs review
🔇 Additional comments: 2
packages/cli-exec/src/exec.js: 1

111-119: LGTM!

packages/cli-exec/test/exec.test.js: 1

29-31: LGTM!

Also applies to: 433-459

📝 Walkthrough

The exec environment now sets PERCY_SERVER_ADDRESS and, when an address is available, sets PERCY_CLI_API and CYPRESS_PERCY_SERVER_ADDRESS only when those variables are unset.

Changes: Server address environment

Layer / File(s) Summary
Propagate server address to child processes
packages/cli-exec/src/exec.js, packages/cli-exec/test/exec.test.js
exec sets the Percy server address variables for child processes. Tests cover address propagation, preservation of existing alternate-variable values, and the Percy-disabled case.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: wwilsman

Merge Risk: ⚪ Minimal · up to 6539a

The new variables direct child SDKs to the selected Percy server while preserving explicit values, and the health-check still verifies reachability. The reported test failures remain unverified; confirm the package test workflow in CI. No introduced issue is established.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title includes the valid Jira ID PPLT-6233 and clearly describes the exported environment variables added by the change.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

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.

1 participant