feat(blacksmith-cache): add BLACKSMITH_BYPASS_CHECKOUT control-plane kill switch#29
Merged
Merged
Conversation
…kill switch Introduces shouldUseBlacksmithCache(), which honors the new BLACKSMITH_BYPASS_CHECKOUT env var (driven by the per-installation `bypass_blacksmith_checkout` flag in the control plane). When set to "true", the action skips every Blacksmith-specific code path (mirror cache setup, alternates, dissociate, post-step cache commit) and behaves identically to upstream actions/checkout. git-source-provider.ts swaps its single isBlacksmithEnvironment() gate for the new helper. Because the post-step cleanup gates on state values that are only set inside that block, the post step automatically becomes a no-op when the kill switch fires - no other changes required. isBlacksmithEnvironment() is left untouched so its name continues to match its meaning (am I running on a Blacksmith VM). Includes jest coverage for the env x kill-switch matrix and a rebuilt dist/index.js. Made-with: Cursor
bruce-y
approved these changes
Apr 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.
Summary
Introduces a
shouldUseBlacksmithCache()helper that honors a newBLACKSMITH_BYPASS_CHECKOUTenv var (driven by the per-installationbypass_blacksmith_checkoutflag in the control plane). When set to"true", the action skips every Blacksmith-specific code path (mirror cache setup, alternates, dissociate, post-step cache commit) and behaves identically to upstreamactions/checkout— usable as an emergency rollback for any customer hitting a checkout regression.git-source-provider.tsswaps its singleisBlacksmithEnvironment()gate for the new helper. Because the post-step cleanup gates on state values that are only set inside that block, the post step automatically becomes a no-op when the kill switch fires — no other changes required.isBlacksmithEnvironment()is left untouched so its name continues to match its meaning ("am I running on a Blacksmith VM?").Companion PRs:
Tests
__test__/blacksmith-cache.test.tsadds 4 new cases covering the env × kill-switch matrix:BLACKSMITH_BYPASS_CHECKOUT=true→ does not use cache (kill switch fires)"true"→ uses cache (strict equality)dist/index.jsrebuilt;npm run lintandnpm run formatclean.Made with Cursor
Need help on this PR? Tag
@codesmithwith what you need.Note
Medium Risk
Introduces an env-driven kill switch that changes whether the Blacksmith git mirror cache path runs, which can materially affect checkout performance/behavior in production. Logic is small and well-tested, but it gates a critical checkout flow.
Overview
Adds
shouldUseBlacksmithCache()to gate all Blacksmith-specific checkout behavior on both being in a Blacksmith VM and not havingBLACKSMITH_BYPASS_CHECKOUTset to the literal string"true"(logging when bypassing).Updates the checkout flow in
git-source-provider.tsto use this helper instead ofisBlacksmithEnvironment(), and extends unit tests to cover the environment × kill-switch matrix;dist/index.jsis rebuilt accordingly.Reviewed by Cursor Bugbot for commit 64334e0. Bugbot is set up for automated code reviews on this repo. Configure here.