can you review the current state of the branch in relation to docs/rewrite-issue-list.md and @docs/rewrite-memo.md

Claude Code·Opus 4.6[1m]·Soph·5mo ago·59min·1 Checkpoint·41 file changes·+642/-749·55.3K tokens

can you review the current state of the branch in relation to docs/rewrite-issue-list.md and @docs/rewrite-memo.md

5mo ago·2m

All tests pass. Here's the branch review.


Branch Status vs. Rewrite Documents

Package Structure — Fully Realized

The memo proposed 7 packages. The branch delivers all 7 plus a small convert bridge:

ProposedActualSource LOCTest LOC
internal/gitproto~1,670~1,130
internal/planner~1,478~921
internal/auth~490~689
internal/strategy/bootstrap~599~340
internal/strategy/incremental~86~407
internal/strategy/materialized~101~124
internal/syncer (orchestrator)~709~2,440
internal/convert (bonus bridge)~400

The syncer went from being the monolith (~3k+ LOC on main) to ~709 lines of orchestration. That's the structural win the memo was after.

Issue List Scorecard

Done (17 of 22):

#IssueStatus
1Batched bootstrap false tag successdone
2Duplicate target mappings accepteddone
3Mapping normalization inconsistenciesdone
4Sideband preference backwardsdone
6v2 include-tag without capability gatedone
7OAuth refresh failures swalloweddone
8statsCollector racedone
9Unbounded response readsdone
10File token store no lockingdone
11syncer.go monolithdone
12Entry points duplicate setupdone
16FF check unbounded graph walkdone
17Packet parsing allocationdone
18Planning functions under-testeddone
19Relay eligibility under-testeddone
20Protocol v2 error handling under-testeddone
22No benchmark coveragedone

Partial (5 of 22):

#IssueWhat remains
5Pack reader leak in batch loopCore ownership is clearer + direct error-path tests exist, but deeper batched failure paths need a fuller close-audit
13Functions carry too much ambient stateMajor extraction done; strategy deps are narrowed. Some helpers still carry broad parameter structs
14Batch planning probes by fetching full packsCommit-count heuristic + probe memoization + pack caching added. Still fundamentally network-probed for sizing
15Materialized fallback doesn't scaleSafety limits added (500k objects) with explicit failure. Still in-memory, no disk-spill path
21Missing behavioral coverageMany cases now covered. Some harder injected pack-transfer failure paths remain

Acceptance Criteria

All 10 acceptance criteria from the issue list:

CriterionStatus
Mapping validation before network activity✅ done
Capability negotiation centralized⚠️ partial — source-side is clean, target-side relay gating still orchestration-level
Relay strategies in separate packages✅ done
Tag creation correct without pack transfer✅ done
Stats concurrency-safe✅ done
Structured logging✅ done (slog)
Protocol malformed-input tests✅ done
go test ./... and -race pass✅ done
Benchmarks for critical paths✅ done
Comparable to current integration scenarios✅ done

Remaining go-git Dependency

The memo recommended owning the HTTP protocol layer directly and keeping go-git only for packfile/object utilities. The branch still depends on go-git/v5 — the protocol layer is mostly custom now (via gitproto), but go-git transport/protocol types are still used in some paths rather than being fully replaced. This matches the "partial" note on capability centralization.

Overall Assessment

The branch is in solid shape. The structural goals from the memo are met — the monolith is decomposed, the package model matches the proposal, tests are extensive (~6,100 lines of test code), and all tests pass cleanly.

The 5 partial items are all explicitly acknowledged in the issue list and represent conscious scope boundaries rather than oversights:

  • #5, #13 are about further tightening, not missing functionality
  • #14, #15 are deliberate "good enough for now" engineering tradeoffs called out in the memo's performance section
  • #21 is incremental test coverage work

The branch looks ready for comparison testing against main on the existing integration scenarios, which is the next logical step before merge.

go-git/v5 <- why are we not using v6

5mo ago·3m

There is no v6. go-git/v6 only exists as v6.0.0-alpha.1 — a single alpha pre-release, not suitable for production use.

