resume: align checkpoint fallback return values · Entire

resume: align checkpoint fallback return values

3800603→main·

peyton-alt·3w ago·3 files·+9 added/-6 removed

Sessions

aac146a80d97View transcript

[?
Add Trail Resume SubcommandCodex·GPT-5.5·3 steps](/content/gh/entireio/cli/session/019ef5f3-3472-7f70-82f7-6f0ce46691f4#timeline-aac146a80d97/index.html)

Changes

3

223 unmodified lines

74 unmodified lines

17 unmodified lines

518 unmodified lines

854
855
856
857
857
858
859
860

223 unmodified lines

metadata, err := readCheckpointInfoFromStore(ctx, store, checkpointID)
    if err != nil {
        if checkpointpolicy.IsUnsupportedVersion(err) {
            return err
            return nil, err
        }
        logging.Debug(ctx, "resume by checkpoint: metadata read failed, checking remote",
            slog.String("checkpoint_id", checkpointID.String()),
74 unmodified lines

if len(result.checkpointIDs) > 1 {
        latestMetadata, found, err := resolveLatestCheckpoint(ctx, store, result.checkpointIDs)
        if err != nil {
            return err
            return nil, err
        }
        if !found {
            // No metadata available — nothing to resume from
17 unmodified lines

metadata = storeInfo
        } else {
            if checkpointpolicy.IsUnsupportedVersion(storeErr) {
                return storeErr
                return nil, storeErr
            }
            logging.Debug(ctx, "checkpoint store metadata read failed",
                slog.String("checkpoint_id", checkpointID.String()),
518 unmodified lines

)
    }
    if unsupportedVersionErr != nil {
        return unsupportedVersionErr
        return nil, unsupportedVersionErr
    }

// Nothing worked — print helpful error message

Mcmd/entire/cli/resume.go+4/-4

1209 unmodified lines

1210
1211
1212
1213
1213
1214
1215
1216

1209 unmodified lines

}

var stdout, stderr bytes.Buffer
    err = checkRemoteMetadata(context.Background(), &stdout, &stderr, checkpointID, checkpoint.DefaultV1Refs())
    _, err = checkRemoteMetadata(context.Background(), &stdout, &stderr, checkpointID, checkpoint.DefaultV1Refs())
    if err == nil {
        t.Fatal("checkRemoteMetadata() error = nil, want unsupported checkpoint version")
    }

Mcmd/entire/cli/resume_test.go+1/-1

453 unmodified lines

454
455
456
457
457
458
459
460
461
462
463
464
465
466

453 unmodified lines

checkpointID := result.checkpointIDs[0]
    if len(result.checkpointIDs) > 1 {
        latestMetadata, latestErr := resolveLatestCheckpoint(ctx, store, result.checkpointIDs)
        latestMetadata, found, latestErr := resolveLatestCheckpoint(ctx, store, result.checkpointIDs)
        if latestErr != nil {
            return nil, fmt.Errorf("resolve latest checkpoint: %w", latestErr)
        }
        if !found {
            return nil, errors.New("resolve latest checkpoint: no checkpoint metadata found")
        }
        checkpointID = latestMetadata.CheckpointID
    }

Mcmd/entire/cli/trail_resume_cmd.go+4/-1