Skip to content

Commit 9f711a2

Browse files
authored
Merge pull request #18 from tstromberg/main
update sample size to 50, days to 90
2 parents 9fa3e15 + cfbe2f2 commit 9f711a2

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

cmd/prcost/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func main() {
3131
// Org/Repo sampling flags
3232
org := flag.String("org", "", "GitHub organization to analyze (optionally with --repo for single repo)")
3333
repo := flag.String("repo", "", "GitHub repository to analyze (requires --org)")
34-
samples := flag.Int("samples", 30, "Number of PRs to sample for extrapolation (30=fast/±18%, 50=slower/±14%)")
34+
samples := flag.Int("samples", 50, "Number of PRs to sample for extrapolation (30=fast/±18%, 50=slower/±14%)")
3535
days := flag.Int("days", 60, "Number of days to look back for PR modifications")
3636

3737
// Modeling flags

internal/server/integration_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ func TestOrgSampleStreamIntegration(t *testing.T) {
3333
// Create request
3434
reqBody := OrgSampleRequest{
3535
Org: "codeGROOVE-dev",
36-
SampleSize: 30,
37-
Days: 90,
36+
SampleSize: 50,
37+
Days: 60,
3838
}
3939
body, err := json.Marshal(reqBody)
4040
if err != nil {
@@ -195,8 +195,8 @@ 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: 30,
199-
Days: 90,
198+
SampleSize: 50,
199+
Days: 60,
200200
}
201201
body, err := json.Marshal(reqBody)
202202
if err != nil {

internal/server/server.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ 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: 30
148-
Days int `json:"days,omitempty"` // Default: 90
147+
SampleSize int `json:"sample_size,omitempty"` // Default: 50
148+
Days int `json:"days,omitempty"` // Default: 60
149149
Config *cost.Config `json:"config,omitempty"`
150150
}
151151

@@ -154,8 +154,8 @@ 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: 30
158-
Days int `json:"days,omitempty"` // Default: 90
157+
SampleSize int `json:"sample_size,omitempty"` // Default: 50
158+
Days int `json:"days,omitempty"` // Default: 60
159159
Config *cost.Config `json:"config,omitempty"`
160160
}
161161

@@ -1478,10 +1478,10 @@ func (s *Server) parseRepoSampleRequest(ctx context.Context, r *http.Request) (*
14781478

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

14871487
// Validate reasonable limits (silently cap at 50)
@@ -1536,10 +1536,10 @@ func (s *Server) parseOrgSampleRequest(ctx context.Context, r *http.Request) (*O
15361536

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

15451545
// Validate reasonable limits (silently cap at 50)

internal/server/server_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,8 +1483,8 @@ func TestParseRepoSampleRequest(t *testing.T) {
14831483
wantErr: false,
14841484
wantOwner: "testowner",
14851485
wantRepo: "testrepo",
1486-
wantDays: 90,
1487-
wantSampleSize: 30,
1486+
wantDays: 60,
1487+
wantSampleSize: 50,
14881488
},
14891489
{
14901490
name: "missing owner",
@@ -1570,8 +1570,8 @@ func TestParseOrgSampleRequest(t *testing.T) {
15701570
body: `{"org":"testorg"}`,
15711571
wantErr: false,
15721572
wantOrg: "testorg",
1573-
wantDays: 90,
1574-
wantSampleSize: 30,
1573+
wantDays: 60,
1574+
wantSampleSize: 50,
15751575
},
15761576
{
15771577
name: "missing org",

internal/server/static/index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,11 +1059,11 @@ <h1><a href="/">PR Cost Calculator</a></h1>
10591059
<input
10601060
type="number"
10611061
id="repoSampleSize"
1062-
value="30"
1062+
value="50"
10631063
min="1"
10641064
max="50"
10651065
>
1066-
<div class="help-text">30 (fast, ±18% accuracy) or 50 (slower, ±14% accuracy)</div>
1066+
<div class="help-text">50 (recommended, ±14% accuracy) or 30 (faster, ±18% accuracy)</div>
10671067
</div>
10681068
<div class="form-group">
10691069
<label for="repoDays">Days Back</label>
@@ -1099,11 +1099,11 @@ <h1><a href="/">PR Cost Calculator</a></h1>
10991099
<input
11001100
type="number"
11011101
id="orgSampleSize"
1102-
value="30"
1102+
value="50"
11031103
min="1"
11041104
max="50"
11051105
>
1106-
<div class="help-text">30 (fast, ±18% accuracy) or 50 (slower, ±14% accuracy)</div>
1106+
<div class="help-text">50 (recommended, ±14% accuracy) or 30 (faster, ±18% accuracy)</div>
11071107
</div>
11081108
<div class="form-group">
11091109
<label for="orgDays">Days Back</label>
@@ -2276,7 +2276,6 @@ <h3>Why calculate PR costs?</h3>
22762276
}
22772277

22782278
// Calculate average PR efficiency
2279-
const totalPRs = e.total_prs;
22802279
const avgCodeChurnCost = e.code_churn_cost / totalPRs;
22812280
const avgDeliveryDelayCost = e.delivery_delay_cost / totalPRs;
22822281
const avgCodeChurnHours = e.code_churn_hours / totalPRs;

0 commit comments

Comments
 (0)