Assert checkpoint-ID validity via the production validator in e2e · Entire

Assert checkpoint-ID validity via the production validator in e2e

ea67c06→main·

Soph·2w ago·1 file·+5 added/-9 removed

AssertCheckpointIDFormat claimed to assert a valid checkpoint ID but matched against CheckpointPattern, which is now intentionally a loose extraction regex — it accepts ULID-shaped strings production rejects (e.g. a timestamp overflow starting 8-Z). Call checkpointid.Validate instead so the test rejects exactly what production rejects. Removes the now-unused checkpointIDPattern var and regexp import.

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

Sessions

26deff09fc9dView transcript

Changes

1

6 unmodified lines

7
8
9
10
10
11
12
12 unmodified lines

25
26
27
29
30
31
32
33
28
29
30
129 unmodified lines

160
161
162
169
163
164
165
166
167
172
173
168
169
170
171
172

6 unmodified lines

"fmt"
    "os"
    "path/filepath"
    "regexp"
    "strings"
    "testing"
    "time"
12 unmodified lines

ExpectedTranscriptContent []string
}

// 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.
func AssertFileExists(t *testing.T, dir string, glob string) {
129 unmodified lines

}

// AssertCheckpointIDFormat asserts the checkpoint ID is a valid checkpoint ID:
// either 12 lowercase hex chars or a 26-char Crockford base32 ULID.
// either 12 lowercase hex chars or a canonical 26-char ULID. It calls the
// production validator (not a loose regex) so the test rejects exactly what
// production rejects — e.g. a ULID-shaped but timestamp-overflowing string.
func AssertCheckpointIDFormat(t *testing.T, checkpointID string) {

t.Helper()
    assert.Regexp(t, checkpointIDPattern, checkpointID,
        "checkpoint ID %q should be 12 lowercase hex chars or a 26-char ULID", checkpointID)
    assert.NoErrorf(t, checkpointid.Validate(checkpointID),
        "checkpoint ID %q should be a valid checkpoint ID (12-hex or ULID)", checkpointID)
}

// AssertHasCheckpointTrailer asserts the commit has an Entire-Checkpoint trailer,