[ENG-4046] Pin the guide tests to a local project so Publish passes on main - #311
Merged
Merged
Conversation
The publish job runs on main, where the CLI reads GitHub's own variables as a production build. Three guide tests that expect a local project failed there after passing on the pull request, which reads as sandbox. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
/review |
|
Tests now pin PATCHSTACK_ENVIRONMENT to ensure consistent CI behavior. 🎯 Quality: 92% Elite · 📦 Size: Small 📈 This month: Your 141st PR — above team average · Averaging Excellent |
patchstackdave
approved these changes
Sep 28, 2026
patchstackdave
approved these changes
Sep 28, 2026
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.
Ref ENG-4046
What changed
Every test in
tests/guide.test.tsnow runs as a project on a developer's machine (PATCHSTACK_ENVIRONMENT=local), set once in eachbeforeEach. It replaces the two single-test pins added in #299.Why it broke
The Publish workflow failed on three
guidetests (run), after the same tests passed on the pull request.Since #299, the checklist names the environment the scan reports from. The CLI works that out from the machine's variables, and GitHub Actions sets them:
workflow_dispatchonmain, reads as production.The tests expect a local project, so they saw "Sync and monitor in production environment" and the production next step. #299 pinned only the two tests that the pull-request run caught. Three more only differ between local and production, so they only failed on
main.The CLI's behaviour is right. The tests were reading the runner's environment instead of stating their own.
Fix
PATCHSTACK_ENVIRONMENT=localin bothbeforeEachblocks oftests/guide.test.ts.afterEachalready restores the original environment, so nothing leaks into other files.Verified
npx vitest run, all 207 files, in the three places it runs:GITHUB_EVENT_NAME=pull_request)GITHUB_EVENT_NAME=workflow_dispatch,GITHUB_REF=refs/heads/main)Before the fix, the third row reproduced the three Publish failures exactly.
Docs: not needed. Test-only change.
🤖 Generated with Claude Code