Narrow sync execution through session helpers · Entire

Narrow sync execution through session helpers

5923020→main·

Soph·3mo ago·2 files·+33 added/-17 removed

Sessions

b6cb5c0bad67View 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 build:Codex·GPT-5.4·1 step](/content/gh/entireio/git-sync/session/019d6d29-8cf7-7fe3-adc9-8c3e4d9d5603#timeline-b6cb5c0bad67/index.html)

Changes

2

298 unmodified lines

299
300
301
302
303
304
305

298 unmodified lines

- 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.
- Syncer normal execution now routes both incremental relay and materialized fallback through session-owned helpers instead of rebuilding transport, capability, and policy inputs inline inside `Run`.
- Some helpers still carry broad parameter structs, so this remains partial rather than fully complete.

## Performance And Scalability

Mdocs/rewrite-issue-list.md+1

392 unmodified lines

393
394
395
396
397
396
397
398
62 unmodified lines

461
462
463
466
464
465
466
467
470
471
472
473
474
475
476
477
478
468
469
470
471
3 unmodified lines

475
476
477
488
489
490
491
492
478
479
480
481
182 unmodified lines

664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698

392 unmodified lines

measurementDone := s.measurementDone
    stats := s.stats
    sourceService := s.sourceService
    targetPolicy := s.targetPolicy
    targetPusher := s.targetPusher
    sourceRefMap := s.sourceRefMap
    targetRefMap := s.targetRefMap

62 unmodified lines

if !cfg.DryRun && result.Blocked > 0 {
        return result, fmt.Errorf("blocked %d ref update(s); rerun with --force where appropriate", result.Blocked)
    }
    result.RelayReason = planner.RelayFallbackReason(cfg.Force, cfg.Prune, cfg.DryRun, pushPlans, targetPolicy)
    result.RelayReason = planner.RelayFallbackReason(cfg.Force, cfg.Prune, cfg.DryRun, pushPlans, s.targetPolicy)

if !cfg.DryRun {
        // Try incremental relay first
        incResult, err := incremental.Execute(ctx, incremental.Params{
            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) {
                return planner.CanIncrementalRelay(force, prune, dryRun, plans, targetPolicy)
            },
            CanTagRelay: planner.CanFullTagCreateRelay,
        }, planConfig(cfg))
        incResult, err := s.executeIncremental(ctx, desiredRefs, pushPlans)
        if err != nil {
            return result, err
        }
3 unmodified lines

result.RelayReason = incResult.RelayReason
        } else if len(pushPlans) > 0 {
            // Materialized fallback
            if err := materialized.Execute(ctx, materialized.Params{
                Store: repo.Storer, SourceConn: s.sourceConn, SourceService: sourceService, TargetPusher: targetPusher,
                DesiredRefs: desiredRefs, TargetRefs: targetRefMap,
                PushPlans: pushPlans, MaxObjects: cfg.MaterializedMaxObjects,
            }); err != nil {
            if err := s.executeMaterialized(ctx, repo.Storer, desiredRefs, pushPlans); err != nil {
                return result, err
            }
        }
182 unmodified lines

}, nil
}

func (s *syncSession) executeIncremental(
    ctx context.Context,
    desiredRefs map[plumbing.ReferenceName]planner.DesiredRef,
    pushPlans []planner.BranchPlan,
) (incremental.Result, error) {
    return incremental.Execute(ctx, incremental.Params{
        SourceConn: s.sourceConn, SourceService: s.sourceService, TargetPusher: s.targetPusher,
        DesiredRefs: desiredRefs, TargetRefs: s.targetRefMap,
        PushPlans: pushPlans, MaxPackBytes: s.cfg.MaxPackBytes,
        CanRelay: func(force, prune, dryRun bool, plans []planner.BranchPlan) (bool, string) {
            return planner.CanIncrementalRelay(force, prune, dryRun, plans, s.targetPolicy)
        },
        CanTagRelay: planner.CanFullTagCreateRelay,
    }, planConfig(s.cfg))
}

func (s *syncSession) executeMaterialized(
    ctx context.Context,
    store storer.Storer,
    desiredRefs map[plumbing.ReferenceName]planner.DesiredRef,
    pushPlans []planner.BranchPlan,
) error {
    return materialized.Execute(ctx, materialized.Params{
        Store: store, SourceConn: s.sourceConn, SourceService: s.sourceService, TargetPusher: s.targetPusher,
        DesiredRefs: desiredRefs, TargetRefs: s.targetRefMap,
        PushPlans: pushPlans, MaxObjects: s.cfg.MaterializedMaxObjects,
    })
}

func countObjects(store storer.EncodedObjectStorer) (int, error) {
    iter, err := store.IterEncodedObjects(plumbing.AnyObject)
    if err != nil {