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 cli/cmd/ao/cron_self_adjust.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func countCronHistoryRows(path string) int {
if err != nil {
return 0
}
defer f.Close()
defer func() { _ = f.Close() }()
scanner := bufio.NewScanner(f)
scanner.Buffer(make([]byte, 0, 64*1024), 1024*1024)
n := 0
Expand Down
8 changes: 4 additions & 4 deletions cli/cmd/ao/loop_blocked.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func appendBlockedEvent(path string, event BlockedEvent) error {
if err != nil {
return fmt.Errorf("open blocked log %s: %w", path, err)
}
defer f.Close()
defer func() { _ = f.Close() }()
data, err := json.Marshal(event)
if err != nil {
return fmt.Errorf("marshal blocked event: %w", err)
Expand All @@ -256,7 +256,7 @@ func readBlockedEvents(path string) ([]BlockedEvent, error) {
}
return nil, fmt.Errorf("open blocked log %s: %w", path, err)
}
defer f.Close()
defer func() { _ = f.Close() }()
scanner := bufio.NewScanner(f)
scanner.Buffer(make([]byte, 0, 64*1024), 1024*1024)
var events []BlockedEvent
Expand Down Expand Up @@ -292,12 +292,12 @@ func rewriteBlockedEvents(path string, events []BlockedEvent) error {
for _, ev := range events {
data, err := json.Marshal(ev)
if err != nil {
f.Close()
_ = f.Close()
_ = os.Remove(tmp)
return fmt.Errorf("marshal blocked event: %w", err)
}
if _, err := f.Write(append(data, '\n')); err != nil {
f.Close()
_ = f.Close()
_ = os.Remove(tmp)
return fmt.Errorf("write tmp: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/ao/loop_next_work.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func appendNextWorkDecision(cwd string, rec ladder.Recommendation, now time.Time
if err != nil {
return fmt.Errorf("open %s: %w", path, err)
}
defer f.Close()
defer func() { _ = f.Close() }()
data, err := json.Marshal(row)
if err != nil {
return fmt.Errorf("marshal log row: %w", err)
Expand Down
1 change: 0 additions & 1 deletion cli/cmd/ao/provenance_trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func loadExpected(t *testing.T) expectedOrphanFixtures {
func TestProvenanceTrace_StrictCatchesEachSeededOrphan(t *testing.T) {
exp := loadExpected(t)
for _, fx := range exp.Fixtures {
fx := fx
t.Run(fx.File, func(t *testing.T) {
resetProvTraceFlags()
provTraceStrict = true
Expand Down
19 changes: 2 additions & 17 deletions cli/cmd/ao/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,16 +632,7 @@ func parseReconcileGHRuns(raw []byte) ([]reconcileCIRun, error) {
}
runs := make([]reconcileCIRun, 0, len(ghRuns))
for _, run := range ghRuns {
runs = append(runs, reconcileCIRun{
DatabaseID: run.DatabaseID,
WorkflowName: run.WorkflowName,
Status: run.Status,
Conclusion: run.Conclusion,
HeadSHA: run.HeadSHA,
DisplayTitle: run.DisplayTitle,
URL: run.URL,
CreatedAt: run.CreatedAt,
})
runs = append(runs, reconcileCIRun(run))
}
return runs, nil
}
Expand Down Expand Up @@ -769,13 +760,7 @@ func isReleaseLike(title, releaseTag string) bool {
}

func summarizeBead(issue bdIssueForReconcile) reconcileBeadSummary {
return reconcileBeadSummary{
ID: issue.ID,
Title: issue.Title,
Status: issue.Status,
Priority: issue.Priority,
Parent: issue.Parent,
}
return reconcileBeadSummary(issue)
}

func firstBeadEvidence(beads []reconcileBeadSummary) string {
Expand Down
4 changes: 2 additions & 2 deletions cli/internal/canon/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (l *ledger[T]) append(record T) error {
if err != nil {
return fmt.Errorf("open ledger: %w", err)
}
defer f.Close()
defer func() { _ = f.Close() }()
if _, err := f.Write(append(data, '\n')); err != nil {
return fmt.Errorf("write record: %w", err)
}
Expand Down Expand Up @@ -67,7 +67,7 @@ func (l *ledger[T]) load() ([]T, error) {
if err != nil {
return nil, fmt.Errorf("open ledger: %w", err)
}
defer f.Close()
defer func() { _ = f.Close() }()

var out []T
scanner := bufio.NewScanner(f)
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/scenarios/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func checkStepOrder(name string, given, when, then int) error {
if then < 0 {
return fmt.Errorf("scenario %q: missing Then step", name)
}
if !(given < when && when < then) {
if given >= when || when >= then {
return fmt.Errorf("scenario %q: steps out of order (expected Given before When before Then)", name)
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions cli/internal/skills/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func Mermaid(entries []CatalogEntry) string {
var b strings.Builder
b.WriteString("graph LR\n")
for _, e := range sorted {
b.WriteString(fmt.Sprintf(" %s[%s]\n", mermaidID(e.Name), e.Name))
fmt.Fprintf(&b, " %s[%s]\n", mermaidID(e.Name), e.Name)
}
for _, e := range sorted {
deps := append([]string(nil), e.Consumes...)
Expand All @@ -150,7 +150,7 @@ func Mermaid(entries []CatalogEntry) string {
if !known[dep] {
continue
}
b.WriteString(fmt.Sprintf(" %s --> %s\n", mermaidID(e.Name), mermaidID(dep)))
fmt.Fprintf(&b, " %s --> %s\n", mermaidID(e.Name), mermaidID(dep))
}
}
return b.String()
Expand Down
Loading