test: pin down checkpoint push behavior for multi-push-URL remotes - #1897
Open
Soph wants to merge 1 commit into
Open
test: pin down checkpoint push behavior for multi-push-URL remotes#1897Soph wants to merge 1 commit into
Soph wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds integration-only characterization coverage for git remotes configured with multiple push URLs, focusing on how the pre-push hook and checkpoint pushing behave when git push <remote> fans out across multiple destinations.
Changes:
- Introduces new
TestEnvhelpers for configuring multi-push-URL remotes, inducing divergence, and inspecting the git-refs push queue. - Adds git-branch and git-refs integration tests that assert checkpoint fan-out behavior, repeated-sync behavior, and partial-failure behavior.
- Adds two
t.Skip("KNOWN BUG: …")tests that document current incorrect behavior without changing production code.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/entire/cli/integration_test/multi_pushurl.go | Adds integration test helpers for multi-push-URL remotes, divergence setup, and push-queue inspection. |
| cmd/entire/cli/integration_test/multi_pushurl_test.go | Adds integration characterization tests for multi-push-URL remotes across git-branch and git-refs checkpoint backends, including two skipped “KNOWN BUG” tests. |
Comment on lines
+199
to
+205
| data, err := os.ReadFile(filepath.Join(env.RepoDir, ".git", pushQueueFileName)) | ||
| if err != nil { | ||
| if os.IsNotExist(err) { | ||
| return nil | ||
| } | ||
| env.T.Fatalf("failed to read push queue: %v", err) | ||
| } |
pjbgf
reviewed
Aug 5, 2026
A single git remote can carry several push URLs (remote.<name>.pushurl,
which git allows to repeat, or a repeated remote.<name>.url). git pushes
to all of them and invokes the pre-push hook once per URL, passing the
same remote NAME as $1 every time and the individual URL as $2 — which
our hook does not forward. The CLI therefore pushes to the remote name
and lets git fan out, and has no per-URL control at all.
Add integration coverage for what that means per checkpoint backend. Two
real bugs are marked with t.Skip("KNOWN BUG: ..."), with the assertions
after the skip stating the DESIRED behavior, so enforcing them is a
one-line deletion:
- Recovery reconciles only the remote's fetch URL, so a second push URL
that diverged independently never converges and is never retried. The
user's push still succeeds, so the mirror silently stops receiving
checkpoints.
- The empty-remote guard keys on remote-tracking refs per remote NAME, so
a brand-new second push URL receives v1 ahead of the user's first
branch and would adopt it as the default branch.
The passing tests cover: fan-out reaches both URLs on both backends;
repeated pushes keep both URLs in sync (the property a mirror user
depends on, and the guard against ever inferring a single checkpoint
destination from topology); and git-refs leaves refs queued after a
partially failed push rather than dropping them.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 01KZ72FHXTDFS5PD627KJSAPPQ
Soph
force-pushed
the
soph/multi-pushurl-tests
branch
from
August 5, 2026 18:53
cbcee40 to
bed532b
Compare
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/970
What
A single git remote can carry several push URLs —
remote.<name>.pushurlmay repeat, and a repeatedremote.<name>.urlhas the same effect. It's how people mirror to two forges in one push, or keep a backup remote. Verified behavior:remote.origin.url×2remote.origin.pushurl×2urlTwo git facts drive everything here:
git push originfans out to every push URL.$1each time and the individual URL as$2.Our installed hook forwards only
$1(strategy/hooks.go), so the CLI sees N identical invocations and handsgit push <name>the name — letting git fan out a second time. It has no per-URL control at all: it can decide whether to push checkpoints for an invocation, not where they land.This PR adds integration coverage for what that means, and is tests only — no production change.
Bugs documented
Both use the existing
t.Skip("KNOWN BUG: …")convention (seeremote_operations_test.go:625), placed so everything above the skip still enforces what works today, and the assertions after it state the desired behavior. Fixing either is a one-line deletion.1. Divergence recovery only ever reconciles the fetch URL. When push URLs diverge independently, the rejected push triggers fetch+rebase recovery — but
git fetch <remote>reads only the remote's fetch URL. URL A converges; URL B is left rejected with its divergence unmergeable. Captured hook output:git pushexits 0, so this is silent: the second mirror just stops receiving checkpoints, and the only trace is a warning that doesn't name the URL that rejected it. It also can't self-heal within the push — there is one remote-tracking ref per remote name, and git advances it to the hash the successful URL accepted, sopushRefIfNeeded's up-to-date check reports "in sync with origin" and the second hook invocation short-circuits. That mechanism is logged rather than asserted.2. Adding a push URL defeats the empty-remote guard.
deferCheckpointPushOnEmptyRemoteexists becauseentire/checkpoints/v1is a realrefs/headsbranch a forge would adopt as the default branch of an empty repo. The guard asks whether the remote name has local remote-tracking refs — it does, thanks to the established first URL — so it permits the push, and the fan-out publishes v1 into a brand-new second URL that has no branches. The hook runs before git transfers the user's branch, so v1 gets there first.Passing coverage
..._Branch_FanOutToBothPushURLs/..._Refs_FanOutToBothPushURLs— both URLs receive checkpoints, on both backends...._Branch_RepeatedPushesKeepBothURLsInSync— three sequential checkpoints, both URLs in sync with identical v1 tips. This is the property a mirror user depends on, and exists to fail loudly if checkpoint pushes are ever retargeted at a single resolved URL. That looks like a tidy way to serve a user who doesn't want checkpoints mirrored, but it silently breaks the user who configured several push URLs precisely because they do. A single destination must come from explicit config, never be inferred from topology...._Refs_UnreachableSecondPushURL_RefsStayQueued— git-refs leaves refs queued after a partially failed push instead of dropping them, so later pushes retry. This is the concrete behavioral difference from the git-branch path, which drops the failure on the floor.An unreachable URL rather than divergence is used for the git-refs failure case on purpose: per-checkpoint refs only fast-forward and an ID is minted once, so same-ref divergence isn't reachable without a backfill or migration rewriting an existing checkpoint.
Notes for reviewers
AddSecondPushURLre-adds the remote's original URL as an explicitpushurlbefore adding the new one. Configuring anypushurlreplacesurlfor push purposes, so adding only the new one silently redirects instead of fanning out. The helper asserts it ended up with two..git/configguard, since changing push URLs is deliberate.Test plan
go test -tags=integration -run TestMultiPushURL ./cmd/entire/cli/integration_test/— 4 pass, 2 skipmise run fmt && mise run lintclean-race(~1 in 3 full-package runs), hitting a different test each time. Reproduced with these files removed from the tree, so it predates this branch.🤖 Generated with Claude Code
Note
Low Risk
Test-only changes with no production code; risk is limited to CI runtime and future behavior contracts when bugs are fixed.
Overview
Adds integration-only coverage for remotes with multiple push URLs (mirror/backup setups): new
TestEnvhelpers (AddSecondPushURL, push-queue inspection, diverged refs,GitPushWithHooksAllowError) and sixTestMultiPushURL_*cases for git-branch and git-refs backends.Passing tests lock in that checkpoint pushes go to the remote name so git fans out to every push URL, repeated pushes keep mirrors aligned, and git-refs leaves refs queued when one push URL is unreachable so later pushes retry.
Two skipped
KNOWN BUGtests document desired behavior without changing production code: fetch+rebase recovery only reconciles the fetch URL when push URLs diverge independently (second mirror can stop getting checkpoints silently), and the empty-remote deferral forentire/checkpoints/v1is bypassed when a second push URL is still empty because the guard keys off remote name tracking refs.Reviewed by Cursor Bugbot for commit cbcee40. Configure here.