Centralize target capability wiring in session setup · Entire

Centralize target capability wiring in session setup

f3c0328→main·

Soph·3mo ago·2 files·+12 added/-7 removed

Sessions

6dcbf336156bView transcript

Changes

452 unmodified lines

453
454
455
456
456
457
458
459

452 unmodified lines

- All mapping validation happens before network activity. Status: done
- Capability negotiation is centralized and enforced consistently. Status: partial
  Source-side fetch capability checks now live behind `gitproto.RefService` methods, and planner relay gating now consumes a narrower syncer-level policy instead of importing `gitproto` types directly. Some target-side relay decisions still rely on orchestration wiring rather than a fully unified capability model, so this remains partial.
  Source-side fetch capability checks now live behind `gitproto.RefService` methods, and sync session setup now owns target advertisement, derived target features, relay policy, and the target pusher together instead of rebuilding those pieces ad hoc in `Run`. Some target-side relay decisions still rely on orchestration wiring rather than a fully unified capability model, so this remains partial.
- Relay strategies are separate packages with explicit inputs and outputs. Status: done
- Tag creation is correct whether or not a pack transfer is needed. Status: done
- Stats are concurrency-safe. Status: done

Mdocs/rewrite-issue-list.md+1/-1

312 unmodified lines

313
314
315
316
317
318
319
320
321
49 unmodified lines

371
372
373
374
375
376
377
378
379
380
381
382
12 unmodified lines

395
396
397
389
390
391
392
393
394
398
399
400
401
402

312 unmodified lines

targetConn      *gitproto.Conn
    sourceService   *gitproto.RefService
    targetAdv       *packp.AdvRefs
    targetFeatures  gitproto.TargetFeatures
    targetPolicy    planner.RelayTargetPolicy
    targetPusher    gitproto.Pusher
    sourceRefMap    map[plumbing.ReferenceName]plumbing.Hash
    targetRefMap    map[plumbing.ReferenceName]plumbing.Hash
    measurementDone func() Measurement
49 unmodified lines

return nil, fmt.Errorf("decode target refs: %w", err)
    }
    s.targetRefMap = gitproto.RefHashMap(targetRefSlice)
    s.targetFeatures = gitproto.TargetFeaturesFromAdvRefs(s.targetAdv)
    s.targetPolicy = planner.RelayTargetPolicy{
        CapabilitiesKnown: s.targetFeatures.Known,
        NoThin:            s.targetFeatures.NoThin,
    }
    s.targetPusher = gitproto.NewPusher(s.targetConn, s.targetAdv, cfg.Verbose)
    }

return s, nil
12 unmodified lines

sourceConn := s.sourceConn
    sourceService := s.sourceService
    targetAdv := s.targetAdv
    targetFeatures := gitproto.TargetFeaturesFromAdvRefs(targetAdv)
    targetPolicy := planner.RelayTargetPolicy{
        CapabilitiesKnown: targetFeatures.Known,
        NoThin:            targetFeatures.NoThin,
    }
    targetPusher := gitproto.NewPusher(s.targetConn, s.targetAdv, cfg.Verbose)

targetPolicy := s.targetPolicy
targetPusher := s.targetPusher
sourceRefMap := s.sourceRefMap
targetRefMap := s.targetRefMap