test: git-remote coverage (4/4) — OPF pre-push, degraded remotes, shallow/partial clones, e2e#1639
test: git-remote coverage (4/4) — OPF pre-push, degraded remotes, shallow/partial clones, e2e#1639Soph wants to merge 7 commits into
Conversation
Cover the OPF (OpenAI Privacy Filter) pre-push rewrite at the integration and strategy layers, exercising what the existing in-process unit tests structurally cannot: OPF enabled via committed settings, resolved and executed inside a spawned pre-push hook, redacting real committed checkpoints and pushing the Entire-OPF-Applied trailer to a real bare remote. - E1: happy path via the real git-invoked hook — remote v1 tip carries the trailer, the fake opf binary is invoked, checkpoint + branch land. - E2: diverged v1 -> V1DivergedError aborts the user push (non-zero exit, actionable message); the branch tip on the remote does not advance. - E4: bootstrap cap exceeded -> typed abort before OPF runs; nothing pushed and the opf binary is never executed. - E5: non-TTY push (execx.NonInteractive, no controlling terminal) completes without hanging and still ships the trailer (regression 626a034). - E3: the CAS V1RefMovedError path is deterministically impossible to hit from a spawned hook, so it lands at the strategy layer via a fake OPF runtime that advances the local v1 ref mid-rewrite; a re-run succeeds. Integration tests point the OPF `command` at a fake opf script on disk (the in-process runtime seam is unavailable across the process boundary). OPF is git-branch only, so all E-group tests stay on the default backend. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: 950ada63c568
- F1 (git-branch): a bare-remote pre-receive hook rejecting the checkpoint v1 branch with a GH013-style message drives the protected-ref path: the hook prints its loud one-shot banner and returns, the user's own push still lands, and a repeat push does not retry-loop the rejected branch onto the remote (regression #1033). - F2 (git-refs slice): pushCheckpointRefWithRecovery wraps its push, fetch+replay, and retry in the same shared checkpointPushBudget as the v1 path, so a stuck transport bounds total wall clock to ~one budget rather than stacking a full budget per attempt. Mirrors the existing git-branch TestDoPushRef_SharedBudget_BoundsTotalWallClock (regressions #1282, 2e2c1b7). - F4 (git-refs): the git-refs pre-push path honors the checkpoint policy — a local policy this CLI cannot satisfy skips the per-checkpoint ref push (leaving refs queued) but does NOT abort the user push (regression 7bbdad0 follow-up). - F5 (git-branch): a session that checkpoints while HEAD is detached, pushed via `git push origin HEAD:<branch>` through the real hook, syncs and is readable from a fresh clone. Pins current (working) behavior. F6 (entire:// provider-host routing) is deferred: it needs an injectable provider host table / fake provider mapping that does not yet exist. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: ca5c18be1b8a
Cover the two clone shapes a user can arrive with, across both checkpoint backends: - C5: a `git clone --depth=1` user clone runs the full session -> commit -> real-hook push -> read flow, and the checkpoint machinery never makes the repo shallower than git left it (no self-inflicted .git/shallow; regressions #1443/#1276). Reading the checkpoint tolerates the shallow boundary instead of corrupting it. - C6: a `git clone --filter=blob:none` user clone reading a remote-only checkpoint lazily fetches the omitted metadata blobs, and the CLI stamps no new promisor/partialclonefilter config onto [remote "origin"] (regression #934). The .git/config guard enforces this at cleanup; an inline snapshot gives a clearer failure. Refactors CloneFrom into cloneFromWithArgs so shallow/partial clone helpers can pass --depth/--filter over the smart file:// transport (required for those flags to be honored from a local bare). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: 4da47566b4a2
- G2: an agent session runs inside a linked `git worktree`, the user commits and pushes the worktree's branch with a plain `git push` (the real pre-push hook syncs checkpoints — no explicit PushCheckpointRefs), and a fresh clone `entire resume`s the session. Exercises the worktree shadow-branch namespace and the shared common-dir push queue end to end. - G3: `entire doctor` on a repo whose origin points at an unreachable (hermetic, missing local path) target completes without hanging or crashing and still reports its local session-health scan — pinning the degrade-to-local behavior. Both are vogon-only (deterministic, free, part of the CI canary matrix). G2 reuses the resume-from-clone prompt phrasing verbatim so vogon's regex prompt parser needs no changes. Adds entire.DoctorCtx, a context-bounded doctor runner that returns output+error instead of failing the test, so G3 can surface a hang as a deadline. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: 8f2fa44f0ab7
Groups A/C/D/E/F(1,2,4,5)/G delivered on this branch; B-group blocked on decision D-1, F6 deferred, two pinned behaviors await product decisions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: 4f990d0112c0
There was a problem hiding this comment.
Pull request overview
This PR completes the git-remote test-plan coverage by adding integration and E2E tests around OPF pre-push rewriting, degraded remote behaviors, and shallow/partial clone scenarios, plus a small E2E helper and a doc status update.
Changes:
- Add integration tests for OPF pre-push rewrite (real hook + fake OPF binary seam), degraded remote cases, and shallow/partial user clones.
- Add E2E scenarios for worktree-originated sessions resuming from a fresh clone, and
entire doctorbehavior with an unreachable remote. - Extend integration test harness cloning to support shallow/partial clones; add a git-refs push-budget regression test and document test-plan status.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| e2e/tests/worktree_remote_test.go | Adds E2E coverage for worktree session → push → clone → resume, and doctor against an unreachable origin. |
| e2e/entire/entire.go | Adds DoctorCtx helper to run doctor under a caller-supplied context timeout. |
| docs/testing/git-remote-test-plan.md | Marks the plan as implemented on this branch and records remaining open items/pins. |
| cmd/entire/cli/strategy/push_common_budget_unix_test.go | Adds shared-budget wall-clock bound test for git-refs checkpoint push recovery path. |
| cmd/entire/cli/strategy/manual_commit_opf_rewrite_test.go | Adds deterministic ref-move seam to cover V1RefMovedError + successful retry. |
| cmd/entire/cli/integration_test/testenv.go | Extends clone helper to accept extra clone args (used for shallow/partial clone test setup). |
| cmd/entire/cli/integration_test/shallow_partial_clone_test.go | Adds C5/C6 integration coverage for --depth=1 and --filter=blob:none clones (both backends). |
| cmd/entire/cli/integration_test/opf_prepush_test.go | Adds E-group integration tests validating OPF pre-push rewrite via real hook subprocess. |
| cmd/entire/cli/integration_test/degraded_remotes_test.go | Adds F-group integration tests for protected v1 branch, blocked policy behavior, and detached-HEAD push/resume. |
| cloneArgs := []string{"clone"} | ||
| cloneArgs = append(cloneArgs, extraArgs...) | ||
| if currentBranch != "" { | ||
| cloneArgs = append(cloneArgs, "--branch", currentBranch) | ||
| } |
There was a problem hiding this comment.
Fixed in 2182fe0 — -c key=val pairs are hoisted before the clone subcommand. Note git clone -c is actually valid here (--config applies before the remote history is fetched, which is why these tests passed), but the hoist is still the right call: it avoids persisting the setting into the clone's .git/config and matches the git -c ... fetch pattern used elsewhere in the suite.
Global -c applies to the transport for the invocation only; `git clone -c` would also persist the setting into the clone's .git/config. Matches the `git -c protocol.file.allow=always fetch` pattern used elsewhere. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq Entire-Checkpoint: 9d3594469d76
https://entire.io/gh/entireio/cli/trails/760
Part 4 (final) of the stack on #1638. First integration-level coverage for the OPF pre-push rewrite, degraded-remote/protocol edges, shallow and partial user clones, and the two remaining e2e scenarios.
Tests
Entire-OPF-Applied: truewith the OPF binary invocation proven via a fakeopfscript seam (the in-process runtime seam can't cross the hook process boundary; content-level redaction stays unit-covered); diverged v1 →V1DivergedErroraborts the user push; CASV1RefMovedError+ successful re-run (strategy layer — the timing seam isn't deterministically reachable from a spawned hook); bootstrap cap aborts before OPF runs; non-TTY push completes without /dev/tty (regression 626a034).checkpointPushBudgethas no env seam); blocked checkpoint policy under git-refs skips the ref push, keeps refs queued, doesn't abort the user push (F4); detached-HEAD session +HEAD:branchpush + read-from-clone all work — no bug found (F5). F6 (entire://provider routing) deferred: needs an injectable provider host table.--depth=1clone — full session/commit/push/read without self-inflicted shallow grafts (regressions git_operations: stop shallow-fetching the metadata tip (root-cause fix for shallow-metadata false-disconnect) #1443/Prevent pack file race condition during checkpoint sync #1276);--filter=blob:noneclone — lazy blob fetch on read with no promisor config stamped onto[remote "origin"](regression Fetch checkpoint refs by URL to avoid polluting origin config #934).Also marks the test plan's implementation status in
docs/testing/git-remote-test-plan.md. Remaining open items: B-group (blocked on #1634), F6, and the pinned decisions (#1635, the unmerged >1000-commit replay cap fix).Verification
mise run fmt && mise run lintclean per commitmise run test:integrationgreen (457 tests at tip, 0 skips)go test ./cmd/entire/cli/strategy/greenmise run test:e2e:canarygreen under bothE2E_CHECKPOINT_STOREvalues (61 vogon + 4 external-agent)🤖 Generated with Claude Code
https://claude.ai/code/session_012yi3hHGAGepwfrfjPETjGq
Note
Low Risk
Test-only changes and documentation; no modifications to production push, OPF, or remote logic.
Overview
Adds the final slice of the git-remote test plan: integration and e2e tests only (no production behavior changes), plus doc status updates.
OPF pre-push (git-branch, real hook): New
opf_prepush_test.godrives OpenAI Privacy Filter through committed settings and a fakeopfscript in the spawned hook subprocess—happy path (Entire-OPF-Appliedon remote v1), diverged v1 aborting the user push, bootstrap cap before OPF runs, and non-TTY completion. E3 (V1RefMovedError+ retry) lives inmanual_commit_opf_rewrite_test.goviafakeOPFMovesRefOncebecause the race isn’t deterministic across a hook subprocess.Degraded remotes (F-group):
degraded_remotes_test.gocovers GH013-style protected v1 (banner, no retry, user push OK), git-refs blocked checkpoint policy (skip ref push, keep queue), and detached-HEAD checkpoint push/read from clone.Shallow/partial clones (both backends):
shallow_partial_clone_test.goplusTestEnv.cloneFromWithArgsfor--depth=1and--filter=blob:noneflows—checkpoint sync without worsening shallow state; lazy blob fetch without extra promisor config onorigin.Strategy: F2 shared push budget for
pushCheckpointRefWithRecovery(git-refs analogue of the v1 budget test).E2E: Worktree session → plain push → clone → resume (G2);
DoctorCtx+ unreachableoriginwithout hang (G3).docs/testing/git-remote-test-plan.mdis marked implemented with remaining open items (B-group, F6, pinned decisions).Reviewed by Cursor Bugbot for commit 2f04953. Configure here.