clusterdiscovery: recompute account per op; cache only cluster->cores · Entire
clusterdiscovery: recompute account per op; cache only cluster->cores
b75fe5e→main·
toothbrush·1mo ago·4 files·+282 added/-291 removed
Reworks ResolveContextForCluster around the cluster_cores cache and a fresh per-operation account selection, replacing the cluster->context binding model:
- Cluster cores come from cluster_cores.json (TTL'd, stale-fallback), not a persisted account choice.
- Account selection: active context wins if its core fronts the cluster; else the sole eligible context; else (>1 eligible, none active) a hard error listing the candidates and pointing at
entire auth use. No more silent on-disk-order pick, which could authenticate as the wrong account and then freeze that choice.
Drops the post-success bind hook from git-remote-entire (makeBindHook) and adds a cacheDir argument to ResolveContextForCluster. The binding APIs in contexts/ and the auth command surface are removed in a follow-up.
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
32bbd6549652 View transcript
Changes
4
cmd/git-remote-entire
M main.go +7/-46
M main_test.go -61
internal/entireclient/clusterdiscovery
M resolve.go +132/-57
M resolve_test.go +143/-127
26 unmodified lines
... // elided for brevity
Code Implementation
package clusterdiscovery
import (
"encoding/json"
"net/http"
"sync/atomic"
"testing"
)
func TestResolveContextForClusterBindingShortCircuits(t *testing.T) {
// Test of context resolution behavior
}
// Additional tests omitted for brevity
// Test if binding works correctly
func TestMakeBindHook(t *testing.T) {
// Test implementation
}
Error Handling
- Ambiguous context errors are raised when multiple contexts are found without an active choice.
- Proper messages are displayed for users when their chosen context is not found.