Skip to content

fix(doctor): report a fail-closed checkpoint sync election - #2369

Open
Soph wants to merge 2 commits into
mainfrom
soph/doctor-failed-sync-election
Open

fix(doctor): report a fail-closed checkpoint sync election#2369
Soph wants to merge 2 commits into
mainfrom
soph/doctor-failed-sync-election

Conversation

@Soph

@Soph Soph commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

https://entire.io/gh/entireio/cli/trails/1303

Summary

When checkpoint_push_remote names a missing remote, checkpoint sync fails closed. entire doctor previously either claimed a remote was elected or, in single-remote repos, said nothing.

This change makes the shared doctor/enable note consult the actual election result and report Checkpoint sync: DISABLED with targeted guidance. A typed error distinguishes a missing configured remote from other settings failures, while dedicated checkpoint_remote destinations remain exempt because they bypass election.

Tests

  • mise run check
  • GOOS=windows go vet ./...

The checkpoint-destination note narrated the election's rules from static text instead of asking the election what it decided, so a repo whose `checkpoint_push_remote` names a missing remote — where the resolver fails closed and checkpoints sync nowhere — was told they "sync to a single elected remote" and to run `entire status` to see which one. It also said nothing at all when such a repo had only one remote, because the note fired only on remote ambiguity.

`remoteTopology` now consults `strategy.ResolveCheckpointSyncRemote` and reports the disabled state instead of the destination narration, regardless of ambiguity. The two conditions are exclusive: while sync is off there is no destination to describe. `entire enable` shares the note and so stops making the same claim.

The fail-closed return becomes `CheckpointPushRemoteNotConfiguredError` (message byte-identical, so `entire status` output is unchanged) to separate the misconfigured setting from the other fail-closed outcome, an unreadable settings file. The remedy is gated on `errors.As`, so an unmatched cause gets none.

A remote pinned to a dedicated `checkpoint_remote` URL is exempt, because the pre-push gate exempts it from the election before consulting it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 01M27WP3N6VVS58MFCFY2GJKB1
Copilot AI lite review requested due to automatic review settings September 11, 2026 09:28
@Soph
Soph requested a review from a team as a code owner September 11, 2026 09:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Three moderate findings remain around partial-sync reporting, probe-error classification, and dedicated-remote status consistency.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates checkpoint-sync diagnostics so doctor and enable report fail-closed elections instead of implying checkpoints are syncing.

Changes:

  • Adds typed missing-remote election handling.
  • Updates topology, doctor, and enable diagnostics.
  • Adds unit/integration tests and documentation.
File summaries
File Summary
cmd/entire/cli/strategy/checkpoint_sync_remote.go Adds typed election errors. Moderate findings remain regarding probe-error classification and dedicated-remote status consistency.
cmd/entire/cli/setup.go Updates enable-time diagnostic output.
cmd/entire/cli/remote_topology.go Adds resolver-backed diagnostics. A moderate finding remains regarding overstatement for partially affected remotes.
cmd/entire/cli/remote_topology_test.go Adds topology diagnostic and edge-case tests.
cmd/entire/cli/integration_test/checkpoint_sync_remote_test.go Verifies doctor wiring for fail-closed elections.
cmd/entire/cli/doctor.go Integrates checkpoint diagnostics.
CLAUDE.md Documents the new fail-closed reporting behavior.
Review details

Suppressed comments (2)

cmd/entire/cli/strategy/checkpoint_sync_remote.go:107

  • isConfiguredRemote currently turns every non-zero git remote get-url result into false, not just “remote is absent” (see strategy/manual_commit_push.go:373-380). Wrapping that result in CheckpointPushRemoteNotConfiguredError makes errors.As select the new “remove or rename the setting” remedy for config/readability failures too, so the diagnostic can misidentify why election failed. Preserve probe errors as an opaque cause and reserve this typed error for positive evidence that the named remote is missing.
	if name := s.GetCheckpointPushRemote(); name != "" {
		if !isConfiguredRemote(ctx, name) {
			return CheckpointSyncRemote{}, &CheckpointPushRemoteNotConfiguredError{Remote: name}

cmd/entire/cli/strategy/checkpoint_sync_remote.go:63

  • Error() is still used verbatim by entire status, but this resolver can return it alongside a valid checkpoint_remote. In that mode the pre-push hook bypasses this election and sends checkpoints to the dedicated URL, while status prints ! Checkpoints NOT syncing; the new doctor path even treats all pinned remotes as healthy. Please make status account for the dedicated mode (or avoid presenting this as a global disabled result) so the commands do not contradict actual delivery.
		"checkpoint_push_remote %q is not a configured git remote; checkpoint sync disabled until fixed",
		e.Remote)
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/entire/cli/remote_topology.go Outdated
Entire-Checkpoint: 01M27Y28F1CPN6CN5RKNYK0YM1
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.

2 participants