From 24e1b00d604f347f23732126c137d73867623430 Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Wed, 29 Oct 2025 22:30:06 -0400 Subject: [PATCH 1/3] remove dupe totalPRs const --- internal/server/static/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/server/static/index.html b/internal/server/static/index.html index fc7095f..6045815 100644 --- a/internal/server/static/index.html +++ b/internal/server/static/index.html @@ -2276,7 +2276,6 @@

Why calculate PR costs?

} // Calculate average PR efficiency - const totalPRs = e.total_prs; const avgCodeChurnCost = e.code_churn_cost / totalPRs; const avgDeliveryDelayCost = e.delivery_delay_cost / totalPRs; const avgCodeChurnHours = e.code_churn_hours / totalPRs; From 5da6486c4945cc812e1b49a8cf085800a1aebf36 Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Wed, 29 Oct 2025 22:45:16 -0400 Subject: [PATCH 2/3] update sample size to 50, days to 90 --- cmd/prcost/main.go | 2 +- internal/server/integration_test.go | 8 ++++---- internal/server/server.go | 16 ++++++++-------- internal/server/server_test.go | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/prcost/main.go b/cmd/prcost/main.go index 6c6bcef..7304b25 100644 --- a/cmd/prcost/main.go +++ b/cmd/prcost/main.go @@ -31,7 +31,7 @@ func main() { // Org/Repo sampling flags org := flag.String("org", "", "GitHub organization to analyze (optionally with --repo for single repo)") repo := flag.String("repo", "", "GitHub repository to analyze (requires --org)") - samples := flag.Int("samples", 30, "Number of PRs to sample for extrapolation (30=fast/±18%, 50=slower/±14%)") + samples := flag.Int("samples", 50, "Number of PRs to sample for extrapolation (30=fast/±18%, 50=slower/±14%)") days := flag.Int("days", 60, "Number of days to look back for PR modifications") // Modeling flags diff --git a/internal/server/integration_test.go b/internal/server/integration_test.go index 775f863..ffe43d3 100644 --- a/internal/server/integration_test.go +++ b/internal/server/integration_test.go @@ -33,8 +33,8 @@ func TestOrgSampleStreamIntegration(t *testing.T) { // Create request reqBody := OrgSampleRequest{ Org: "codeGROOVE-dev", - SampleSize: 30, - Days: 90, + SampleSize: 50, + Days: 60, } body, err := json.Marshal(reqBody) if err != nil { @@ -195,8 +195,8 @@ func TestOrgSampleStreamNoTimeout(t *testing.T) { // Create request with larger sample size to ensure longer operation reqBody := OrgSampleRequest{ Org: "codeGROOVE-dev", - SampleSize: 30, - Days: 90, + SampleSize: 50, + Days: 60, } body, err := json.Marshal(reqBody) if err != nil { diff --git a/internal/server/server.go b/internal/server/server.go index a06c2b5..1ba2431 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -144,8 +144,8 @@ type CalculateResponse struct { type RepoSampleRequest struct { Owner string `json:"owner"` Repo string `json:"repo"` - SampleSize int `json:"sample_size,omitempty"` // Default: 30 - Days int `json:"days,omitempty"` // Default: 90 + SampleSize int `json:"sample_size,omitempty"` // Default: 50 + Days int `json:"days,omitempty"` // Default: 60 Config *cost.Config `json:"config,omitempty"` } @@ -154,8 +154,8 @@ type RepoSampleRequest struct { //nolint:govet // fieldalignment: API struct field order optimized for readability type OrgSampleRequest struct { Org string `json:"org"` - SampleSize int `json:"sample_size,omitempty"` // Default: 30 - Days int `json:"days,omitempty"` // Default: 90 + SampleSize int `json:"sample_size,omitempty"` // Default: 50 + Days int `json:"days,omitempty"` // Default: 60 Config *cost.Config `json:"config,omitempty"` } @@ -1478,10 +1478,10 @@ func (s *Server) parseRepoSampleRequest(ctx context.Context, r *http.Request) (* // Set defaults if req.SampleSize == 0 { - req.SampleSize = 30 + req.SampleSize = 50 } if req.Days == 0 { - req.Days = 90 + req.Days = 60 } // Validate reasonable limits (silently cap at 50) @@ -1536,10 +1536,10 @@ func (s *Server) parseOrgSampleRequest(ctx context.Context, r *http.Request) (*O // Set defaults if req.SampleSize == 0 { - req.SampleSize = 30 + req.SampleSize = 50 } if req.Days == 0 { - req.Days = 90 + req.Days = 60 } // Validate reasonable limits (silently cap at 50) diff --git a/internal/server/server_test.go b/internal/server/server_test.go index dc47b60..39fe200 100644 --- a/internal/server/server_test.go +++ b/internal/server/server_test.go @@ -1483,8 +1483,8 @@ func TestParseRepoSampleRequest(t *testing.T) { wantErr: false, wantOwner: "testowner", wantRepo: "testrepo", - wantDays: 90, - wantSampleSize: 30, + wantDays: 60, + wantSampleSize: 50, }, { name: "missing owner", @@ -1570,8 +1570,8 @@ func TestParseOrgSampleRequest(t *testing.T) { body: `{"org":"testorg"}`, wantErr: false, wantOrg: "testorg", - wantDays: 90, - wantSampleSize: 30, + wantDays: 60, + wantSampleSize: 50, }, { name: "missing org", From cfbe2f246d13a6a1c8451e9dd8d32f31241bdb1a Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Wed, 29 Oct 2025 22:47:56 -0400 Subject: [PATCH 3/3] update sample size to 50 --- internal/server/static/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/server/static/index.html b/internal/server/static/index.html index 6045815..7c6dacd 100644 --- a/internal/server/static/index.html +++ b/internal/server/static/index.html @@ -1059,11 +1059,11 @@

PR Cost Calculator

-
30 (fast, ±18% accuracy) or 50 (slower, ±14% accuracy)
+
50 (recommended, ±14% accuracy) or 30 (faster, ±18% accuracy)
@@ -1099,11 +1099,11 @@

PR Cost Calculator

-
30 (fast, ±18% accuracy) or 50 (slower, ±14% accuracy)
+
50 (recommended, ±14% accuracy) or 30 (faster, ±18% accuracy)