Files
summercms/tide/report.go
Jakub Zych 24c1f43e84 feat(02-02): record manifest route cases and report coverage
Drive ordered route cases through RecordFlow, resume in batches of
15, and print recorded/passing/failing/unrecorded coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 12:36:48 +02:00

54 lines
1.3 KiB
Go

package tide
import (
"fmt"
"strconv"
)
// Coverage is the recorded/passing/failing/unrecorded table over manifest routes.
type Coverage struct {
Total int
Recorded int
Passing int
Failing int
Unrecorded int
Pending int
Ported int
ResumeRemaining int
Rows []CoverageRow
Diffs []string
}
// CoverageRow is one manifest route's outcome.
type CoverageRow struct {
ID string
Status string
Outcome string
}
// CoverageHeaders is the table header for CLI output.
func CoverageHeaders() []string {
return []string{"route", "status", "outcome"}
}
// CoverageRows renders the coverage table.
func (c Coverage) CoverageRows() [][]string {
rows := make([][]string, 0, len(c.Rows))
for _, r := range c.Rows {
rows = append(rows, []string{r.ID, r.Status, r.Outcome})
}
return rows
}
// SummaryLine is a one-line recorded/passing/failing/unrecorded report.
func (c Coverage) SummaryLine() string {
return fmt.Sprintf("recorded %d/%d passing %d failing %d unrecorded %d", c.Recorded, c.Total, c.Passing, c.Failing, c.Unrecorded)
}
func (c Coverage) ResumeLine() string {
if c.ResumeRemaining <= 0 {
return "manifest recording complete"
}
return "resume remaining " + strconv.Itoa(c.ResumeRemaining)
}