Narrow bootstrap execution handoff in syncer · Entire
Narrow bootstrap execution handoff in syncer
e397687→main·
Soph·3mo ago·2 files·+11 added/-19 removed
Sessions
e91c0933deb3View transcript
[?
Can you take a look at the go code (wasm) in /Users/soph/Work/entire/devenv/entire-io-worktree1 based a bit on that I wonder if something like this can be built:Codex·GPT-5.4·1 step](/content/gh/entireio/git-sync/session/019d6d29-8cf7-7fe3-adc9-8c3e4d9d5603#timeline-e91c0933deb3/index.html)
Changes
2
docs
Mrewrite-issue-list.md+1
internal/syncer
Msyncer.go+10/-19
297 unmodified lines
298
299
300
301
302
303
304
297 unmodified lines
- Incremental relay policy decisions are now injected consistently instead of splitting between one injected check and one hard-coded planner call.
- Bootstrap checkpoint planning now carries its graph, probe cache, and prefetched-pack state inside a dedicated internal planner object instead of one large helper function.
- The materialized fallback now runs through an explicit executor with separate stages for tag prefetch, object-closure collection, limit enforcement, and push execution.
- Syncer bootstrap execution now takes a shared session object instead of threading raw source/target transports, stats, logger, measurement, and target advertisement through a wide helper signature.
- Some helpers still carry broad parameter structs, so this remains partial rather than fully complete.
## Performance And Scalability
Mdocs/rewrite-issue-list.md+1
391 unmodified lines
392
393
394
395
395
397
396
397
398
20 unmodified lines
419
420
421
424
422
423
424
425
2 unmodified lines
428
429
430
433
431
432
433
434
33 unmodified lines
468
469
470
473
471
472
473
474
11 unmodified lines
486
487
488
491
489
490
491
492
41 unmodified lines
534
535
536
539
537
538
539
540
114 unmodified lines
655
656
657
660
661
662
663
664
665
658
659
660
661
669
662
671
663
673
664
665
675
676
666
667
668
669
670
3 unmodified lines
674
675
676
686
677
678
679
680
391 unmodified lines
}
measurementDone := s.measurementDone
stats := s.stats
sourceConn := s.sourceConn
sourceService := s.sourceService
targetAdv := s.targetAdv
targetPolicy := s.targetPolicy
targetPusher := s.targetPusher
sourceRefMap := s.sourceRefMap
20 unmodified lines
Measurement: measurementDone(), Protocol: sourceService.Protocol,
}, nil
}
return bootstrapWithInputs(ctx, cfg, stats, s.logger, sourceConn, s.targetConn, sourceService, targetAdv, desiredRefs, targetRefMap, reason, measurementDone)
return bootstrapWithInputs(ctx, s, desiredRefs, targetRefMap, reason)
}
// Normal sync: allocate in-memory repo and fetch objects
2 unmodified lines
return Result{}, fmt.Errorf("init in-memory repository: %w", err)
}
gpDesired := convert.DesiredRefs(desiredRefs)
if err := sourceService.FetchToStore(ctx, repo.Storer, sourceConn, gpDesired, targetRefMap); err != nil {
if err := sourceService.FetchToStore(ctx, repo.Storer, s.sourceConn, gpDesired, targetRefMap); err != nil {
if !errors.Is(err, git.NoErrAlreadyUpToDate) {
return Result{}, err
}
33 unmodified lines
if !cfg.DryRun {
// Try incremental relay first
incResult, err := incremental.Execute(ctx, incremental.Params{
SourceConn: sourceConn, SourceService: sourceService, TargetPusher: targetPusher,
SourceConn: s.sourceConn, SourceService: sourceService, TargetPusher: targetPusher,
DesiredRefs: desiredRefs, TargetRefs: targetRefMap,
PushPlans: pushPlans, MaxPackBytes: cfg.MaxPackBytes,
CanRelay: func(force, prune, dryRun bool, plans []planner.BranchPlan) (bool, string) {
11 unmodified lines
} else if len(pushPlans) > 0 {
// Materialized fallback
if err := materialized.Execute(ctx, materialized.Params{
Store: repo.Storer, SourceConn: sourceConn, SourceService: sourceService, TargetPusher: targetPusher,
Store: repo.Storer, SourceConn: s.sourceConn, SourceService: sourceService, TargetPusher: targetPusher,
DesiredRefs: desiredRefs, TargetRefs: targetRefMap,
PushPlans: pushPlans, MaxObjects: cfg.MaterializedMaxObjects,
}); err != nil {
41 unmodified lines
}
_, reason := planner.CanBootstrapRelay(cfg.Force, cfg.Prune, desiredRefs, s.targetRefMap)
result, err := bootstrapWithInputs(ctx, cfg, s.stats, s.logger, s.sourceConn, s.targetConn, s.sourceService, s.targetAdv, desiredRefs, s.targetRefMap, reason, s.measurementDone)
result, err := bootstrapWithInputs(ctx, s, desiredRefs, s.targetRefMap, reason)
result.Measurement = s.measurementDone()
return result, err
}
}
func bootstrapWithInputs(
ctx context.Context,
cfg Config,
stats *statsCollector,
logger *slog.Logger,
sourceConn, targetConn *gitproto.Conn,
sourceService *gitproto.RefService,
targetAdv *packp.AdvRefs,
s *syncSession,
desiredRefs map[plumbing.ReferenceName]planner.DesiredRef,
targetRefs map[plumbing.ReferenceName]plumbing.Hash,
relayReason string,
measurementDone func() Measurement,
) (Result, error) {
targetPusher := gitproto.NewPusher(targetConn, targetAdv, cfg.Verbose)
bResult, err := bstrap.Execute(ctx, bstrap.Params{
SourceConn: sourceConn, SourceService: sourceService, TargetPusher: targetPusher,
SourceConn: s.sourceConn, SourceService: s.sourceService, TargetPusher: s.targetPusher,
DesiredRefs: desiredRefs, TargetRefs: targetRefs,
MaxPackBytes: cfg.MaxPackBytes, BatchMaxPack: cfg.BatchMaxPackBytes,
Verbose: cfg.Verbose, Logger: logger,
MaxPackBytes: s.cfg.MaxPackBytes, BatchMaxPack: s.cfg.BatchMaxPackBytes,
Verbose: s.cfg.Verbose, Logger: s.logger,
}, relayReason)
if err != nil {
return Result{}, err
3 unmodified lines
Relay: bResult.Relay, RelayMode: bResult.RelayMode, RelayReason: bResult.RelayReason,
Batching: bResult.Batching, BatchCount: bResult.BatchCount,
PlannedBatchCount: bResult.PlannedBatchCount, TempRefs: bResult.TempRefs,
Stats: stats.snapshot(), Measurement: measurementDone(), Protocol: sourceService.Protocol,
Stats: s.stats.snapshot(), Measurement: s.measurementDone(), Protocol: s.sourceService.Protocol,
}, nil
}
``