Repository navigation
Description
Strength: Worth exploring · Dependencies: local-substitutable
Files: src/logs/run_metrics.rs, src/logs/metrics/trends.rs, src/logs/command_record.rs, src/session/recording.rs, tests/run_metrics.rs, tests/metrics.rs
Before
flowchart LR
C[Completion metrics] -.-> R[Command records]
W[Weekly trends] -.-> R
C -.-> E[Session evidence]
W -.-> E
classDef leak stroke:#dc2626,stroke-width:2px;
class C,W leak
After — opportunity to investigate
flowchart LR
C[Completion metrics] --> A[Run metrics Session attribution]
W[Weekly trends] --> A
A --> R[Command records]
A --> E[Session evidence]
classDef deep stroke-width:3px;
class A deep
Problem: Completion metrics and weekly trends independently associate Sessions with stages and evidence, spreading identity, first-stage ownership and setup knowledge across their implementations.
Evidence:
- Completion metrics zip recorded stages with metric stages and deduplicate Session signals by normalized Session identity; review findings instead deduplicate literal paths.
- Weekly trends independently reconnect metric stages to recorded stages by index, deduplicate normalized Session identities, read exact-Command Model evidence, and track Security review/Resume setup fallback.
Solution: Investigate a deep Run metrics module whose interface owns Session-to-stage attribution and evidence selection at one seam, retaining completion and weekly trends as distinct projections.
Wins
- Locality: one attribution policy
- Leverage: completion and weekly trends
- Tests cross one shared interface
Why not Strong: Some rules serve different projections; the deletion test has not established that consolidation would concentrate meaningful complexity rather than move it into another shallow module.
Investigation: Prototype the attribution seam against shared Session references, former/current filename aliases, repeated Repairs, missing evidence and Security review Resumes; reject a helper that merely returns a normalized path or relocates the existing loops.
Testing: The interface is the test surface; existing completion and CLI trend regressions should survive, with temporary-file test adapters exercising attribution and evidence together and replacing duplicated private-helper tests where applicable.
Constraints: Preserve retained metric formats, read-only historical reconstruction, missing-evidence coverage, exact owning-Command Model evidence and ADR 0019/0021; the Trace ancestry module owns display ancestry and should retain that responsibility.
Priority and overlap: Recent Run metrics work expanded completion recording to Review, Triage and Fix runs (#2047); this seam now affects more callers. All 186 open issue titles and bodies were checked. No open issue proposes this deepening; #2036/#2066 change aggregation and presentation rather than concentrating Session attribution policy.
Activity
JacobStephens2 commentedon Nov 12, 2026
Investigation summary
Investigated #2082 against selected Base commit 287d9a9. Code inspection confirms duplicated attribution policy, but does not establish that the proposed consolidation earns its interface cost. Recommend separating the interface proof from production migration.
Confirmed evidence
Proposed split
A. Prove a Run metrics attribution interface using temporary-file evidence adapters and a behavior matrix. Explore ordered stage observations that hide positional matching, normalized identity, first-stage ownership, evidence selection and setup fallback without exposing those algorithms to both callers. Exercise shared references, former/current filename aliases, repeated Repairs, absent/corrupt evidence, no-path stages, mismatched retained stage arrays, wrong-owner Model evidence, Security review Resumes and orphan Resumes. Demonstrate which caller responsibilities disappear; reject a normalization helper or pass-through extraction.
B. Only after A establishes depth and settles the alias policy, migrate completion and weekly trends through that interface. Keep timing, aggregation, grouping and serialization in their existing projections. Preserve retained formats, saved metrics, historical read-only behavior, missing coverage, requested-versus-observed Model distinctions and ADR 0019/0021. Trace ancestry remains responsible for display attachment and descendant ownership.
Existing regression anchors include tests/run_metrics.rs:226,271 and tests/metrics.rs:397,465,641,660,715,1151,1267,1358. Future implementation validation should run the focused Run metrics/metrics suites and scripts/affected-tests against its Base branch.
No matching open issue was found among 186 open issues searched by title/body. #2036 and its related Tickets address aggregation/presentation rather than this interface. Tests were inspected, not executed: this investigation confirms an architectural observation, not a reported runtime failure. No source, Git-history or GitHub changes were made.
Questionnaire
For the Day shift deciding how to advance #2082:
Code inspection confirms repeated Session attribution logic, but the issue's deletion test remains unproven. The proposed scope also contains a potential behavior change: completion review counts deduplicate literal paths while Session signals normalize former/current filenames.