Skip to content

perf(spend): bound initial ledger layout on long ranges - #4001

Merged
steipete merged 1 commit into
mainfrom
triage/20260921-perf-ui-m
Sep 25, 2026
Merged

steipete merged 1 commit into
mainfrom
triage/20260921-perf-ui-m

Conversation

@steipete

Copy link
Copy Markdown
Owner

Long Usage & Spend ranges initially lay out every daily ledger row. Show the newest 30 rows with the existing Show all / Show less control, keep full-period totals and chart data, and group provider-icon tooltips per row. Shared daily/hourly chart styling offsets the change: production code is 71 insertions and 72 deletions.

This adopts the ledger portion of #3998. Thanks @Yuxin-Qiao; co-author credit is in the commit. The Dock activation-policy change remains outside this adoption because this isolated proof does not measure LaunchServices or live scrolling.

Verification

Synthetic 365-day history, debug build, one warm-up excluded:

Measurement Before After
Warm view-layout median, 3 samples 248.7 ms 41.1 ms
Model-build median, 10 samples 18.2 ms 19.9 ms
Initial content height 15,675 pt 1,958 pt
Total spend / tokens / requests $365 / 365,000 / 365 unchanged

The rendered-height regression failed all four baseline iterations and passes after the change. These are layout measurements on a shared host, not scroll-FPS or view-body invocation measurements. Expanded mode still exposes every row.

CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 CODEXBAR_TEST_CODEX_FILE_ISOLATION=1 CODEXBAR_TEST_SESSION_FILE_ISOLATION=1 CODEXBAR_LONG_RANGE_PROOF_DIR=/tmp/perf-ui-m-proof/after CODEXBAR_SPEND_PROOF_DIR=/tmp/perf-ui-m-proof/after CODEXBAR_COST_PRIVACY_PROOF_DIR=/tmp/perf-ui-m-proof/after/privacy swift test --skip-build --no-parallel --filter 'SpendDashboard|SpendStackedBarChartTests|MenuBarLayout|MenuBarStatusItem|StatusItemLayoutPaceSignatureTests|StatusItemConditionalSignatureTests|StatusItemCombinedMetricPlaceholderTests|SyntheticMenuCardTests|ProviderArchitectureGatekeeperTests|UserFacingLocalizationCoverageTests'
make check

Results: Test run with 540 tests in 41 suites passed; XCTest ran 7 cases with 4 opt-in cases skipped and 0 failures; make check passed with 0 SwiftLint violations. An initial parallel focused run had timing failures in the existing concurrency suite; the repository runner's --no-parallel mode passes the complete selection.

Synthetic before/after renders were inspected. The 30-day, hourly, selected-day hourly, project, session, and overview PNGs are byte-identical. Proof images are retained locally for the coordinator; this lane's permitted REST operations do not include uploads. No running app was relaunched or real account probed.

Independent review reported one missing-import finding; rejected after verifying the existing @testable import CodexBar at the top of the test and the successful build. No accepted actionable findings remain.

The v0.65.0 status-item renderer is unchanged; added width goldens retain 56/49 pt for the default synthetic 16-pt-icon, 50% fixture and 26/19 pt for icon-only (Regular/Tight). The spacing report needs its actual layout settings. PR #3997 is not adopted: its session titles/project labels bypass Hide personal info, and its hourly chart changes from the full range to the latest active day.

Closes #3998
Refs #3997
Refs #3993

Show the newest 30 daily rows initially and retain the complete ledger behind
Show all. Consolidate daily/hourly chart styling and per-row provider help
without changing source history, totals, chart scope, or exports.

Adopt the bounded-ledger portion of #3998 with expanded fixture coverage.
Retain the v0.65.0 default status-item width contract while investigating #3993.

Co-authored-by: Yuxin Qiao <104957188+Yuxin-Qiao@users.noreply.github.com>
@steipete
steipete force-pushed the triage/20260921-perf-ui-m branch from f659012 to 0fb7e87 Compare September 25, 2026 19:36
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026

