You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The shared WasteFinding model and per-session quality outcome inference. Both are leaf modules — every hotspot detector and the patterns module emit WasteFindings through this surface, and compare / hotspots consume QualityResult to gate severity. They land together so the downstream detector PRs (#TODO ghost-surface, #TODO tool-call-patterns, #TODO patterns) can depend on a settled finding type.
Scope
findings.rs (port of findings.ts, ~313 LoC)
Port WasteSeverity (info | warn | high), WasteAction (string-literal union — model as a string-newtype or a closed enum; either works, but emit identical strings at serialization), EstimatedSavings, WasteFinding.
Port the *ToFinding adapters: retryLoopToFinding, failureRunToFinding, cancellationRunToFinding, compactionLossToFinding, editRevertToFinding, editHeavyToFinding, skillRecallDupToFinding, skillPruningProtectionToFinding, systemPromptTaxToFinding.
Port findingsFromPatterns(result) and sortFindings(findings).
The pattern types referenced (RetryLoop, FailureRun, etc.) live in patterns.ts (separate sub-issue). To avoid a circular-dep blocker, define those concrete struct types in findings.rs (or a shared patterns_types module) and have the patterns sub-issue depend on this one. Either layout is acceptable as long as findings doesn't depend on patterns (which is the larger, later module).
quality.rs (port of quality.ts, ~291 LoC)
Port OutcomeLabel (completed | abandoned | errored | unknown), OutcomeConfidence (high | medium | low), SessionOutcome, OneShotMetrics, QualityResult, ComputeQualityOptions.
Port inferOutcome(), computeOneShotRate(), computeQuality().
Parent: #244
Depends on: #242, #266 (analyze foundation)
Context
The shared
WasteFindingmodel and per-session quality outcome inference. Both are leaf modules — every hotspot detector and the patterns module emitWasteFindings through this surface, andcompare/hotspotsconsumeQualityResultto gate severity. They land together so the downstream detector PRs (#TODO ghost-surface, #TODO tool-call-patterns, #TODO patterns) can depend on a settled finding type.Scope
findings.rs(port offindings.ts, ~313 LoC)WasteSeverity(info | warn | high),WasteAction(string-literal union — model as a string-newtype or a closed enum; either works, but emit identical strings at serialization),EstimatedSavings,WasteFinding.*ToFindingadapters:retryLoopToFinding,failureRunToFinding,cancellationRunToFinding,compactionLossToFinding,editRevertToFinding,editHeavyToFinding,skillRecallDupToFinding,skillPruningProtectionToFinding,systemPromptTaxToFinding.findingsFromPatterns(result)andsortFindings(findings).RetryLoop,FailureRun, etc.) live inpatterns.ts(separate sub-issue). To avoid a circular-dep blocker, define those concrete struct types infindings.rs(or a sharedpatterns_typesmodule) and have the patterns sub-issue depend on this one. Either layout is acceptable as long asfindingsdoesn't depend onpatterns(which is the larger, later module).quality.rs(port ofquality.ts, ~291 LoC)OutcomeLabel(completed | abandoned | errored | unknown),OutcomeConfidence(high | medium | low),SessionOutcome,OneShotMetrics,QualityResult,ComputeQualityOptions.inferOutcome(),computeOneShotRate(),computeQuality().Conformance gate
packages/analyze/src/findings.test.ts(322 lines)packages/analyze/src/quality.test.ts(259 lines)Equivalent Rust tests; severity/action labels and outcome labels emit byte-identical strings.
Acceptance
cargo test -p relayburn-analyzegreen for findings + quality.WasteFinding,WasteSeverity,WasteAction,EstimatedSavings, all*ToFindingadapters,findingsFromPatterns,sortFindings,OutcomeLabel,OutcomeConfidence,SessionOutcome,OneShotMetrics,QualityResult,ComputeQualityOptions,inferOutcome,computeOneShotRate,computeQuality.sortFindingsordering matches TS — by (severity desc, savings desc, kind, sessionId, ts) tuple. Include a fixture-driven test.patternssub-issue can import without a circular dep.Files
packages/analyze/src/findings.ts+findings.test.tspackages/analyze/src/quality.ts+quality.test.ts