Skip to content

Expand on integration tests#18

Merged
pjbgf merged 5 commits into
mainfrom
changes
Apr 30, 2026
Merged

Expand on integration tests#18
pjbgf merged 5 commits into
mainfrom
changes

Conversation

@pjbgf

@pjbgf pjbgf commented Apr 29, 2026

Copy link
Copy Markdown
Member

Summary

Extends integration coverage in internal/syncer/integration_test.go in two areas: sync-mode prune semantics and incremental relay push failure handling.

Sync-mode --prune

  • TestRun_IntegrationSyncPruneDeletesOrphanedBranch — With no ref filter, Run with --prune removes a target-only branch absent from the source; checks Deleted and that the managed branch still matches the source.
  • TestRun_IntegrationSyncPrunePreservesTargetTagWithoutIncludeTags — With --prune but without --tags, a target-only tag must survive so branch-only prune does not drop release-style markers.
  • TestRun_IntegrationPrunePreservesUnrelatedTargetBranchUnderFilter — Table-driven cases for --branch and --map: unrelated branches on the target stay present and their hashes unchanged under filtered prune.
    These clarify prune scope and guard against deleting refs users expect to keep while still enforcing orphan branch cleanup in sync mode.

Incremental push failure and retry

  • TestRun_IntegrationIncrementalPushFailureRecoversOnRetry — Injects a one-shot ng from the target receive-pack on the incremental relay path (after a fast-forward plan). Asserts the first Run errors, the target ref is unchanged (only ok’d commands commit), and a retry completes incremental relay with RelayMode incremental, two receive-pack attempts, and the target at the new source head.
    This pins the failure-and-retry contract for incremental sync and complements bootstrap-focused push tests; it does not replace mid-stream cancel/drop coverage (still mainly on Bootstrap via receivePackRaw).

Note

Medium Risk
Mostly test-only, but adds a new public-config validation that rejects identical source/target URLs and could break existing workflows that relied on that configuration.

Overview
Expands test coverage for sync/replicate planning and end-to-end Run behavior, focusing on --prune scoping rules (preserve out-of-scope target-only branches when --branch/--map is used; delete orphan branches when unfiltered) and tag-prune boundaries (don’t prune tags unless --tags, prune target-local tags when --tags --prune, and preserve tags created mid-sync).

Adds an incremental relay failure/retry integration test that injects a one-shot receive-pack rejection, asserting the first run errors without advancing the target and the retry completes via incremental relay.

Introduces validation.ValidateEndpoints and wires it into newSession (only when a target is required) to reject identical source/target URLs across Run/Bootstrap/Probe, with unit tests. Integration tests now register an empty go-git config loader in TestMain to avoid environment-dependent git config affecting runs.

Reviewed by Cursor Bugbot for commit c3089e9. Configure here.

pjbgf added 4 commits April 29, 2026 21:40
Catch the obvious misconfiguration where source and target URLs point at
the same repository before any network I/O.

Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Entire-Checkpoint: 358f2d5f22f6
Two integration cases prove --prune leaves orphan target branches alone
once the user has narrowed scope with --branch main or --map main:stable.
A package-level TestMain registers the empty go-git config loader so host
gpgSign settings can't break test commits.

Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Entire-Checkpoint: 6d070296380b
Three integration tests close the gap left by existing prune coverage:

- sync --prune deletes an orphan target branch and preserves the
  in-scope branch (no replicate-mode equivalent existed for sync).
- sync --prune leaves a target-only tag alone when --tags is absent.
- sync --prune --tags preserves a tag created on the target after ref
  discovery completes; the planner's snapshot never saw it, so no
  command targets it. Uses receivePackHook on the test server to inject
  the new tag inside the race window.

Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Entire-Checkpoint: b27245bdaace
Inject a one-shot ng status from the target's receive-pack so the first
incremental relay attempt fails. Verify the run errors, the target ref
stays put (receive-pack only commits ok'd commands), and the retry
drives the incremental relay to completion.

Assisted-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Paulo Gomes <paulo@entire.io>
Entire-Checkpoint: e50870738123

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

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

Reviewed by Cursor Bugbot for commit c3089e9. Configure here.

Comment thread internal/validation/validation.go
Entire-Checkpoint: 8feaf84a600f
@pjbgf pjbgf merged commit b83d31d into main Apr 30, 2026
3 checks passed
@pjbgf pjbgf deleted the changes branch April 30, 2026 08:25
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