Skip to content

Commit b0d0bb6

Browse files
chore: remove dead functions — 5 functions removed
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 867cc5e commit b0d0bb6

7 files changed

Lines changed: 1 addition & 220 deletions

File tree

pkg/cli/mcp_helpers.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package cli
77
import (
88
"fmt"
99
"os"
10-
"os/exec"
1110
"path/filepath"
1211
"strings"
1312

@@ -85,11 +84,3 @@ func withNonInteractiveCIEnv(env []string) []string {
8584

8685
return append(env, "CI=1")
8786
}
88-
89-
func setNonInteractiveCIEnv(cmd *exec.Cmd) {
90-
if cmd == nil {
91-
return
92-
}
93-
94-
cmd.Env = withNonInteractiveCIEnv(cmd.Env)
95-
}

pkg/cli/mcp_validation_test.go

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package cli
44

55
import (
66
"os"
7-
"os/exec"
87
"path/filepath"
98
"testing"
109

@@ -61,7 +60,7 @@ func TestGetBinaryPath(t *testing.T) {
6160
})
6261
}
6362

64-
func TestSetNonInteractiveCIEnv(t *testing.T) {
63+
func TestWithNonInteractiveCIEnv(t *testing.T) {
6564
t.Run("returns copied env with CI forced on", func(t *testing.T) {
6665
input := []string{"CI=false", "HOME=/tmp/test-home"}
6766

@@ -72,25 +71,4 @@ func TestSetNonInteractiveCIEnv(t *testing.T) {
7271
assert.NotContains(t, output, "CI=false")
7372
assert.Contains(t, output, "HOME=/tmp/test-home")
7473
})
75-
76-
t.Run("adds CI when missing", func(t *testing.T) {
77-
cmd := exec.Command("echo")
78-
cmd.Env = []string{"HOME=/tmp/test-home"}
79-
80-
setNonInteractiveCIEnv(cmd)
81-
82-
assert.Contains(t, cmd.Env, "CI=1")
83-
assert.Contains(t, cmd.Env, "HOME=/tmp/test-home")
84-
})
85-
86-
t.Run("overrides existing CI value", func(t *testing.T) {
87-
cmd := exec.Command("echo")
88-
cmd.Env = []string{"CI=false", "HOME=/tmp/test-home"}
89-
90-
setNonInteractiveCIEnv(cmd)
91-
92-
assert.Contains(t, cmd.Env, "CI=1")
93-
assert.NotContains(t, cmd.Env, "CI=false")
94-
assert.Contains(t, cmd.Env, "HOME=/tmp/test-home")
95-
})
9674
}

pkg/cli/outcome_domain_breakdown.go

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package cli
22

33
import (
44
"cmp"
5-
"fmt"
65
"slices"
76
"strings"
87

@@ -111,70 +110,3 @@ func countTotalAttempted(breakdowns []DomainBreakdown) int {
111110
}
112111
return total
113112
}
114-
115-
// DomainInsight provides a human-readable assessment of a domain's performance.
116-
type DomainInsight struct {
117-
Label string
118-
Status string // "excellent", "good", "fair", "poor", "new"
119-
Efficiency float64
120-
Message string
121-
Suggestion string
122-
}
123-
124-
// AnalyzeDomainPerformance provides strategic insights about domain efficiency.
125-
func AnalyzeDomainPerformance(breakdown DomainBreakdown) DomainInsight {
126-
insight := DomainInsight{
127-
Label: breakdown.Label,
128-
Efficiency: breakdown.ObjectiveEfficiency,
129-
}
130-
131-
if breakdown.Attempted == 0 {
132-
insight.Status = "new"
133-
insight.Message = "No outcomes yet"
134-
return insight
135-
}
136-
137-
switch {
138-
case breakdown.ObjectiveEfficiency >= 0.90:
139-
insight.Status = "excellent"
140-
insight.Message = fmt.Sprintf("✅ %s: %.0f%% efficiency | %d/%d outcomes accepted | %d value delivered",
141-
breakdown.Label,
142-
breakdown.ObjectiveEfficiency*100,
143-
breakdown.Accepted,
144-
breakdown.Attempted,
145-
breakdown.AcceptedObjectiveValue)
146-
insight.Suggestion = "Keep current strategy working well"
147-
148-
case breakdown.ObjectiveEfficiency >= 0.75:
149-
insight.Status = "good"
150-
insight.Message = fmt.Sprintf("✅ %s: %.0f%% efficiency | %d/%d outcomes accepted | %d value delivered",
151-
breakdown.Label,
152-
breakdown.ObjectiveEfficiency*100,
153-
breakdown.Accepted,
154-
breakdown.Attempted,
155-
breakdown.AcceptedObjectiveValue)
156-
insight.Suggestion = "Good progress; monitor for regressions"
157-
158-
case breakdown.ObjectiveEfficiency >= 0.50:
159-
insight.Status = "fair"
160-
insight.Message = fmt.Sprintf("⚠️ %s: %.0f%% efficiency | %d/%d outcomes accepted | %d value delivered",
161-
breakdown.Label,
162-
breakdown.ObjectiveEfficiency*100,
163-
breakdown.Accepted,
164-
breakdown.Attempted,
165-
breakdown.AcceptedObjectiveValue)
166-
insight.Suggestion = "Consider reviewing agent strategy or adding human review"
167-
168-
default:
169-
insight.Status = "poor"
170-
insight.Message = fmt.Sprintf("🔴 %s: %.0f%% efficiency | %d/%d outcomes accepted | %d value delivered",
171-
breakdown.Label,
172-
breakdown.ObjectiveEfficiency*100,
173-
breakdown.Accepted,
174-
breakdown.Attempted,
175-
breakdown.AcceptedObjectiveValue)
176-
insight.Suggestion = "Major issues; investigate root cause or pause automation"
177-
}
178-
179-
return insight
180-
}

pkg/parser/import_bfs.go

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -380,55 +380,6 @@ func enqueueNestedImports(frontmatter map[string]any, item importQueueItem, base
380380
return nil
381381
}
382382

383-
func parseNestedImportEntries(frontmatter map[string]any) []nestedImportEntry {
384-
importsField, hasImports := frontmatter["imports"]
385-
if !hasImports {
386-
return nil
387-
}
388-
switch v := importsField.(type) {
389-
case []any:
390-
nestedImports := make([]nestedImportEntry, 0, len(v))
391-
for _, item := range v {
392-
entry, ok := parseNestedImportEntry(item)
393-
if !ok {
394-
continue
395-
}
396-
nestedImports = append(nestedImports, entry)
397-
}
398-
return nestedImports
399-
case []string:
400-
return nestedEntriesFromSpecs(importSpecsFromStringSlice(v))
401-
default:
402-
return nil
403-
}
404-
}
405-
406-
func parseNestedImportEntry(item any) (nestedImportEntry, bool) {
407-
switch nestedItem := item.(type) {
408-
case string:
409-
return nestedImportEntry{path: nestedItem}, true
410-
case map[string]any:
411-
var nestedPath string
412-
if usesPath, ok := nestedItem["uses"].(string); ok {
413-
nestedPath = usesPath
414-
} else if pathVal, ok := nestedItem["path"].(string); ok {
415-
nestedPath = pathVal
416-
}
417-
if nestedPath == "" {
418-
return nestedImportEntry{}, false
419-
}
420-
var nestedInputs map[string]any
421-
if withVal, ok := nestedItem["with"].(map[string]any); ok {
422-
nestedInputs = withVal
423-
} else if inputsVal, ok := nestedItem["inputs"].(map[string]any); ok {
424-
nestedInputs = inputsVal
425-
}
426-
return nestedImportEntry{path: nestedPath, inputs: nestedInputs}, true
427-
default:
428-
return nestedImportEntry{}, false
429-
}
430-
}
431-
432383
func nestedEntriesFromSpecs(specs []ImportSpec) []nestedImportEntry {
433384
nestedImports := make([]nestedImportEntry, 0, len(specs))
434385
for _, spec := range specs {

pkg/parser/import_bfs_test.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,6 @@ import (
99
"github.com/stretchr/testify/require"
1010
)
1111

12-
func TestParseNestedImportEntries_LenientArrayParsing(t *testing.T) {
13-
frontmatter := map[string]any{
14-
"imports": []any{
15-
"valid-a.md",
16-
map[string]any{"path": "valid-b.md", "inputs": map[string]any{"env": "prod"}},
17-
map[string]any{"path": 123},
18-
map[string]any{"inputs": map[string]any{"env": "ignored"}},
19-
42,
20-
},
21-
}
22-
23-
entries := parseNestedImportEntries(frontmatter)
24-
require.Len(t, entries, 2)
25-
require.Equal(t, "valid-a.md", entries[0].path)
26-
require.Nil(t, entries[0].inputs)
27-
require.Equal(t, "valid-b.md", entries[1].path)
28-
require.Equal(t, map[string]any{"env": "prod"}, entries[1].inputs)
29-
}
30-
3112
func TestParseImportSpecsFromArray_RejectsIfField(t *testing.T) {
3213
_, err := parseImportSpecsFromArray([]any{
3314
map[string]any{

pkg/workflow/compilerenv/manager.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,6 @@ const (
4646
DefaultModelCodex = "GH_AW_DEFAULT_MODEL_CODEX"
4747
)
4848

49-
// ResolveDefaultMaxDailyAICredits returns the resolved daily AI Credits guardrail
50-
// default, checking the enterprise env var GH_AW_DEFAULT_MAX_DAILY_AI_CREDITS.
51-
// Falls back to fallback (built-in default) when the env var is unset or invalid.
52-
//
53-
// A value of -1 is preserved to allow explicitly disabling the guardrail.
54-
func ResolveDefaultMaxDailyAICredits(fallback string) string {
55-
if raw := strings.TrimSpace(os.Getenv(DefaultMaxDailyAICredits)); raw != "" {
56-
if raw == "-1" {
57-
managerLog.Printf("Applying enterprise override %s=%q (fallback was %q)", DefaultMaxDailyAICredits, raw, fallback)
58-
return "-1"
59-
}
60-
if normalized, ok := typeutil.NormalizeInt64KMSuffix(raw); ok {
61-
managerLog.Printf("Applying enterprise override %s=%q (fallback was %q)", DefaultMaxDailyAICredits, normalized, fallback)
62-
return normalized
63-
}
64-
managerLog.Printf("Invalid %s=%q, using fallback=%q", DefaultMaxDailyAICredits, raw, fallback)
65-
}
66-
return fallback
67-
}
68-
6949
// ResolveDefaultMaxAICredits returns the resolved max AI credits default, checking
7050
// the enterprise env var GH_AW_DEFAULT_MAX_AI_CREDITS.
7151
// Falls back to fallback (built-in default) when the env var is unset or invalid.

pkg/workflow/compilerenv/manager_test.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,6 @@ import (
66
"github.com/stretchr/testify/assert"
77
)
88

9-
func TestResolveDefaultMaxDailyAICredits(t *testing.T) {
10-
t.Run("unset uses fallback", func(t *testing.T) {
11-
t.Setenv(DefaultMaxDailyAICredits, "")
12-
assert.Equal(t, "5000", ResolveDefaultMaxDailyAICredits("5000"))
13-
})
14-
15-
t.Run("invalid uses fallback", func(t *testing.T) {
16-
t.Setenv(DefaultMaxDailyAICredits, "abc")
17-
assert.Equal(t, "5000", ResolveDefaultMaxDailyAICredits("5000"))
18-
})
19-
20-
t.Run("zero uses fallback", func(t *testing.T) {
21-
t.Setenv(DefaultMaxDailyAICredits, "0")
22-
assert.Equal(t, "5000", ResolveDefaultMaxDailyAICredits("5000"))
23-
})
24-
25-
t.Run("valid value overrides fallback", func(t *testing.T) {
26-
t.Setenv(DefaultMaxDailyAICredits, "1000000")
27-
assert.Equal(t, "1000000", ResolveDefaultMaxDailyAICredits("5000"))
28-
})
29-
30-
t.Run("suffix value overrides fallback", func(t *testing.T) {
31-
t.Setenv(DefaultMaxDailyAICredits, "2M")
32-
assert.Equal(t, "2000000", ResolveDefaultMaxDailyAICredits("5000"))
33-
})
34-
35-
t.Run("disables guardrail with -1", func(t *testing.T) {
36-
t.Setenv(DefaultMaxDailyAICredits, "-1")
37-
assert.Equal(t, "-1", ResolveDefaultMaxDailyAICredits("5000"))
38-
})
39-
}
40-
419
func TestResolveDefaultMaxAICredits(t *testing.T) {
4210
t.Run("unset uses fallback", func(t *testing.T) {
4311
t.Setenv(DefaultMaxAICredits, "")

0 commit comments

Comments
 (0)