Add rolling 24-hour Team Runtime usage - #718
Merged
Merged
Conversation
Harry19081
marked this pull request as ready for review
August 6, 2026 13:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Team Runtime can show UTC-day totals but cannot render a true rolling 24-hour usage chart or per-member 24-hour comparison. Re-querying each member's local history from the viewer is impossible, and adding another scheduler scan would increase idle I/O.
Solution
Derive a rolling headline and hourly series inside the existing bounded Rust daily-rollup scan, serialize it through the existing Tauri result, and attach it to the scheduler's existing status heartbeat. The cloud status field is additive and optional for older peers, trends are capped at 25 points, and the entire status remains under the existing 8 KiB limit by dropping only the additive snapshot near the cap. Team Runtime aggregates the bounded peer snapshots for its 24-hour chart and lets member drilldowns switch between the inline 24-hour view and existing daily ranges.
Potential risks
Peers on older builds omit the snapshot and appear with an empty 24-hour state until upgraded. Unusually large status metadata can intentionally drop the snapshot while preserving the heartbeat and lifetime census. The local Tauri result gains a required field, but frontend and backend ship together; the cloud wire addition remains optional and needs no schema migration. No CPU or wall-time improvement claim is made because runtime profiling was not performed; the implementation is structurally bounded and reuses the existing scan.
Architecture audit
Covered all 10 architecture layers. Storage schema and identity are unchanged; aggregation ownership remains in
orgtrack_core; camelCase serialization and Zod parsing are explicit; the local result has construction/serialization parity; the cloud protocol evolves additively; the rolling window is[end - 24h, end]with hourly bucketing; and old/malformed peer payloads degrade to an absent snapshot. No naming or control-flow sweep candidate was found outside this feature.Performance guard
Verdict: pass. Active/visible and active/hidden operation reuse the existing scheduler cadence and one bounded database scan; idle operation adds no timer, poll, subscription, or cache; repeated panel open/close creates no retained work; multi-instance behavior is unchanged; restart/cold-start behavior accepts peers without the new field. Memory and payload growth are capped by 25 hourly points, the fixed usage-bucket count, and the 8 KiB status limit. No additional I/O pass or unbounded loop was introduced.
UI audit
Frontend UI audit: 0 fixes, 4 keep-with-reason decisions, and no abstraction or sweep candidate. The report is included at
docs/frontend-ui-audit-2026-08-06/RuntimeUsageCharts.md.Verification
cargo test -p orgtrack_core daily_rollup_— passed (6 tests; 546 filtered out).cargo clippy -p orgtrack_core --lib -- -D warnings— passed.rustfmt --edition 2021 --checkon the 4 changed Rust files — passed. Fullcargo fmt --all --checkwas not used as evidence because it reports unrelated pre-existing formatting drift elsewhere in the workspace.pnpm typecheck— passed.