perf: avoid reflecting nested cost history projects on submenu open - #2063
Conversation
Replace Cost History hosted-submenu String(reflecting:) signatures with a typed visible-content fingerprint so menu-open work no longer traverses nested project/source daily data the UI never renders. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 10:06 AM ET / 14:06 UTC. Summary Reproducibility: yes. Current main synchronously reflects the complete nested project payload on submenu refresh, and the PR’s release benchmark measures that computation; this Linux review environment cannot rerun the macOS menu path. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Use the typed visible-content fingerprint so submenu refresh remains sensitive to rendered changes without traversing hidden nested histories. Do we have a high-confidence way to reproduce the issue? Yes. Current main synchronously reflects the complete nested project payload on submenu refresh, and the PR’s release benchmark measures that computation; this Linux review environment cannot rerun the macOS menu path. Is this the best way to solve the issue? Yes. An explicit Equatable projection of rendered inputs is narrower and more maintainable than recursively reflecting the entire snapshot, and focused tests cover retained and invalidated states. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 99c3d94d4313. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
Project the hosted cost-history fingerprint onto visible chart, model, project, and source fields; preserve raw daily availability transitions. Follow-up to #2063. Changelog retains contributor credit to @Yuxin-Qiao.
Summary
Test plan
swift test --filter CostHistoryChartMenuViewTestsswift test --filter StatusMenuHostedSubmenuRefreshTestsswift test --filter StatusMenuCodexCostHistoryRefreshTestsswift build -c releasemake checkmake testPerformance evidence
Release, 30 samples after warm-up, 30 days / 4 models / 1 source per project (
swift run -c release --package-path /tmp/CostBench CostBench <projects> 1):Audit baseline on upstream main (same workload): 5 projects 18.29 ms / 20.26 ms P95; 20 projects 61.23 ms / 64.39 ms P95; visible projection ~0.06–0.07 ms median.
Risk
Main risk is an incomplete fingerprint masking a visible update. The implementation keeps the full bounded global daily array and tests every project/source field that the view renders. Project/source nested daily data is intentionally excluded because it is not displayed.
Made with Cursor