/simplify: route checkpoint-ID format checks through CheckpointPattern · Entire

/simplify: route checkpoint-ID format checks through CheckpointPattern

9c2ad6b→main·

Soph·2w ago·2 files·+10 added/-6 removed

Quality pass on the ULID understanding layer. Two ad-hoc 12-hex checkpoint-ID patterns now reuse the canonical id.CheckpointPattern so the accepted formats can't drift from the production definition:

Skipped (deliberately): resolveref.go looksLikeULID is a different domain (control-plane org/project name-vs-ULID disambiguation, case-insensitive) — not a checkpoint ID, correctly separate. Micro-opts to fold KindOf/Kind regex passes in Validate/ShardFor were left as-is: the cost is negligible (one anchored match on a <=26-char string, not a hot loop) and routing through Kind() keeps format recognition centralized.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

3bec8f0824f8View transcript

Changes

2

326 unmodified lines

output := out.String()

// Must contain Entire-Checkpoint trailer with 12-hex-char ID
re := regexp.MustCompile(`Entire-Checkpoint: [0-9a-f]{12}`)
// Must contain an Entire-Checkpoint trailer with a checkpoint ID in either
// supported format (legacy hex or ULID) — reuse the canonical pattern instead
// of re-hardcoding the hex-only shape.
re := regexp.MustCompile(`Entire-Checkpoint: ` + id.CheckpointPattern)
if !re.MatchString(output) {

t.Errorf("expected 'Entire-Checkpoint: <12-hex-id>' in output, got:\n%s", output)

t.Errorf("expected 'Entire-Checkpoint: <checkpoint-id>' in output, got:\n%s", output)
}
}

Mcmd/entire/cli/attach_test.go+5/-3

11 unmodified lines

// checkpointIDPattern matches a checkpoint ID in either format: a legacy
// 12-char lowercase hex ID or a 26-char Crockford base32 ULID.
var checkpointIDPattern = regexp.MustCompile(`^(?:[0-9a-f]{12}|[0-9ABCDEFGHJKMNPQRSTVWXYZ]{26})$`)
// checkpointIDPattern matches a checkpoint ID in either format (legacy 12-char
// hex or 26-char ULID). It reuses the id package's CheckpointPattern so the
// accepted formats can never drift from the production definition.
var checkpointIDPattern = regexp.MustCompile(`^` + checkpointid.CheckpointPattern + `$`)

// AssertFileExists asserts that at least one file matches the glob pattern
// relative to dir.

Me2e/testutil/assertions.go+5/-3