package main import ( "context" "errors" "time" ) type recordsSyncSchedulerStore interface { EnqueueDue(context.Context) (bool, error) TrackQualityWeeks(context.Context, time.Time) error FreezePreviousQualityWeek(context.Context, time.Time) (bool, error) } func runRecordsSyncCycle(ctx context.Context, store recordsSyncSchedulerStore, at time.Time) error { _, syncErr := store.EnqueueDue(ctx) trackingErr := store.TrackQualityWeeks(ctx, at) if trackingErr != nil { return errors.Join(syncErr, trackingErr) } _, freezeErr := store.FreezePreviousQualityWeek(ctx, at) return errors.Join(syncErr, freezeErr) }