Skip to content

Commit 73aca64

Browse files
committed
fix: address bugbot review comments
- looksLikeCUID: require first character to be a letter (cuid2 spec) - FakeProxyService.CheckFunc: update type signature and delegation to include body parameter Made-with: Cursor
1 parent dac2b2a commit 73aca64

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

cmd/proxies/check_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func TestProxyCheck_ShowsBypassHosts(t *testing.T) {
1313
buf := captureOutput(t)
1414

1515
fake := &FakeProxyService{
16-
CheckFunc: func(ctx context.Context, id string, opts ...option.RequestOption) (*kernel.ProxyCheckResponse, error) {
16+
CheckFunc: func(ctx context.Context, id string, body kernel.ProxyCheckParams, opts ...option.RequestOption) (*kernel.ProxyCheckResponse, error) {
1717
return &kernel.ProxyCheckResponse{
1818
ID: id,
1919
Name: "Proxy 1",

cmd/proxies/common_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type FakeProxyService struct {
4141
GetFunc func(ctx context.Context, id string, opts ...option.RequestOption) (*kernel.ProxyGetResponse, error)
4242
NewFunc func(ctx context.Context, body kernel.ProxyNewParams, opts ...option.RequestOption) (*kernel.ProxyNewResponse, error)
4343
DeleteFunc func(ctx context.Context, id string, opts ...option.RequestOption) error
44-
CheckFunc func(ctx context.Context, id string, opts ...option.RequestOption) (*kernel.ProxyCheckResponse, error)
44+
CheckFunc func(ctx context.Context, id string, body kernel.ProxyCheckParams, opts ...option.RequestOption) (*kernel.ProxyCheckResponse, error)
4545
}
4646

4747
func (f *FakeProxyService) List(ctx context.Context, opts ...option.RequestOption) (*[]kernel.ProxyListResponse, error) {
@@ -75,7 +75,7 @@ func (f *FakeProxyService) Delete(ctx context.Context, id string, opts ...option
7575

7676
func (f *FakeProxyService) Check(ctx context.Context, id string, body kernel.ProxyCheckParams, opts ...option.RequestOption) (*kernel.ProxyCheckResponse, error) {
7777
if f.CheckFunc != nil {
78-
return f.CheckFunc(ctx, id, opts...)
78+
return f.CheckFunc(ctx, id, body, opts...)
7979
}
8080
return &kernel.ProxyCheckResponse{ID: id, Type: kernel.ProxyCheckResponseTypeDatacenter}, nil
8181
}

cmd/root.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,12 @@ func looksLikeCUID(s string) bool {
260260
if len(s) != 24 {
261261
return false
262262
}
263-
for _, c := range s {
264-
if !((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) {
263+
for i, c := range s {
264+
if i == 0 {
265+
if !(c >= 'a' && c <= 'z') {
266+
return false
267+
}
268+
} else if !((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9')) {
265269
return false
266270
}
267271
}

0 commit comments

Comments
 (0)