Remove stats from .runtime/*.json observable state (gt-lfi2d)

Remove Stats fields from witness and refinery types that tracked
observable metrics (total counts, today counts). These are now
handled by the activity stream/beads system instead.

Removed:
- WitnessStats type and Stats field from Witness
- RefineryStats type and Stats field from Refinery
- LastCheckAt field from Witness
- Stats display from gt witness status
- Stats display from gt refinery status
- Stats increment code from refinery.completeMR()

Kept minimal process state:
- RigName, State, PID, StartedAt (both)
- MonitoredPolecats, Config, SpawnedIssues (witness)
- CurrentMR, PendingMRs, LastMergeAt (refinery)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-30 02:00:44 -08:00
parent 04f0e46619
commit 8e96e12e37
5 changed files with 1 additions and 71 deletions

View File

@@ -277,12 +277,6 @@ func runRefineryStatus(cmd *cobra.Command, args []string) error {
fmt.Printf(" Last merge: %s\n", ref.LastMergeAt.Format("2006-01-02 15:04:05"))
}
fmt.Printf("\n %s\n", style.Bold.Render("Statistics:"))
fmt.Printf(" Merged today: %d\n", ref.Stats.TodayMerged)
fmt.Printf(" Failed today: %d\n", ref.Stats.TodayFailed)
fmt.Printf(" Total merged: %d\n", ref.Stats.TotalMerged)
fmt.Printf(" Total failed: %d\n", ref.Stats.TotalFailed)
return nil
}

View File

@@ -259,10 +259,6 @@ func runWitnessStatus(cmd *cobra.Command, args []string) error {
fmt.Printf(" Started: %s\n", w.StartedAt.Format("2006-01-02 15:04:05"))
}
if w.LastCheckAt != nil {
fmt.Printf(" Last check: %s\n", w.LastCheckAt.Format("2006-01-02 15:04:05"))
}
// Show monitored polecats
fmt.Printf("\n %s\n", style.Bold.Render("Monitored Polecats:"))
if len(w.MonitoredPolecats) == 0 {
@@ -273,13 +269,6 @@ func runWitnessStatus(cmd *cobra.Command, args []string) error {
}
}
fmt.Printf("\n %s\n", style.Bold.Render("Statistics:"))
fmt.Printf(" Checks today: %d\n", w.Stats.TodayChecks)
fmt.Printf(" Nudges today: %d\n", w.Stats.TodayNudges)
fmt.Printf(" Total checks: %d\n", w.Stats.TotalChecks)
fmt.Printf(" Total nudges: %d\n", w.Stats.TotalNudges)
fmt.Printf(" Total escalations: %d\n", w.Stats.TotalEscalations)
return nil
}

View File

@@ -492,7 +492,7 @@ func (m *Manager) ProcessMR(mr *MergeRequest) MergeResult {
return result
}
// completeMR marks an MR as complete and updates stats.
// completeMR marks an MR as complete.
// For success, pass closeReason (e.g., CloseReasonMerged).
// For failures that should return to open, pass empty closeReason.
func (m *Manager) completeMR(mr *MergeRequest, closeReason CloseReason, errMsg string) {
@@ -512,16 +512,9 @@ func (m *Manager) completeMR(mr *MergeRequest, closeReason CloseReason, errMsg s
switch closeReason {
case CloseReasonMerged:
ref.LastMergeAt = &now
ref.Stats.TotalMerged++
ref.Stats.TodayMerged++
case CloseReasonSuperseded:
ref.Stats.TotalSkipped++
// Emit merge_skipped event
_ = events.LogFeed(events.TypeMergeSkipped, actor, events.MergePayload(mr.ID, mr.Worker, mr.Branch, "superseded"))
default:
// Other close reasons (rejected, conflict) count as failed
ref.Stats.TotalFailed++
ref.Stats.TodayFailed++
}
} else {
// Reopen the MR for rework (in_progress → open)
@@ -529,8 +522,6 @@ func (m *Manager) completeMR(mr *MergeRequest, closeReason CloseReason, errMsg s
// Log error but continue
fmt.Fprintf(m.output, "Warning: failed to reopen MR: %v\n", err)
}
ref.Stats.TotalFailed++
ref.Stats.TodayFailed++
}
_ = m.saveState(ref) // non-fatal: state file update

View File

@@ -44,9 +44,6 @@ type Refinery struct {
// LastMergeAt is when the last successful merge happened.
LastMergeAt *time.Time `json:"last_merge_at,omitempty"`
// Stats contains cumulative statistics.
Stats RefineryStats `json:"stats"`
}
// MergeRequest represents a branch waiting to be merged.
@@ -150,24 +147,6 @@ func DefaultMergeConfig() MergeConfig {
}
}
// RefineryStats contains cumulative refinery statistics.
type RefineryStats struct {
// TotalMerged is the total number of successful merges.
TotalMerged int `json:"total_merged"`
// TotalFailed is the total number of failed merges.
TotalFailed int `json:"total_failed"`
// TotalSkipped is the total number of skipped MRs.
TotalSkipped int `json:"total_skipped"`
// TodayMerged is the number of merges today.
TodayMerged int `json:"today_merged"`
// TodayFailed is the number of failures today.
TodayFailed int `json:"today_failed"`
}
// QueueItem represents an item in the merge queue for display.
type QueueItem struct {
Position int `json:"position"`

View File

@@ -36,12 +36,6 @@ type Witness struct {
// MonitoredPolecats tracks polecats being monitored.
MonitoredPolecats []string `json:"monitored_polecats,omitempty"`
// LastCheckAt is when the last health check was performed.
LastCheckAt *time.Time `json:"last_check_at,omitempty"`
// Stats contains cumulative statistics.
Stats WitnessStats `json:"stats"`
// Config contains auto-spawn configuration.
Config WitnessConfig `json:"config"`
@@ -67,21 +61,4 @@ type WitnessConfig struct {
IssuePrefix string `json:"issue_prefix,omitempty"`
}
// WitnessStats contains cumulative witness statistics.
type WitnessStats struct {
// TotalChecks is the total number of health checks performed.
TotalChecks int `json:"total_checks"`
// TotalNudges is the total number of nudges sent to polecats.
TotalNudges int `json:"total_nudges"`
// TotalEscalations is the total number of escalations to mayor.
TotalEscalations int `json:"total_escalations"`
// TodayChecks is the number of checks today.
TodayChecks int `json:"today_checks"`
// TodayNudges is the number of nudges today.
TodayNudges int `json:"today_nudges"`
}