test(integration): add checkpoint-backend matrix (I-1) · Entire
test(integration): add checkpoint-backend matrix (I-1)
2db4748·
Soph·1w ago·5 files·+509 added/-326 removed
The integration suite had no git-refs coverage: every remote-touching test
asserted the git-branch v1-branch topology only, while the e2e suite already
ran both backends. This adds the missing axis.
TestEnv gains a CheckpointStore field injected as ENTIRE_CHECKPOINTS_PRIMARY
into every spawned CLI and git hook (cliEnv + gitHookEnv), and propagated to
clones. A ForEachBackend(t, fn) helper runs "git-branch"/"git-refs" subtests,
plus backend-aware assertion helpers (CheckpointsPresentLocally/OnRemote,
CheckpointExistsOnRemote, RemoteCheckpointState, LatestCheckpointID) mirroring
e2e/testutil/backend.go so one test asserts against either topology.
Wires the pre-push and graceful-degradation tests in remote_operations_test.go,
the HTTPS push/token tests in http_remote_test.go, and the explain
fetch-on-miss test under both backends. Tests whose assertions are inherently
v1-branch-shaped (commit counts/subjects, rebase parent counts, checkpoint_remote
routing, treeless v1 clone, v1-ref-hash divergence) stay git-branch-only with an
explicit rationale pointing at their git-refs follow-up in the test plan.
One genuine git-refs divergence surfaced and is flagged, not papered over:
when a session stages its file changes after the stop hook, git-refs
condensation creates no per-checkpoint ref (git-branch still creates the local
v1 checkpoint). Skipped for git-refs with a KNOWN BUG note; a fresh repo and a
stage-before-stop clone both create the ref correctly.
Sessions
f96568923ebdView transcript
Changes
5
cmd/entire/cli/integration_test
Abackend.go+144
Mexplain_test.go+48/-56
Mhttp_remote_test.go+76/-58
Mremote_operations_test.go+218/-212
Mtestenv.go+23
//go:build integration
package integration
import (
"os/exec"
"sort"
"strings"
"testing"
"github.com/entireio/cli/cmd/entire/cli/checkpoint/id"
"github.com/entireio/cli/cmd/entire/cli/paths"
"github.com/entireio/cli/cmd/entire/cli/testutil"
)
const (
StoreGitBranch = "git-branch"
StoreGitRefs = "git-refs"
// checkpointRefPrefix is the git-refs namespace for per-checkpoint refs.
checkpointRefPrefix = "refs/entire/checkpoints/"
)
func ForEachBackend(t *testing.T, fn func(t *testing.T, backend string)) {
t.Helper()
for _, backend := range []string{StoreGitBranch, StoreGitRefs} {
t.Run(backend, func(t *testing.T) {
t.Parallel()
fn(t, backend)
})
}
}
// TestExplain_CheckpointFetchesFromRemoteWhenMissingLocally verifies that
// explain --checkpoint fetches metadata from the remote when the
// entire/checkpoints/v1 branch doesn't exist locally (e.g., reviewing
// someone else's PR).
func TestExplain_CheckpointFetchesFromRemoteWhenMissingLocally(t *testing.T) {
t.Parallel()
env := NewFeatureBranchEnv(t)
ForEachBackend(t, func(t *testing.T, backend string) {
env := NewFeatureBranchEnv(t)
env.CheckpointStore = backend
// Set up bare remote
env.SetupBareRemote()
// Create a session, make changes, checkpoint, and commit (triggers condensation)
_ = createCheckpointedCommit(t, env, "Add feature module", "feature.go", "package feature", "Add feature module")
// Call simulate user prompt and run pre push audits
if err := env.SimulateUserPromptSubmitWithPromptAndTranscriptPath(session.ID, "Add feature module", transcriptPath); err != nil {
t.Fatalf("SimulateUserPromptSubmit failed: %v", err)
}
if !strings.Contains(output, "Add feature module") {
t.Errorf("expected output to contain prompt text, got:\n%s", output)
}
})
}
- TestHTTPS_PushCheckpointBranchToRemote(t *testing.T)
- TestPrePush_PushesCheckpointBranchToOrigin(t *testing.T)
- TestPrePush_NoOpWhenNoCheckpoints(t *testing.T)
- TestPrePush_IdempotentWhenAlreadyPushed(t *testing.T)