Skip to content

Add interactive battery timeline - #24

Merged
EClinick merged 3 commits into
masterfrom
task/ec/interactive-battery-timeline
Aug 9, 2026
Merged

EClinick merged 3 commits into
masterfrom
task/ec/interactive-battery-timeline

Conversation

@EClinick

@EClinick EClinick commented Aug 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • replace the static battery history chart with a native Swift Charts timeline that supports hover inspection, pinned readings, horizontal navigation, and 1D/3D/7D/All retained-history windows
  • keep gaps, charging and plugged-in bands, exact raw inspection, and narrow-pane date labels truthful while bounding rendered points for long histories
  • refresh the retained 90-day timeline incrementally, reconcile completed seven-day backfills, and prepare derived chart data off the UI actor
  • make the AppKit scroll-cue integration test wait for animation completion instead of assuming a fixed display-timing delay

Why

Battery history was difficult to inspect and long retained windows made the chart expensive to redraw. This keeps the existing data semantics while making exploration responsive and readable.

Verification

  • swift test --filter StatsTimelineInteractionTests (22 tests passed)
  • swift test --filter PopoverLayoutTests --no-parallel -j 1 (4 tests passed in five consecutive runs)
  • swift test --no-parallel -j 1 (339 tests passed)
  • make app (signed universal Juice Dev bundle verified; x86_64 + arm64, signing team U2MBGTFZM5)
  • git diff --check

Copilot AI lite review requested due to automatic review settings August 9, 2026 14:14
@vercel

vercel Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
website Ignored Ignored Preview Aug 9, 2026 2:34pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cabe140ee3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Sources/Juice/Stats/StatsView.swift Outdated
Comment on lines +699 to +703
let previousWindowEnd = timelinePreparedData == nil ? nil : timelineWindowEnd
let requestHours = StatsTimelineRefresh.requestHours(
previousWindowEnd: previousWindowEnd,
windowEnd: windowEnd,
retentionHours: Self.timelineHours)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Requery historical rows after startup backfill

When Stats is opened before SamplerService.backfillIfNeeded() finishes, the initial 90-day query can miss points that are subsequently imported into gaps throughout the previous seven days. Once timelinePreparedData is set, this refresh policy queries only the elapsed interval plus the two-minute overlap—normally one hour—so those older rows never reach mergedSamples while the window remains open. Detect backfill completion or periodically reload the affected historical horizon.

Useful? React with 👍 / 👎.

@EClinick
EClinick merged commit b8684e9 into master Aug 9, 2026
2 checks passed
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.

2 participants