Copy link
Copy Markdown

Codex review: blocked before merge. Reviewed September 25, 2026, 3:42 PM ET / 19:42 UTC.

ClawSweeper review

What this changes

The PR initially displays the newest 30 daily spend rows with an expand control, groups provider tooltips, shares chart styling, and adds layout and regression coverage.

Merge readiness

⛔ Blocked before merge - 2 items remain

Current main still lays out every daily ledger row. This focused PR addresses that behavior, and the reported native layout measurements support its narrower initial-layout claim. The full test suite remains unreported under repository handoff guidance.

Priority: P2
Reviewed head: 0fb7e87b65e7fae16261ba5539b81c4f206af49c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and its native layout measurements support the stated improvement, with full-suite handoff validation still outstanding.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The owner-authored PR is exempt from the contributor proof gate. Its reported macOS NSHostingView run exercises the production spend section with 365 synthetic days and observes a shorter, faster initial layout after the change; it does not establish live scroll-frame performance. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The owner-authored PR is exempt from the contributor proof gate. Its reported macOS NSHostingView run exercises the production spend section with 365 synthetic days and observes a shorter, faster initial layout after the change; it does not establish live scroll-frame performance. No stored-data contract changes.
Evidence reviewed 7 items Introduced ledger limit: The pinned introduced patch selects the newest 30 summaries initially and keeps complete expansion available.
Current main behavior: The pinned main revision renders the entire reversed daily-summary sequence, so the central change is not already on main.
Full-period model: The model builds one summary per covered day and feeds it separately from group totals and chart points.
Findings None None.
Security None None.

How this fits together

CodexBar turns provider usage snapshots into daily spend summaries for the Settings window. Charts, totals, and the ledger consume those summaries; this change limits the rows laid out initially while preserving the full-period data.

flowchart LR
A[Provider usage] --> B[Daily spend summaries]
B --> C[Selected range]
C --> D[Charts and totals]
C --> E[Initial ledger row limit]
E --> F[Settings display]
F --> G[Show all control]
Loading

Before merge

  • Resolve merge risk (P1) - The repository requests a full make test run before handoff; the PR reports focused tests and make check, while full-suite completion is not established.
  • Complete next step (P2) - Report a full make test run from a keychain-safe macOS setup before merge.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Synthetic native layout 248.7 → 41.1 ms median; 15,675 → 1,958 pt The reported before-and-after measurements directly target initial long-range layout.
Code and test delta production +71/−72 lines; tests +129 lines The shared chart-style refactor offsets the ledger change's production growth.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the bounded ledger after full-suite validation, with complete accounting retained and the separate Dock performance question handled on its own merits.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the bounded ledger after full-suite validation, with complete accounting retained and the separate Dock performance question handled on its own merits.

Do we have a high-confidence way to reproduce the issue?

Yes: a 365-day synthetic history can exercise the production Settings view in an AppKit host, and current main visibly renders every row. The reviewer did not independently run the macOS layout test.

Is this the best way to solve the issue?

Yes: the existing expand-control pattern gives users access to every row while reducing initial layout work; model totals and charts retain the full range.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a2cf7face10b.

Labels

Label changes:

  • add P2: Long-range Settings layout is a user-facing performance improvement with a limited affected surface.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The owner-authored PR is exempt from the contributor proof gate. Its reported macOS NSHostingView run exercises the production spend section with 365 synthetic days and observes a shorter, faster initial layout after the change; it does not establish live scroll-frame performance. No stored-data contract changes.

Label justifications:

  • P2: Long-range Settings layout is a user-facing performance improvement with a limited affected surface.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The owner-authored PR is exempt from the contributor proof gate. Its reported macOS NSHostingView run exercises the production spend section with 365 synthetic days and observes a shorter, faster initial layout after the change; it does not establish live scroll-frame performance. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Sahil Imtiaz: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Yuxin-Qiao: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Report the repository's full make test result from a keychain-safe macOS setup.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit ce1b808 into main Sep 25, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant