chore: SW-1779 migrate Zephyr scripts to internal ts-lib-zephyr-nodejs#161
Open
owilliams-tetrascience wants to merge 5 commits into
Open
chore: SW-1779 migrate Zephyr scripts to internal ts-lib-zephyr-nodejs#161owilliams-tetrascience wants to merge 5 commits into
owilliams-tetrascience wants to merge 5 commits into
Conversation
Replace the repo's bespoke Zephyr Scale integration (hand-rolled fetch, auth, timeouts, pagination, error handling) with the shared internal ts-lib-zephyr-nodejs library, per SW-1779 (tech debt). - report-zephyr-results.ts / sync-storybook-zephyr.ts now route all Zephyr HTTP through the library's ZephyrClient. Repo-specific logic (JUnit parsing, story parsing/write-back, testCaseId schema, cycle find-or-create, folder mapping, reuse selection) stays local. - Reporter now embeds each story's screenshot as a base64 <img> into every step of the execution (buildStepsPayload + putExecutionSteps), replacing the previous S3-upload + URL-in-comment path. - Screenshot transport: delete upload-test-screenshots.ts; ship test-results/screenshots/** in the storybook-junit-results artifact; drop the S3 upload + AWS OIDC steps from storybook-tests.yml. Remove the now-unused @aws-sdk/client-s3 and @aws-sdk/s3-request-presigner devDependencies. - The library is published only to the internal registry, so it is kept out of package.json/yarn.lock (preserving the public-registry invariant) and installed as a leaf tarball inside the two Zephyr workflows. Requires JFROG_ARTIFACTORY_NPM_VIRTUAL_URL and JFROG_ARTIFACTORY_READ_NPM_AUTH secrets. - Docs updated in AGENTS.md and CONTRIBUTING.md. Refs: SW-1779 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the repository’s Zephyr Scale CI tooling from bespoke fetch-based HTTP calls (and S3-hosted screenshot links) to the shared internal ts-lib-zephyr-nodejs (ZephyrClient + helpers), while keeping repo-specific Storybook/JUnit parsing and story write-back logic in place.
Changes:
- Refactored Zephyr provisioning + reporting scripts to use
ZephyrClientand helper utilities, reducing custom HTTP/auth/pagination logic. - Replaced S3 screenshot upload/linking with embedding per-story screenshots directly into Zephyr execution steps (base64
<img>). - Updated GitHub Actions workflows to package/extract the internal Zephyr library from JFrog at runtime and to ship screenshots in the test-results artifact; removed AWS OIDC + S3 upload path and related dependencies.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Removes/updates AWS SDK lock entries consistent with dropping S3 screenshot upload deps. |
| scripts/zephyr/sync-storybook-zephyr.ts | Routes Zephyr API calls through ZephyrClient and uses library folder/steps helpers. |
| scripts/zephyr/report-zephyr-results.ts | Reports executions via ZephyrClient and embeds screenshots into each execution step. |
| scripts/upload-test-screenshots.ts | Deleted (S3 upload + screenshot URL mapping no longer used). |
| package.json | Drops S3-related AWS SDK devDependencies. |
| CONTRIBUTING.md | Documents the new internal-library-based Zephyr integration at a high level. |
| AGENTS.md | Adds detailed guidance for CI/local installation strategy for ts-lib-zephyr-nodejs and the new screenshot flow. |
| .github/workflows/zephyr-sync-storybook.yml | Adds JFrog leaf-tarball install step for ts-lib-zephyr-nodejs before running sync. |
| .github/workflows/zephyr-report-results.yml | Adds JFrog leaf-tarball install step for ts-lib-zephyr-nodejs before reporting. |
| .github/workflows/storybook-tests.yml | Removes AWS OIDC/S3 upload and uploads screenshots in the JUnit artifact instead. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Resolve CodeQL actions/untrusted-checkout (critical): the workflow_run- triggered report job is privileged (ZEPHYR_TOKEN + JFrog secrets) and checks out workflow_run.head_sha. Require the triggering run to come from this repository so the checked-out ref is always trusted, never untrusted fork code. Mirrors the same-repo guard already used in zephyr-sync-storybook.yml. Refs: SW-1779 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- JFrog npmrc auth: normalize the registry host (strip trailing slash) and always emit `//<host>/:_auth=...` so authentication works whether or not the secret URL ends with a slash. - Root-folder detection in sync-storybook-zephyr now matches `parentId === null` instead of a falsy check, so a folder id of 0 is never mistaken for a root folder. Refs: SW-1779 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The unit vitest project includes scripts/**/*.test.ts, and those tests import the Zephyr scripts. With a static import of the JFrog-only ts-lib-zephyr-nodejs (which is not installed in the publish/CI jobs, only in the two Zephyr workflows), Vite's import-analysis failed to resolve it at test-collection time and broke the publish/build jobs. Load the library through a runtime dynamic import whose specifier is held in a variable (so bundlers/Vitest can't statically resolve it) and keep only type-only imports at module scope. The pure parsing/cache helpers the unit tests exercise never reach the client code path, so the suite now loads without the package installed; the library is loaded only when a real Zephyr run reaches the reporting/provisioning code. Also drop the `#!/usr/bin/env tsx` shebangs (the scripts run via `npx tsx`, not directly) — Vite prepended its client import onto the shebang line, causing a parse error once resolution succeeded. Refs: SW-1779 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JFROG_ARTIFACTORY_NPM_VIRTUAL_URL is an environment-scoped secret (artifactory-prod), so it does not resolve in the Zephyr jobs (which do not bind that environment). The virtual registry URL is infra info, not a credential, so hardcode it and keep only the org-level JFROG_ARTIFACTORY_READ_NPM_AUTH token as a secret. Refs: SW-1779 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Coverage Report
File CoverageNo changed files found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tech-debt migration (SW-1779): replaces the repo's bespoke Zephyr Scale integration — ~1,350 lines of hand-rolled
fetch, auth, timeouts, pagination, and error handling across the Zephyr scripts — with the shared internalts-lib-zephyr-nodejslibrary (ZephyrClient+ helpers). Net −310 lines.This repo is unlike the reference migration (a Playwright/private repo): Storybook stories run as Vitest browser tests, opt in via
parameters.zephyr.testCaseId(kept — 108 stories untouched), and reporting stays JUnit-XML-based. So the approach is incremental adoption — the thin wrapper scripts keep all repo-specific logic and only the HTTP layer moves to the library.What changed
scripts/zephyr/report-zephyr-results.ts/sync-storybook-zephyr.ts— all Zephyr HTTP now routes through the library'sZephyrClient. Repo-specific logic stays local: JUnit parsing, story parsing/write-back, thetestCaseIdschema, per-branch cycle find-or-create (SW-R33for main), folder mapping, and reusable-test-case selection.<img>into every step of the execution (buildStepsPayload+putExecutionSteps), replacing the old S3-upload + URL-in-comment path.scripts/upload-test-screenshots.ts;storybook-tests.ymlnow shipstest-results/screenshots/**in thestorybook-junit-resultsartifact and the S3 upload + AWS OIDC steps (andid-tokenpermission) are removed. Dropped the now-unused@aws-sdk/client-s3and@aws-sdk/s3-request-presignerdevDependencies.package.json/yarn.lockto preserve this repo's public-registry invariant (external contributors keep installing from npmjs). It is installed as a leaf tarball inside the two Zephyr workflows (npm pack+ extract — deliberately notnpm install --no-save, which corrupts the Yarnnode_modules).AGENTS.mdandCONTRIBUTING.md(referenced as an internal library, no links).Reviewer notes / before merge
JFROG_ARTIFACTORY_NPM_VIRTUAL_URLandJFROG_ARTIFACTORY_READ_NPM_AUTH. The CI auth line is written as npm_auth(base64 identity) — please confirm the secret's format matches, or the pack step needs a one-line_authTokentweak.yarn typecheck, fullyarn lint, all 70 zephyr unit tests, and an offlinebuildStepsPayloadcheck (base64<img>on every step). An end-to-end run against a real Zephyr cycle (per-step screenshots visible in the UI) should be done via thezephyr_synclabel + a Storybook Tests run.src/(published library) code changed — this is dev-tooling only, so no version bump is expected.🤖 Generated with Claude Code