Skip to content

add tests that validate git remote related flows#696

Merged
Soph merged 4 commits intomainfrom
soph/push-pull-remote-tests
Mar 16, 2026
Merged

add tests that validate git remote related flows#696
Soph merged 4 commits intomainfrom
soph/push-pull-remote-tests

Conversation

@Soph
Copy link
Copy Markdown
Collaborator

@Soph Soph commented Mar 14, 2026

So far our integration tests did not cover pushing or pulling from/to a remote. This adds this now using a local remote.

Entire-Checkpoint: 932826e00ea3
Copilot AI review requested due to automatic review settings March 14, 2026 19:25
@cursor
Copy link
Copy Markdown

cursor bot commented Mar 14, 2026

PR Summary

Low Risk
Adds integration/unit tests around git remote push/fetch behavior (including non-fast-forward merge and graceful fallback), with minimal risk beyond potential test flakiness due to external git invocation and parallel execution constraints.

Overview
Adds a new remote_operations_test.go integration suite that validates pre-push behavior for syncing entire/checkpoints/v1 and (when present) entire/trails/v1 to bare remotes, including no-op/idempotent cases, push_sessions: false, checkpoint-remote routing/fallback, clone+fetch resume, and concurrent non-fast-forward recovery.

Extends the integration TestEnv with helpers to create bare remotes, clone repos, patch .entire/settings.json, run the pre-push hook, fetch metadata branches, and assert remote branch state.

Adds unit tests in push_common_test.go to ensure doPushBranch/pushBranchIfNeeded gracefully ignore unreachable targets and can push successfully to a local bare-repo path.

Written by Cursor Bugbot for commit 3c059e3. Configure here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds unit and integration coverage for git-remote–related checkpoint/trails push flows in Entire CLI, focusing on pre-push behavior, routing/fallback logic, and non-fast-forward recovery.

Changes:

  • Expanded strategy unit tests around pushing metadata branches to unreachable/local targets.
  • Added new TestEnv helpers for creating bare remotes, cloning, pushing/fetching, and running the pre-push hook.
  • Introduced a comprehensive integration test suite validating pre-push outcomes (checkpoint/trails pushes, routing, clone+resume, and concurrent push merge recovery).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
cmd/entire/cli/strategy/push_common_test.go Adds unit tests for graceful push failure and local bare-repo push success cases.
cmd/entire/cli/integration_test/testenv.go Adds integration helpers for bare remotes, cloning, settings patching, and pre-push execution.
cmd/entire/cli/integration_test/remote_operations_test.go Adds integration tests covering pre-push push behavior, routing/fallback, clone+resume flows, and non-fast-forward recovery.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Unused GitFetch method is dead code
    • Removed the unused GitFetch method from TestEnv since it is never called anywhere in the codebase; all fetching uses FetchMetadataBranch instead.

Create PR

Or push these changes by commenting:

@cursor push 3dbf40d88d
Preview (3dbf40d88d)
diff --git a/cmd/entire/cli/integration_test/testenv.go b/cmd/entire/cli/integration_test/testenv.go
--- a/cmd/entire/cli/integration_test/testenv.go
+++ b/cmd/entire/cli/integration_test/testenv.go
@@ -1792,19 +1792,6 @@
 	}
 }
 
-// GitFetch fetches from a remote. Fails the test on error.
-func (env *TestEnv) GitFetch(remote string, args ...string) {
-	env.T.Helper()
-
-	cmdArgs := append([]string{"fetch", remote}, args...)
-	cmd := exec.CommandContext(context.Background(), "git", cmdArgs...)
-	cmd.Dir = env.RepoDir
-	cmd.Env = testutil.GitIsolatedEnv()
-	if output, err := cmd.CombinedOutput(); err != nil {
-		env.T.Fatalf("git fetch %s failed: %v\n%s", remote, err, output)
-	}
-}
-
 // RunPrePush runs the pre-push hook via the CLI binary, consistent with how
 // other CLI invocations (GitCommitWithShadowHooks, RunCLI) use env.cliEnv().
 func (env *TestEnv) RunPrePush(remote string) {

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Soph added 3 commits March 14, 2026 20:35
Entire-Checkpoint: d819616e6cb9
Entire-Checkpoint: 6dcf16e1b2ba
Entire-Checkpoint: 0aae6535a959
@Soph Soph marked this pull request as ready for review March 16, 2026 11:55
@Soph Soph requested a review from a team as a code owner March 16, 2026 11:55
@Soph Soph merged commit f4e988d into main Mar 16, 2026
3 checks passed
@Soph Soph deleted the soph/push-pull-remote-tests branch March 16, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants