Skip to content

Move job stats from minutes to seconds#758

Merged
epompeii merged 1 commit intodevelfrom
u/ep/job-stats
Mar 31, 2026
Merged

Move job stats from minutes to seconds#758
epompeii merged 1 commit intodevelfrom
u/ep/job-stats

Conversation

@epompeii
Copy link
Copy Markdown
Member

This changeset moves the nightly job stats from minute resolution to second resolution.
Backwards compatible aliases are kept to prevent parse errors, even though they will be incorrectly labeled. This is an acceptable tradeoff given the limited usage of jobs so far for Bencher Self-Hosted users.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

🤖 Claude Code Review

PR: #758
Base: devel
Head: u/ep/job-stats
Commit: 68a241d3887fd3f72fc54afd23e4cf4eb9110f66


PR Review: job_stats — Minutes to Seconds Rename

Summary

This PR renames runner stats fields from minutes to seconds and removes the / 60 division, so the API now reports raw seconds instead of truncated minutes. Backward-compatible deserialization is preserved via #[serde(alias = "...")].

Positive

  • Good backward compatibility: serde(alias = "minutes") / serde(alias = "minutes_per_report") ensures old serialized data can still be deserialized. Tests cover both the old-format deserialization and the JsonTopJobProject alias.
  • Clean removal of lint suppressions: clippy::integer_division is no longer needed — correctly removed.
  • Tests are solid: Both new tests verify the alias path works correctly.
  • OpenAPI spec is updated and consistent with the Rust types.

Issues & Concerns

1. Breaking API change for consumers (Medium severity)
The OpenAPI spec now uses seconds / seconds_per_report as the serialized field names. Any existing API client (including bencher_client auto-generated from the spec) will send/expect seconds, but older server instances still return minutes. The serde(alias) only helps deserialization — the server will now serialize as seconds, which breaks older clients that expect minutes.

Was a versioned rollout considered? A common pattern is to serialize under the old name for a release cycle while accepting both, then switch.

2. cargo gen-types may need re-running
Per CLAUDE.md, when the API changes, cargo gen-types should be run to regenerate TypeScript types. The console doesn't appear to reference these fields currently, but the generated bencher.ts types should stay in sync with openapi.json. Confirm the types file is up to date.

3. TODO comments lack tracking (Low severity)
Three // TODO remove in due time comments are added for the serde aliases. These should reference a tracking issue or timeline so they don't rot indefinitely.

4. OpenAPI spec field ordering changed in JsonTopJobProject
The seconds field moved from before name to after percentage in the JSON schema. This is semantically fine (JSON is unordered), but confirms this was likely auto-generated — just verify with cargo gen-types.

5. No clippy::integer_division on removed divisions — confirm lint config
The #[expect(clippy::integer_division)] was removed. This is correct since the integer division is gone, but double-check that this lint isn't triggered elsewhere in the same function (the as u64 casts on i64 values are still there, covered by cast_sign_loss).

Nits

  • The test runner_stats_deserialize_old_minutes is quite verbose with all the zeroed-out cohorts. Consider a helper or Default impl to reduce boilerplate (though this is test-only, so it's fine as-is).

Verdict

The change is straightforward and well-tested for backward deserialization. The main concern is the forward-compatibility impact on API consumers — existing clients will break when the server starts returning seconds instead of minutes. Clarify whether this is an internal-only endpoint or if a migration strategy is needed.


Model: claude-opus-4-6

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

🐰 Bencher Report

Branchu/ep/job-stats
Testbedintel-v1
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
Adapter::Json📈 view plot
🚷 view threshold
4.54 µs
(-0.20%)Baseline: 4.55 µs
4.81 µs
(94.41%)
Adapter::Magic (JSON)📈 view plot
🚷 view threshold
4.41 µs
(-0.18%)Baseline: 4.42 µs
4.62 µs
(95.48%)
Adapter::Magic (Rust)📈 view plot
🚷 view threshold
25.03 µs
(-0.29%)Baseline: 25.10 µs
28.50 µs
(87.82%)
Adapter::Rust📈 view plot
🚷 view threshold
3.37 µs
(-0.04%)Baseline: 3.37 µs
3.58 µs
(94.07%)
Adapter::RustBench📈 view plot
🚷 view threshold
3.36 µs
(-0.17%)Baseline: 3.37 µs
3.74 µs
(89.96%)
🐰 View full continuous benchmarking report in Bencher

@epompeii epompeii merged commit 83eba42 into devel Mar 31, 2026
62 checks passed
@epompeii epompeii deleted the u/ep/job-stats branch March 31, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant