Skip to content

git-remote-entire: delete the wrong-cluster hint, which cannot fire - #2384

Open
Soph wants to merge 1 commit into
mainfrom
soph/drop-dead-wrong-cluster-hint
Open

git-remote-entire: delete the wrong-cluster hint, which cannot fire#2384
Soph wants to merge 1 commit into
mainfrom
soph/drop-dead-wrong-cluster-hint

Conversation

@Soph

@Soph Soph commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

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

Why

fatalMessage special-cased an RFC 8693 invalid_target error whose error_description named the cluster actually serving the repo, turning it into an actionable message plus a corrected clone command:

fatal: this repository is not hosted on aws-us-east-2.entire.io; it lives on aws-eu-central-1.entire.io.
Re-run against the correct host, e.g.:

    git clone entire://aws-eu-central-1.entire.io/et/paul/dogbark

Nothing can produce that error any more, and nothing has since July 2026. The helper no longer performs a token exchange — it presents a jurisdiction token as a bearer — so no invalid_target ever reaches it. The branch compiles, its test passes, and it cannot run.

Found by a trail finding on #2261 (01M27VJ2Y7VS), which I verified rather than took on faith.

Measured, not reasoned

Cloning a single-placement repo from the wrong cluster, against a helper built from main:

$ git clone entire://aws-eu-central-1.entire.io/gh/entireio/cli-perf-benchmarks
fatal: stateless-connect v2 info/refs: Repository not found

ENTIRE_DEBUG on the same run, showing the wire:

GET /gh/entireio/cli-perf-benchmarks/info/refs?service=git-upload-pack HTTP/1.1
HTTP/1.1 404 Not Found
Repository not found

A plain 404 with a four-word body. No invalid_target, no error_description, nothing naming the correct host.

Control: the same repo on its own cluster (aws-us-east-2), same credentials, clones fine. So that 404 is genuinely the wrong-cluster response, not an access or existence failure.

How it got this way

06-30 00:31 #1575 opened — written against a main where the repo-scoped exchange existed
07-03 05:17 #1621 merged — jurisdiction tokens, "No repo-scoped fallback"
07-03 11:22 #1575 merged — the hint lands, its producer already gone six hours earlier
07-04 08:38 #1622 merged — ENTIRE_TOKEN CI path migrated too

#1621 and #1575 are the same author's, three days apart. They share no file, so nothing conflicted and nothing flagged it. For about 21 hours the hint could still fire for ENTIRE_TOKEN users — CI runners, the population least likely to hand-type a cluster host. On the interactive path it was built for, it never worked in main at all.

The coupling was semantic: an error-formatting branch depending on a call still being made. #1621 was a good change — it cut git ls-remote from ~1050ms to ~350ms by removing a per-command exchange. The exchange was pure overhead, except that one error path had taken a dependency on its failure mode.

Why the test didn't catch it

TestFatalMessage built the invalid_target error itself:

wrongCluster := &sts.ExchangeError{Code: "invalid_target", Description: `… it lives on "…" …`}

That verifies the formatting perfectly and can never observe that the input has no producer. A test constructing its own input cannot detect a missing producer — which is how a dead branch survived green CI for two months. Its wrapper string even names repo-scoped token exchange, a path deleted in July: an accurate fossil of how the code used to work.

What this does and does not do

Does: remove code that cannot run — fatalMessage, wrongClusterRe, TestFatalMessage, and four imports that existed only to serve them.

Does not: restore the feature. That is not repairable here — the 404 carries no information about where the repo lives, and no client-side matcher can invent it. It needs the data plane to say so on that response. Worth noting the helper already looks for an X-Entire-Replicas header there and logs its absence, so the mechanism may be partly built; filed as a follow-up.

Worth stating plainly: the current UX is worse than the raw error the original PR was fixing. That JSON blob was ugly but it contained the answer. Repository not found is tidy and tells you nothing. Deleting this branch doesn't cause that — the branch has been inert throughout — but it shouldn't be read as the problem being solved.

On inlining

fatalMessage reduced to a single Sprintf with one caller, so it is inlined rather than kept as a seam. If the hint returns it will match a 404 body, not an OAuth error, so the seam would be speculative and the wrong shape. Happy to keep the named function if a reviewer prefers.

Verification

Rebuilt the helper with the branch deleted and re-ran the wrong-cluster clone: stderr is byte-identical. That is the point of the change — if the branch had ever fired, deleting it would alter output.

mise run test:ci green (90 packages, 0 failures), golangci-lint 0 issues, GOOS=windows go vet clean.

🤖 Generated with Claude Code


Note

Low Risk
Dead-code removal and simpler stderr formatting only; no auth or transport logic changes.

Overview
Removes dead error-handling in git-remote-entire that tried to turn OAuth invalid_target responses (with a “lives on <host>” description) into a friendly fatal message and suggested git clone entire://… URL. That path depended on repo-scoped token exchange, which the helper no longer performs after jurisdiction-token bearer auth.

githelper.Run failures now always print fatal: %v on stderr instead of going through fatalMessage. Also drops wrongClusterRe, the sts/errors/regexp imports, and TestFatalMessage.

Behavior for real wrong-cluster clones is unchanged in practice: users still see the generic transfer error (e.g. “Repository not found”), not the old hint.

Reviewed by Cursor Bugbot for commit 0e8e8b3. Configure here.

fatalMessage special-cased an RFC 8693 invalid_target error whose
description named the cluster actually serving the repo, turning it into
"this repository is not hosted on X; it lives on Y" plus a corrected
clone command. Nothing can produce that error any more, so the branch has
never been reachable in main.

It was added in #1575 (2026-06-30), built on the repo-scoped token
exchange the helper performed at the time. #1621 removed that exchange
for the interactive path — merged 2026-07-03 05:17, six hours BEFORE
#1575 merged at 11:22 — and #1622 migrated the ENTIRE_TOKEN path the next
morning. Both PRs were the same author's; neither conflicted with #1575
in any file, so nothing flagged it. The helper now presents a
jurisdiction token as a bearer and never exchanges, so no invalid_target
is ever returned to it.

Measured rather than reasoned. Cloning a single-placement repo from the
wrong cluster, against a helper built from main:

    $ git clone entire://aws-eu-central-1.entire.io/gh/entireio/cli-perf-benchmarks
    fatal: stateless-connect v2 info/refs: Repository not found

with ENTIRE_DEBUG showing the wire:

    GET /gh/entireio/cli-perf-benchmarks/info/refs?service=git-upload-pack
    HTTP/1.1 404 Not Found
    Repository not found

A plain 404 with a four-word body: no invalid_target, no
error_description, nothing naming the correct host. The same repo on its
own cluster clones fine with the same credentials, so that 404 is the
wrong-cluster response rather than an access failure.

So this is not repairable here. The 404 carries no information about
where the repo lives, and no client-side matcher can invent it. Restoring
the UX needs the data plane to say so on that response — worth noting the
helper already looks for an X-Entire-Replicas header there and logs its
absence, so the mechanism may partly exist. Filed separately; this commit
only removes code that cannot run.

TestFatalMessage went with it. It passed throughout by constructing the
invalid_target error itself, which verified the formatting and could
never observe that the input had no producer — the reason a dead branch
survived two years of green CI.

fatalMessage reduced to a single Sprintf with one caller, so it is
inlined rather than kept as a seam. If the hint returns it will match a
404 body, not an OAuth error, and would not reuse this shape.

Verified: identical stderr before and after (the point of the change),
lint clean, GOOS=windows vet clean, helper and remotehelper suites pass.

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

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.

🟢 Approval recommended

The reviewed changes remove unreachable code without changing current error behavior.

Pull request overview

Removes unreachable wrong-cluster error formatting while preserving generic fatal output.

Changes:

  • Deletes obsolete fatalMessage handling and related imports.
  • Removes the fossilized unit test and unused regex/auth logic.
File summaries
File Summary
cmd/git-remote-entire/main.go Removes dead wrong-cluster handling and simplifies error reporting.
cmd/git-remote-entire/main_test.go Removes tests for the deleted formatter.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

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