Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/relayfile-cli/checkpoint_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
checkpointLifecycleIDPattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$`)
checkpointDigestPattern = regexp.MustCompile(`^sha256:[0-9a-f]{64}$`)
checkpointRevisionPattern = regexp.MustCompile(`^(?:0|rev_[0-9]+)$`)
checkpointCursorPattern = regexp.MustCompile(`^(?:0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,501})$`)
checkpointCursorPattern = regexp.MustCompile(`^(?:0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,500})$`)
)

type checkpointCLIError struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/relayfile-cli/checkpoint_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ type fakeCheckpointLease struct{ released bool }
func (l *fakeCheckpointLease) Release() error { l.released = true; return nil }

func TestCheckpointCursorPattern(t *testing.T) {
valid := []string{"0", "evt_42", "upstream:v1:notion:page_123", "upstream:v1:notion:page_123:2", "upstream:v1:" + strings.Repeat("a", 501)}
invalid := []string{"", " ", "evt_", "upstream:v1:", "upstream:v1:notion page_123", " upstream:v1:notion:page_123 ", "upstream:v1:notion\npage_123", "upstream:v1:slack:bad\\id", "upstream:v1:slack:bad\x7fid", "upstream:v1:" + strings.Repeat("a", 502)}
valid := []string{"0", "evt_42", "upstream:v1:notion:page_123", "upstream:v1:notion:page_123:2", "upstream:v1:" + strings.Repeat("a", 500)}
invalid := []string{"", " ", "evt_", "upstream:v1:", "upstream:v1:notion page_123", " upstream:v1:notion:page_123 ", "upstream:v1:notion\npage_123", "upstream:v1:slack:bad\\id", "upstream:v1:slack:bad\x7fid", "upstream:v1:" + strings.Repeat("a", 501)}
for _, cursor := range valid {
if !checkpointCursorPattern.MatchString(cursor) {
t.Errorf("valid cursor rejected: %q", cursor)
Expand Down
2 changes: 1 addition & 1 deletion internal/mountsync/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var (
ErrCheckpointNonConverged = errors.New("local and durable Relayfile state did not converge")
checkpointSessionPattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$`)
checkpointRevisionPattern = regexp.MustCompile(`^(?:0|rev_[0-9]+)$`)
checkpointEventCursorPattern = regexp.MustCompile(`^(?:0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,501})$`)
checkpointEventCursorPattern = regexp.MustCompile(`^(?:0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,500})$`)
mountCorrelationIDPattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$`)
)

Expand Down
4 changes: 2 additions & 2 deletions internal/mountsync/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10948,7 +10948,7 @@ func TestCheckpointEventCursorPattern(t *testing.T) {
"evt_42",
"upstream:v1:linear:issue_123",
"upstream:v1:linear:issue_123:2",
"upstream:v1:" + strings.Repeat("a", 501),
"upstream:v1:" + strings.Repeat("a", 500),
}
invalid := []string{
"",
Expand All @@ -10960,7 +10960,7 @@ func TestCheckpointEventCursorPattern(t *testing.T) {
" upstream:v1:linear:issue_123 ",
"upstream:v1:linear/issue_123",
"upstream:v1:linear\nissue_123",
"upstream:v1:slack:bad\\id", "upstream:v1:slack:bad\x7fid", "upstream:v1:" + strings.Repeat("a", 502),
"upstream:v1:slack:bad\\id", "upstream:v1:slack:bad\x7fid", "upstream:v1:" + strings.Repeat("a", 501),
}
for _, cursor := range valid {
if !checkpointEventCursorPattern.MatchString(cursor) {
Expand Down
2 changes: 1 addition & 1 deletion internal/relayfile/checkpoint_seal.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var (
ErrCheckpointAdminConflict = errors.New("checkpoint administrative reconciliation identity conflicts with durable state")
checkpointSessionPattern = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$`)
checkpointRevisionPattern = regexp.MustCompile(`^(?:0|rev_[0-9]+)$`)
checkpointEventCursorPattern = regexp.MustCompile(`^(?:0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,501})$`)
checkpointEventCursorPattern = regexp.MustCompile(`^(?:0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,500})$`)
)

const (
Expand Down
4 changes: 2 additions & 2 deletions internal/relayfile/checkpoint_seal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
const checkpointTestConsumerPrincipal = "cloud-dashboard-observer"

func TestCheckpointEventCursorPattern(t *testing.T) {
valid := []string{"0", "evt_42", "upstream:v1:github:pull_123", "upstream:v1:github:pull_123:2", "upstream:v1:" + strings.Repeat("a", 501)}
invalid := []string{"", " ", "evt_", "upstream:v1:", "upstream:v1:github pull_123", " upstream:v1:github:pull_123 ", "upstream:v1:github\tpull_123", "upstream:v1:slack:bad\\id", "upstream:v1:slack:bad\x7fid", "upstream:v1:" + strings.Repeat("a", 502)}
valid := []string{"0", "evt_42", "upstream:v1:github:pull_123", "upstream:v1:github:pull_123:2", "upstream:v1:" + strings.Repeat("a", 500)}
invalid := []string{"", " ", "evt_", "upstream:v1:", "upstream:v1:github pull_123", " upstream:v1:github:pull_123 ", "upstream:v1:github\tpull_123", "upstream:v1:slack:bad\\id", "upstream:v1:slack:bad\x7fid", "upstream:v1:" + strings.Repeat("a", 501)}
for _, cursor := range valid {
if !checkpointEventCursorPattern.MatchString(cursor) {
t.Errorf("valid cursor rejected: %q", cursor)
Expand Down
6 changes: 3 additions & 3 deletions openapi/relayfile-v1.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4121,7 +4121,7 @@ components:
pattern: '^(0|rev_[0-9]+)$'
eventCursor:
type: string
pattern: '^(0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,501})$'
pattern: '^(0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,500})$'
issuedAt:
type: string
format: date-time
Expand Down Expand Up @@ -4219,7 +4219,7 @@ components:
pattern: '^(0|rev_[0-9]+)$'
eventCursor:
type: string
pattern: '^(0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,501})$'
pattern: '^(0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,500})$'
consumedAt:
type: string
format: date-time
Expand Down Expand Up @@ -4262,7 +4262,7 @@ components:
pattern: '^(0|rev_[0-9]+)$'
eventCursor:
type: string
pattern: '^(0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,501})$'
pattern: '^(0|evt_[0-9]+|upstream:v1:[A-Za-z0-9._:\-]{1,500})$'
issuedAt:
type: string
format: date-time
Expand Down
Loading