Repository navigation
fix(perf): compact long-horizon trend history - #1640
Conversation
jhrozek
left a comment
There was a problem hiding this comment.
Panel review (spec/standards/test-adequacy/domain fan-out) found no blockers. Leaving 3 inline comments worth acting on before merge, plus one general note below.
General (not inline — AGENTS.md isn't touched by this diff): the perf/ architecture-map bullet (around AGENTS.md:98) names perf/cmd/perfconvert and perf/cmd/allocsgate by name (stdlib-only/tested/fail-closed) but wasn't updated to add this PR's new sibling perf/cmd/benchtrend. That bullet is the canonical "where things live" inventory this repo maintains for exactly this case — worth a short addition alongside its siblings.
Several other advisory items (GH_TOKEN-in-URL, single-file command shape, the derivedBases legacy-naming coupling, the triplicated median() helper) were discussed and deliberately left as-is since each already matches an established repo convention or has a bounded, self-healing risk.
| t.Error("compaction is not byte-idempotent") | ||
| } | ||
|
|
||
| replaced, replaceStats, err := compactHistory(bytes.NewReader(out), "mecatl go microbenchmarks", "abc") |
There was a problem hiding this comment.
-replace-commit is only exercised here against a commit that IS present in history (drops "abc", keeps "def"). The actual CI invocation (perf.yml's -replace-commit "$GITHUB_SHA") will usually hit a brand-new SHA that has no matching row yet — that no-op path isn't covered. Worth adding a case where the target commit is absent, to pin that it's a safe no-op rather than an accidental error/panic.
There was a problem hiding this comment.
Addressed in 23843e0. The test now passes an absent replacement SHA and asserts that the compacted history and row/point counts remain unchanged; I also mutation-checked the assertion by making the absent SHA fail and observing the test go red.
| fmt.Fprintln(os.Stderr, " benchtrend compact -in <data.js> -out <data.js> -suite <name> [-replace-commit <sha>]") | ||
| } | ||
|
|
||
| func runConvert(args []string) error { |
There was a problem hiding this comment.
runCompact has an end-to-end CLI test (TestRunCompact_RewritesInputInPlace, flags → file I/O), but runConvert doesn't — only the inner convertBench is tested directly. perf.yml invokes exactly go run ./perf/cmd/benchtrend convert -in bench-new.txt -out bench-trend.json, so that's the real seam this tool needs to prove works; worth a sibling test for runConvert mirroring the compact one.
There was a problem hiding this comment.
Addressed in 23843e0. TestRunConvert_ReadsAndWritesFiles now exercises the exact flags-to-file-I/O seam used by the workflow and validates the emitted custom benchmark JSON.
| # three per-unit medians before the action appends this commit. The operation | ||
| # is idempotent, preserves other suites and unknown fields, and uses the same | ||
| # serialized perf-main concurrency group as the later publishers. | ||
| - name: Compact historical microbenchmark trend |
There was a problem hiding this comment.
This new step has no continue-on-error, so a transient failure here (a benchtrend compact bug, or a push hiccup) aborts the whole job before the later dashboard push, the scenario gate (fail-on-alert:true for this commit), and the next PR's baseline publish all run. Since compact is idempotent and self-healing (the next successful run recompacts everything accumulated since, including this commit's row), and nothing downstream depends on this step succeeding for correctness — only freshness — consider continue-on-error: true here plus a ::warning/step-summary annotation on failure, so a real bug is loud without blocking dashboard/gate/baseline for the commit.
There was a problem hiding this comment.
I’m keeping this step fail-closed. In the failure this PR must repair, data.js is already 104.7 MB; continuing after a compaction failure only reaches the immediately following benchmark-action push, which is refused for the same oversized blob and stops the job anyway. It therefore does not preserve the downstream gate/baseline on the critical migration run, while it would mask malformed-history or compactor failures. The serialized, idempotent rerun remains the recovery path.
|
Also addressed the general inventory note in 23843e0: the AGENTS.md perf architecture-map entry now includes benchtrend alongside perfconvert and allocsgate. |
Summary
ns/op,B/op, andallocs/oppoint per benchmark and main commit.Development stage
and the in-PR plan declares
**Expected tasks:** 1, a non-placeholder**Combined rationale:**, and no runtime/public/operator/persistence/trust-boundaryinterface change (
None — rationale; workflow-only meta-changes may review processdocs/skills here)
Contract linkage
Interface conformance
Issue relationship
No tracking issue. Failure observed in perf job 104881636068.
Type of change
Test plan
Baseline checks
task lint)task test) — attempted; blocked by the pre-existing macOSTestCommandRunnerEnvironment_Scenario2_DefaultScrubfailure, reproduced on unchangedorigin/maingo run ./cmd/mecademo) — runtime behavior unchangedtask docs) — architecture prose only; no generated/user-doc site contenttask site:build) — not applicabletask api:check) — not applicabletask api:update+engine/CHANGELOG.md— not applicabletask ac-trace-strict) — not applicable/panel-reviewAdditional checks:
go test ./perf/cmd/...actionlint .github/workflows/perf.ymlgit diff --checkgh-pagesdata: 653 rows and 407,400 points became 652 commit-keyed rows and 30,510 points;data.jsfell from 104,730,713 bytes to 15,244,616 bytes.Changes
.github/workflows/perf.ymlperf/cmd/benchtrend/docs/architecture/observability.mdUser-facing change
None. The advisory performance dashboard retains the full main-branch horizon with one representative point per benchmark metric and commit.
Special notes for reviewers
The immediate push failure was caused by
dev/bench/data.jsreaching 104.7 MB, above GitHub's 100 MiB per-blob limit. The compaction commit replaces that blob with a 15.2 MB version beforegithub-action-benchmarkpublishes new points. The workflow's existingperf-mainconcurrency group continues to serialize allgh-pageswriters, and first-publication bootstrap remains supported.Panel review found no remaining blockers or important findings. One advisory noted the small median helper is local to three independent perf commands; it remains duplicated to avoid coupling standalone CI tools for negligible reduction.