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/prcost/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions internal/server/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand All @@ -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"`
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions internal/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 4 additions & 5 deletions internal/server/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,11 @@ <h1><a href="/">PR Cost Calculator</a></h1>
<input
type="number"
id="repoSampleSize"
value="30"
value="50"
min="1"
max="50"
>
<div class="help-text">30 (fast, ±18% accuracy) or 50 (slower, ±14% accuracy)</div>
<div class="help-text">50 (recommended, ±14% accuracy) or 30 (faster, ±18% accuracy)</div>
</div>
<div class="form-group">
<label for="repoDays">Days Back</label>
Expand Down Expand Up @@ -1099,11 +1099,11 @@ <h1><a href="/">PR Cost Calculator</a></h1>
<input
type="number"
id="orgSampleSize"
value="30"
value="50"
min="1"
max="50"
>
<div class="help-text">30 (fast, ±18% accuracy) or 50 (slower, ±14% accuracy)</div>
<div class="help-text">50 (recommended, ±14% accuracy) or 30 (faster, ±18% accuracy)</div>
</div>
<div class="form-group">
<label for="orgDays">Days Back</label>
Expand Down Expand Up @@ -2276,7 +2276,6 @@ <h3>Why calculate PR costs?</h3>
}

// 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;
Expand Down
Loading