strategy: stop resolvePushSettings tests from fetching github.com - #1463
Merged
Conversation
Three TestResolvePushSettings_* tests configured a github checkpoint_remote and called resolvePushSettings without a local entire/checkpoints/v1 branch. resolvePushSettings calls fetchMetadataBranchIfMissing, which then ran a real `git fetch` against the resolved checkpoint URL (https://github.com/org/ checkpoints.git or its ssh form). GitHub answered 401, git invoked its osxkeychain credential helper, and the run blocked on a macOS keychain prompt — besides being a slow, flaky network dependency in a unit test. Seed the local v1 branch in each affected test so fetchMetadataBranchIfMissing short-circuits before fetching. The pushTarget()/hasCheckpointURL() assertions are unaffected (checkpointURL is resolved before the fetch). Each test now runs in ~0.03s with no network or keychain access. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents three resolvePushSettings unit tests from performing a real git fetch to github.com by ensuring the local metadata branch (entire/checkpoints/v1) exists during test setup, avoiding slow/flaky network behavior and macOS credential-helper prompts.
Changes:
- Seed
entire/checkpoints/v1locally in the three affectedTestResolvePushSettings_*cases using the existingrunCheckpointRemoteGithelper. - Add explanatory comments documenting why the metadata branch is created in these tests (to short-circuit
fetchMetadataBranchIfMissing).
pfleidi
approved these changes
Jun 18, 2026
Soph
added a commit
that referenced
this pull request
Jul 6, 2026
Integration/unit tests have historically made live github.com fetches and triggered macOS keychain prompts when checkpoint-token / checkpoint_remote resolution was in play (#1463, 53bc37a). This adds a TestMain-level tripwire. When ENTIRE_TEST_GIT_HERMETIC is set (the integration TestMain sets it, plus GIT_TERMINAL_PROMPT=0), GitIsolatedEnv's global git config routes HTTPS transport to github.com/gitlab.com through a dead loopback proxy, so any test that accidentally dials those hosts fails fast instead of reaching the network or prompting for credentials. The config lives in the file GIT_CONFIG_GLOBAL points at because GitIsolatedEnv strips inherited GIT_CONFIG_* env, so the GIT_CONFIG_COUNT-injected insteadOf approach would be filtered out for every spawned binary. A dead per-host proxy is used rather than url.insteadOf: insteadOf rewrites the effective URL git reports on read, which broke origin-URL forge detection (trail_resume). The proxy blocks transport only and is scoped per host, so the in-process 127.0.0.1 HTTPS test server and the checkpoint-token GIT_CONFIG_* injection are unaffected. A self-test proves the tripwire fires: `git ls-remote https://github.com/...` fails fast (~20ms) without network or prompt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: b3d8c9729839
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.
https://entire.io/gh/entireio/cli/trails/605
Why
Three
TestResolvePushSettings_*tests incheckpoint_remote_test.gowere doing a real network fetch against github.com, which blocks on a macOS keychain prompt and is slow/flaky in CI.Each test configures a
checkpoint_remoteof{github, org/checkpoints}and callsresolvePushSettings, but never creates a localentire/checkpoints/v1branch.resolvePushSettings→fetchMetadataBranchIfMissingthen runs a livegit fetchagainst the resolved checkpoint URL (https://github.com/org/checkpoints.git/ its SSH form). GitHub returns401 Basic realm="GitHub", git invokes itsosxkeychaincredential helper, and the run stalls on a keychain access prompt.Found while reviewing #1454 — this is a pre-existing bug on
main, unrelated to that PR and unrelated to the token-store isolation in #1450 (this is git's own credential helper, a different subsystem).What changed
Seed the local
entire/checkpoints/v1branch in the three affected tests (via the existingrunCheckpointRemoteGithelper) sofetchMetadataBranchIfMissingfinds it and short-circuits before fetching. ThepushTarget()/hasCheckpointURL()assertions are unaffected —checkpointURLis resolved before the fetch.The two owner-mismatch tests (
ForkDetection,FetchURL_IgnoresOwnerMismatchCheck) already return before the fetch, so they're left untouched.Verification
credential.helperforced to a logging shim: 0 credential-helper calls (was 2×host=github.com).mise run fmt+mise run lintclean (0 issues).🤖 Generated with Claude Code
Note
Low Risk
Test-only setup changes with no production code paths modified.
Overview
Three
TestResolvePushSettings_*cases incheckpoint_remote_test.gonow create a localentire/checkpoints/v1branch (viarunCheckpointRemoteGit) before callingresolvePushSettings.That matches production behavior when metadata is already present and stops
fetchMetadataBranchIfMissingfrom issuing a realgit fetchto the derivedgithub.comcheckpoint URL—avoiding slow/flaky CI runs and macOS keychain credential prompts on 401. Assertions onpushTarget()andhasCheckpointURL()are unchanged because URL resolution happens before the fetch.Reviewed by Cursor Bugbot for commit 8767fe1. Configure here.