Review the staged git changes (git diff --staged main) in this Go repository. This is a rewrite of a git-sync tool. Focus on: 1) any remaining correctness bugs 2) regressions from the old code 3) conc

Review the staged git changes (git diff --staged main) in this Go repository. This is a rewrite of a git-sync tool. Focus on: 1) any remaining correctness bugs 2) regressions from the old code 3) concurrency issues 4) error handling gaps. Be concise — under 500 words.
Reviewing the staged diff against main first, then I’ll trace the changed code paths for correctness, concurrency, regressions, and error handling.
The rewrite split concerns as intended; I’m checking whether behavior stayed equivalent in the new package boundaries and whether the old known failure modes were actually closed.
I’ve confirmed the obvious race fix in stats.go; now I’m looking for less visible regressions in protocol negotiation, bootstrap batching, and token-store behavior.
I’ve narrowed it to a few likely regressions. Running the test suite now to see which of those are already caught versus silently slipping through.
I found two concrete behavioral regressions and one remaining correctness issue that the green test run doesn’t cover. Pulling exact line references now.
Findings:
-
High: auth resolution now hard-fails instead of falling back when Entire DB state is half-configured. In internal/auth/entiredb.go
ReadStoredTokenerrors are returned directly, and internal/auth/auth.go propagates them out ofResolve. Onmain, missing/broken Entire tokens were treated as “no credential” and git credential helper could still succeed. With this rewrite, a stalehosts.jsonentry or missing keyring item now aborts the whole sync before trying helper auth. -
High: fast-forward detection is now lossy and can misclassify valid updates as non-FF. internal/planner/planner.go caps ancestry traversal at
100_000, and line 265 returnsfalse, nilwhen the limit is hit. That is a behavior regression frommain, which walked the graph exhaustively. Result: a legitimate fast-forward on a deep history can becomeActionBlock, or require--forceunnecessarily. -
Medium: the new “materialized safety limit” does not actually prevent the OOM path it claims to address.
Runstill fetches all desired objects into an in-memory repo before strategy selection in internal/syncer/syncer.go, while the limit check only happens later in internal/strategy/materialized/materialized.go. So large non-relay syncs can still exhaust memory before hitting the guard.
Open question:
- The new auth behavior intentionally surfaces refresh failures, which is good, but it should probably distinguish “refresh failed for a credential we actually selected” from “Entire lookup unavailable, try next provider”.
Verification:
go test ./...go test -race ./internal/syncer ./internal/auth ./internal/gitproto ./internal/planner