The project is on v5.17.0, which is two patches behind the latest stable (v5.17.2), but there's no stable v6 to move to.

I'd like to still switch to v6

5mo ago·1m

OK, now I have the full picture. go-git v5 is not a vestigial dependency — it's deeply embedded across the entire codebase. Here's the usage surface:

~100+ import lines across 20+ files, using these go-git v5 sub-packages:

Sub-packageUsed forWhere
plumbingHash, ReferenceName, NewHasheverywhere
plumbing/protocol/packpAdvRefs, UploadPackRequestgitproto, planner, syncer
plumbing/protocol/packp/capabilityCapability, Listgitproto, planner, bootstrap
plumbing/protocol/packp/sidebandsideband demuxgitproto
plumbing/transportEndpoint, AuthMethodgitproto, auth, syncer
plumbing/transport/httpBasicAuth, HTTP transportauth, gitproto, tests
plumbing/format/packfilepackfile encoder/scannergitproto, tests
plumbing/format/pktlinepkt-line encodergitproto, tests
plumbing/objectCommit, Tag objectsplanner, tests
plumbing/storerEncodedObjectStorerplanner, bootstrap, materialized
storage/memoryin-memory object storesyncer, bootstrap, tests
go-billyvirtual filesystemtests
top-level v5NoErrAlreadyUpToDate, Init, Clonebootstrap, materialized, tests

This is not a version bump — it's a migration across the entire type system. And we don't know what v6 alpha actually changed API-wise.

Before I start, I want to be straight with you: this is a significant amount of work against an alpha that could have breaking API changes, missing sub-packages, or bugs. The rewrite memo actually recommends the opposite direction — reducing go-git surface area and owning more of the protocol layer directly.

Do you want me to:

  1. Investigate v6 first — check what actually changed in the v6 API, whether the sub-packages above still exist with the same signatures, and report back before touching code?
  2. Just do it — mechanically switch to v6 and fix whatever breaks?
  3. Something else — e.g., use this as an opportunity to reduce the go-git surface area as the memo recommends, replacing go-git types with owned types where practical?

2

5mo ago·42m

Done. Here's what the migration involved:

go-git v5 → v6 Migration Summary

Dependencies:

  • go-git/go-git/v5 v5.17.0 → go-git/go-git/v6 v6.0.0-alpha.1
  • go-billy/v5 v5.8.0 → go-billy/v6
  • go-git/gcfggo-git/gcfg/v2

API changes handled:

v5v6
transport.Endpoint{Protocol, Host, Port, User, Path}transport.Endpoint embeds url.URL (.Scheme, .Hostname(), .Host, .User, .Path)
transport/client.InstallProtocoltransport.Register
transport/client.Protocols["http"]transport.Get("http")
transport/server.NewServer(loader)Removed — replaced with transport.UploadPack(), transport.ReceivePack(), transport.AdvertiseReferences() standalone functions
transport.UploadPackSession / ReceivePackSessionRemoved entirely
transport.UploadPackServiceNametransport.UploadPackService (typed Service)
transporthttp.NewClient(c)transporthttp.NewTransport(&TransportOptions{Client: c})
transporthttp.NewErr(res)Removed — replaced with local httpError()
packp.ReferenceUpdateRequestpackp.UpdateRequests (no Packfile/Progress fields)
packp.NewUploadPackRequestFromCapabilitiespackp.NewUploadRequest()
pktline.NewEncoderpktline.Writef(), pktline.WriteFlush(), pktline.WriteDelim()
git.Init(storage, worktree)git.Init(storage, git.WithWorkTree(worktree))

Architectural improvement: The v1 fetch and push paths were rewritten to use direct HTTP protocol handling (via PostRPCStream) instead of go-git's transport session abstraction. This aligns with the rewrite memo's goal of owning the smart HTTP protocol layer directly, and eliminates the dual-stack transport problem that was called out as a structural issue.

did you commit?

5mo ago·3.1s

No, I didn't commit. Would you like me to?

yes

5mo ago·42.7s

Committed as 749b51f. Net reduction of 107 lines, mostly from eliminating the go-git transport session layer.