Skip to content

refactor(benchmark): dedup rendering, path resolution, and metrics accumulation - #470

Merged
rianjs merged 1 commit into
mainfrom
refactor/453-benchmark-dedup
Jul 10, 2026
Merged

refactor(benchmark): dedup rendering, path resolution, and metrics accumulation#470
rianjs merged 1 commit into
mainfrom
refactor/453-benchmark-dedup

Conversation

@rianjs

@rianjs rianjs commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The dedup half of #453 (Phase 6, part of #455); the in-process executor ships separately. All 12 audited items landed, scoped to internal/benchmark + internal/cmd/benchmarkcmd.

Highlights: a sticky-error writer collapses ~36 copies of the 3-line Fprintf-error pattern and lets the run/selection and compare/selection-compare render pairs merge; benchmark.ResolveSuitePath replaces four copies of suite-relative resolution; RunMetrics.Add replaces the two hand-rolled accumulations (the audit's caveat held — ExtractRunMetrics uses a different type and stays); generic filterByID; markdownCell alias deleted across 11 call sites; validateCandidateCaseHosts parses each case PR once with error order preserved; Normalize trims via trimAll.

Rendered text, report markdown, and error messages are byte-identical (rendering tests pass unchanged).

Verification: build/vet clean; full suite 2,587 green in 57 packages; repo-wide lint clean; harness green; zero tests deleted. 7 files, +177/−348 (net −171).

…cumulation

- Exported RunMetrics.Add for the two hand-rolled accumulation sites
- Sticky-error writer collapses ~36 Fprintf-error triples; run/selection
  and compare/selection-compare render pairs merged
- One variadic results-dir helper replaces three resolve* copies
- benchmark.ResolveSuitePath exported; four suite-relative copies gone
- Selection failure epilogue in a closure; identical if/else branches
  collapsed in compare/select/run
- Generic filterByID for candidate/case selection; single-loop warning
  dedup; shared report-markdown headers
- validateCandidateCaseHosts parses each case PR once (error order kept)
- markdownCell alias deleted (11 callers -> markdownCode)
- Normalize uses trimAll instead of 20 per-field lines

Part of #453 (Phase 6, dedup half; in-process executor is separate).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant