Skip to content

Commit 4d5fb57

Browse files
Thomas StrombergThomas Stromberg
authored andcommitted
increase samplecap to 100
1 parent 12bc9b3 commit 4d5fb57

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

internal/server/integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestOrgSampleStreamIntegration(t *testing.T) {
3333
// Create request
3434
reqBody := OrgSampleRequest{
3535
Org: "codeGROOVE-dev",
36-
SampleSize: 50,
36+
SampleSize: 100,
3737
Days: 60,
3838
}
3939
body, err := json.Marshal(reqBody)
@@ -195,7 +195,7 @@ func TestOrgSampleStreamNoTimeout(t *testing.T) {
195195
// Create request with larger sample size to ensure longer operation
196196
reqBody := OrgSampleRequest{
197197
Org: "codeGROOVE-dev",
198-
SampleSize: 50,
198+
SampleSize: 100,
199199
Days: 60,
200200
}
201201
body, err := json.Marshal(reqBody)

internal/server/server.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ type CalculateResponse struct {
144144
type RepoSampleRequest struct {
145145
Owner string `json:"owner"`
146146
Repo string `json:"repo"`
147-
SampleSize int `json:"sample_size,omitempty"` // Default: 50
147+
SampleSize int `json:"sample_size,omitempty"` // Default: 100
148148
Days int `json:"days,omitempty"` // Default: 60
149149
Config *cost.Config `json:"config,omitempty"`
150150
}
@@ -154,7 +154,7 @@ type RepoSampleRequest struct {
154154
//nolint:govet // fieldalignment: API struct field order optimized for readability
155155
type OrgSampleRequest struct {
156156
Org string `json:"org"`
157-
SampleSize int `json:"sample_size,omitempty"` // Default: 50
157+
SampleSize int `json:"sample_size,omitempty"` // Default: 100
158158
Days int `json:"days,omitempty"` // Default: 60
159159
Config *cost.Config `json:"config,omitempty"`
160160
}
@@ -1478,18 +1478,18 @@ func (s *Server) parseRepoSampleRequest(ctx context.Context, r *http.Request) (*
14781478

14791479
// Set defaults
14801480
if req.SampleSize == 0 {
1481-
req.SampleSize = 50
1481+
req.SampleSize = 100
14821482
}
14831483
if req.Days == 0 {
14841484
req.Days = 60
14851485
}
14861486

1487-
// Validate reasonable limits (silently cap at 50)
1487+
// Validate reasonable limits (silently cap at 100)
14881488
if req.SampleSize < 1 {
14891489
return nil, errors.New("sample_size must be at least 1")
14901490
}
1491-
if req.SampleSize > 50 {
1492-
req.SampleSize = 50
1491+
if req.SampleSize > 100 {
1492+
req.SampleSize = 100
14931493
}
14941494
if req.Days < 1 || req.Days > 365 {
14951495
return nil, errors.New("days must be between 1 and 365")
@@ -1536,18 +1536,18 @@ func (s *Server) parseOrgSampleRequest(ctx context.Context, r *http.Request) (*O
15361536

15371537
// Set defaults
15381538
if req.SampleSize == 0 {
1539-
req.SampleSize = 50
1539+
req.SampleSize = 100
15401540
}
15411541
if req.Days == 0 {
15421542
req.Days = 60
15431543
}
15441544

1545-
// Validate reasonable limits (silently cap at 50)
1545+
// Validate reasonable limits (silently cap at 100)
15461546
if req.SampleSize < 1 {
15471547
return nil, errors.New("sample_size must be at least 1")
15481548
}
1549-
if req.SampleSize > 50 {
1550-
req.SampleSize = 50
1549+
if req.SampleSize > 100 {
1550+
req.SampleSize = 100
15511551
}
15521552
if req.Days < 1 || req.Days > 365 {
15531553
return nil, errors.New("days must be between 1 and 365")

internal/server/server_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,7 @@ func TestParseRepoSampleRequest(t *testing.T) {
14841484
wantOwner: "testowner",
14851485
wantRepo: "testrepo",
14861486
wantDays: 60,
1487-
wantSampleSize: 50,
1487+
wantSampleSize: 100,
14881488
},
14891489
{
14901490
name: "missing owner",
@@ -1571,7 +1571,7 @@ func TestParseOrgSampleRequest(t *testing.T) {
15711571
wantErr: false,
15721572
wantOrg: "testorg",
15731573
wantDays: 60,
1574-
wantSampleSize: 50,
1574+
wantSampleSize: 100,
15751575
},
15761576
{
15771577
name: "missing org",

0 commit comments

Comments
 (0)