Repository navigation
Cut warm popup open from ~84ms to ~35ms to first frame - #60
Conversation
… close-time settle
…rride, rotation-safe script
…et, per-phase stats, exit trap, timestamped backups
…nway into perf/ui-01-profiler-harness
…y on a skipped expand phase
…on backward clock jumps
…-for-close # Conflicts: # Sources/Runway/App/StatusItemController.swift
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59e426388f
ℹ️ 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".
| // The driven height is deliberately KEPT across the close (it used to reset to the 0 | ||
| // sentinel here). The close-time settle re-measures the collapsed dashboard while hidden and | ||
| // the `measuredIdeal` onChange walks the retained value to the collapsed target, so the next | ||
| // open finds the height already correct and its pre-show layout pass has nothing to do — | ||
| // resetting to 0 made every reopen pay a full-tree re-layout just to walk 0 → target. The |
There was a problem hiding this comment.
Cancel retained height animations on close
When the user closes and quickly reopens the panel during a content-driven height morph whose target does not change during cleanup—for example, while a refresh changes a card's height—animatedHeight already contains the final target, so retaining it here neither cancels the active SwiftUI spring nor triggers the hidden measuredIdeal branch. finishClosing() only invalidates existing bridge work; subsequent animation frames can still update the retained hidden tree, and reopening can therefore display an intermediate, still-moving height. Explicitly settle or cancel any active height animation on close while preserving the final target.
Useful? React with 👍 / 👎.
**TL;DR** Second batch from the production cleanup audit: rewrites comments and one doc page that describe code that no longer exists or no longer works that way. No code changes. **What was happening** - Claude and Codex comments still described the era before read-only credentials (#84, #90) and guarded renewal (#99): "Runway never refreshes a Claude token", "so Runway rotates on the same schedule", "a successful usage fetch (which rotates tokens back to disk)". Two functions in `CodexAuthStore` carried two doc comments fused together, the first describing removed behavior. - `DashboardView` comments said steady state keeps one live screen tree and that the outgoing page unmounts when the push completes. Since #67 the page stays parked until the popover closes. Others referred to a "scroll spacer" and an `outgoing` identifier that do not exist. - `WidgetRowView` described a per-row timeline gate that #60 replaced with the shared clock, 22 lines below a doc comment saying it is deliberately not that. - `MemoryEditorState.saveDirtyDocument` was documented as overwriting a moved file; it keeps the conflict check. - Comments named things that are gone or renamed: `EscapeToCloseReader`, `discover`, `compactValue`, `formatTokens`, `enterpriseUnverified`, a `Logger` in `LocalUsageServer`, the `MenuBarExtra` label, "Phase 1" of account discovery, a pinned count on `ProviderRow`. - `ProviderAuthRetry` was described as shared by every OAuth-style provider; only Grok calls `fetch`. - `docs/providers/openrouter.md` said `/credits` is required for a usable snapshot. The provider renders whatever either endpoint returned and reports an invalid key only when both return 401 or 403. **What this changes** - Rewrites each comment to match the code, after checking the claim against the current source. - Moves the keychain-before-file ordering doc in `ClaudeAuthStore` from the `StoredCandidateLoad` struct to `orderedStoredCandidates`, the function it describes. This is the only non-comment line movement in the diff. - Updates the OpenRouter page. **Tests** `swift build --build-tests` passes. The diff changes only comment lines, apart from the struct move above.
Supersedes #55, which GitHub auto-closed when its stacked base branch was deleted on the #54 merge. Same change series, now rebased onto main (all review threads from #55 were addressed there and are reflected in this branch).
TL;DR — Warm popup open drops from ~84ms to ~35ms click-to-first-frame (upstream openusage measures 42ms with half our content). Three changes: per-view
TimelineViews gated on visibility become one shared observable clock, the panel height is retained across closes instead of reset to 0, and the close settles the hidden tree so the next open finds it clean.What was happening
TimelineViewbehind anif popoverIsVisiblegate. The panel's SwiftUI tree survivesorderOut, so each open AND close was a structural branch swap that tore down and rebuilt every dated row's subtree — measured as the largest cost in the open's pre-showlayoutSubtreeIfNeeded(~57ms avg).animatedHeightto the 0 sentinel, so each reopen walked 0 → target: a root frame change that forced a second full-tree layout.What this changes
DashboardClock(new): one 1s/30s wall clock owned byAppContainer, started/stopped at the panel show/hide chokepoints. Rows and the footer read it via observation — stable view structure, no ticks while closed, fresh stamps on open. Environment reads are optional soImageRenderershare cards (no clock) stay static, matching prior behavior.DashboardViewkeepsanimatedHeightacross closes; the reopen seed and the hidden collapsed re-measure walk it un-animated, and same-value seeds are skipped.hidePanel()runslayoutSubtreeIfNeeded()on the hidden tree so close pays for close (~34ms, invisible), replacing the ~70–100ms post-close display-cycle stall.Heads-up
Tests
DashboardClockTests.script/profile_ui.shbefore/after on this machine: open.toFirstRunloopTurn 84.1ms → 35.6ms avg; close.syncTotal 3.6ms+deferred-stall → 34.1ms all-inclusive.