Skip to content

Menu: let metric meta and reset rows wrap instead of truncating - #2742

Merged
steipete merged 4 commits into
steipete:mainfrom
Yuxin-Qiao:codex/menu-metric-meta-wrap
Aug 8, 2026
Merged

Menu: let metric meta and reset rows wrap instead of truncating#2742
steipete merged 4 commits into
steipete:mainfrom
Yuxin-Qiao:codex/menu-metric-meta-wrap

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The compact usage rows from Compact usage details into one line #2620 put all pace detail on a single lineLimit(1) meta line and moved the reset time into the title row. In longer locales (e.g. Chinese) the tail content truncates: "距重置…" cuts off the reset countdown, and "重置于 8月14日 晚…" never shows the time.
  • Keep the compact layout, but let the meta line and reset label wrap to a second line so all information stays visible in every locale.
  • Include the wrapping reset/meta text content in the menu-card height-cache fingerprint (Metric.heightFingerprint), so a short-to-long refresh re-measures the card instead of reusing a cached one-line frame that clips the second line.
  • Updated the layout test that asserted the one-row contract: it now verifies the detail wraps to a second row (bounded growth) instead of truncating. Fingerprint tests now require meta/reset text changes to invalidate the fingerprint, plus a short-to-long regression test. Gatekeeper line anchors for MenuCardView shifted accordingly.

Test

  • swift test --filter MenuCardHeightFingerprintTests and --filter UsageMenuCardLayoutTests: 13/13 green (live output below).
  • Full make test on the rebased head: 69/69 groups green (828 selections), 0 retries.
  • make check: 0 violations in 1804 files.

Live behavior proof

Focused run on this PR head (a022b6501), showing both the wrapping layout behavior and the height-cache invalidation:

$ swift test --filter "MenuCardHeightFingerprintTests|UsageMenuCardLayoutTests"
✔ Test "height fingerprint invalidates when wrapping text grows from short to long" passed
✔ Test "height fingerprint tracks wrapping metric text content" passed
✔ Suite MenuCardHeightFingerprintTests passed
✔ Test "metric detail wraps to a second row instead of truncating as pace content grows" passed
✔ Suite UsageMenuCardLayoutTests passed
✔ Test run with 13 tests in 2 suites passed

metric detail wraps to a second row instead of truncating as pace content grows measures the rendered card via sizeThatFits at 296pt width: the long localized meta line grows the card by roughly one text line (asserted > heightTolerance and < 20pt), i.e. the second line renders instead of truncating. The fingerprint tests verify the cached height is invalidated whenever the wrapping reset/meta text changes, so the grown card actually gets its new frame on refresh.

Rebase

  • Rebased onto current main (cee0fd074); the rebased branch keeps the current percentage-label semantics. Branch is mergeable (no conflicts).

@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: 0c4430a8d7

ℹ️ 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 on lines +559 to +561
.lineLimit(2)
.truncationMode(.tail)
.fixedSize(horizontal: false, vertical: true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Include wrapped metric text in the height-cache fingerprint

When an already-populated metric changes from a short countdown or pace string to a longer one—for example, when a forecast is appended after refresh—these lines now change the card's height. However, Metric.heightFingerprint in MenuCardHeightFingerprint.swift records only whether reset/meta text is present, so makeMenuCardItem can reuse the old measured frame for the same scope and width; the newly added second line is then clipped, defeating this fix until another fingerprint field changes. Include the reset/meta text shape or content in the metric height fingerprint now that these fields can wrap.

Useful? React with 👍 / 👎.

@Yuxin-Qiao Yuxin-Qiao closed this Aug 7, 2026
@Yuxin-Qiao Yuxin-Qiao reopened this Aug 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 8, 2026, 1:51 AM ET / 05:51 UTC.

ClawSweeper review

What this changes

This PR allows compact usage-card reset and pace metadata to wrap to two lines and adds their content plus the adjacent title to the card-height cache fingerprint.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

Blocked until real behavior proof from a real setup is added - 3 items remain

The patch remains necessary: current main still limits compact reset and pace text to one line. The latest head addresses the matching layout and height-cache path; native-menu proof is still needed before merge.

Priority: P3
Reviewed head: 0b2e490891dd62e86ac2ca0714d5b3574544c20e

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused patch and regression coverage look good, but real native-menu proof remains the merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The body’s focused sizeThatFits test output is useful supplemental evidence, but it is not direct after-fix native-menu proof; add a redacted screenshot or recording of the built app, then update the PR body for re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The body’s focused sizeThatFits test output is useful supplemental evidence, but it is not direct after-fix native-menu proof; add a redacted screenshot or recording of the built app, then update the PR body for re-review.
Evidence reviewed 5 items Current main behavior: Current main renders compact reset text and pace metadata with a one-line limit, so longer localized strings can truncate.
Branch implementation: The PR changes the affected text to two-line layout and fingerprints reset/meta content plus the title that shares horizontal space with reset text.
Feature provenance: The compact usage-detail design being adjusted was introduced by the merged menu change authored by Peter Steinberger.
Findings None None.
Security None None.

How this fits together

CodexBar maps provider usage snapshots into compact SwiftUI menu-card rows, measures them for AppKit, and caches their geometry across refreshes. Reset and pace strings affect both row layout and required card height.

flowchart LR
A[Provider usage snapshot] --> B[Metric presentation]
B --> C[Compact metric row]
C --> D[AppKit height measurement]
D --> E[Fingerprint height cache]
E --> F[Menu-bar usage card]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The body’s focused sizeThatFits test output is useful supplemental evidence, but it is not direct after-fix native-menu proof; add a redacted screenshot or recording of the built app, then update the PR body for re-review.
  • Resolve merge risk (P2) - Focused sizeThatFits tests support the layout seam, but no direct after-fix native-menu capture shows localized wrapping in the freshly built app.
  • Complete next step (P2) - The branch has no remaining mechanical code finding; the contributor must supply real native-menu proof before a human merge decision.
Agent review details

Security

None.

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the bounded two-line layout and merge after a redacted native-menu screenshot or recording visibly shows the formerly truncated reset or pace text without clipping.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the bounded two-line layout and merge after a redacted native-menu screenshot or recording visibly shows the formerly truncated reset or pace text without clipping.

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

Yes, at source level: current main sets both compact strings to one line, and the branch's fixed-width sizeThatFits tests exercise second-line growth. Direct native-menu proof has not been supplied.

Is this the best way to solve the issue?

Yes; a two-line cap with corresponding height-cache invalidation is the narrowest way to preserve the compact design while keeping localized text visible.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a localized compact-menu readability correction with limited blast radius.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The body’s focused sizeThatFits test output is useful supplemental evidence, but it is not direct after-fix native-menu proof; add a redacted screenshot or recording of the built app, then update the PR body for re-review.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the merged compact-row change and the current menu-card/cache history. (role: introduced the compact layout and recent area contributor; confidence: high; commits: 70125a5ec102, d96e1822f856, 2436b9f95c8f; files: Sources/CodexBar/MenuCardView.swift, Sources/CodexBar/MenuCardHeightFingerprint.swift)

Rank-up moves

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

  • Add a redacted screenshot or recording from the freshly built app showing the formerly truncated localized reset or pace text wrapped in the open menu.
  • Update the PR body after adding proof; if a fresh review does not start, ask a maintainer to comment @clawsweeper re-review.

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.

History

Review history (6 earlier review cycles)
  • reviewed 2026-08-07T20:26:18.821Z sha 0c4430a :: needs real behavior proof before merge. :: [P1] Invalidate cached height when wrapping metric text changes
  • reviewed 2026-08-07T21:07:26.775Z sha 0c4430a :: needs real behavior proof before merge. :: [P1] Invalidate cached height when wrapped metric text changes
  • reviewed 2026-08-07T22:20:21.690Z sha 0c4430a :: needs real behavior proof before merge. :: [P1] Include wrapping text in the height-cache fingerprint
  • reviewed 2026-08-07T23:51:41.611Z sha 0c4430a :: needs real behavior proof before merge. :: [P1] Include wrapping text in the height-cache fingerprint
  • reviewed 2026-08-08T04:20:25.722Z sha a022b65 :: needs real behavior proof before merge. :: [P2] Include the rendered title in the height-cache fingerprint
  • reviewed 2026-08-08T05:07:53.713Z sha b69f82f :: needs real behavior proof before merge. :: [P3] Remove the duplicate Fixed heading

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 7, 2026
Compact usage detail rows (steipete#2620) put all pace detail on one line and moved reset times into the title row; longer locales (e.g. Chinese) truncate tail content. Allow the meta line and reset label to wrap to two lines so all information stays visible while keeping the compact layout.
@Yuxin-Qiao
Yuxin-Qiao force-pushed the codex/menu-metric-meta-wrap branch from 0c4430a to a022b65 Compare August 8, 2026 03:33

@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: a022b65014

ℹ️ 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".

presentation.metaText == nil ? "meta=0" : "meta=1",
// Reset and meta rows may wrap to a second line, so their text
// content (not just presence) can change the measured card height.
MenuCardHeightFingerprint.field("reset", presentation.resetText),

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 Include the title width in the wrapping-row fingerprint

When a stable reset label sits near the wrapping threshold, a width-changing title update—such as 9% left becoming 100% left, or a longer dynamic window title—reduces the space offered to the reset text in the same HStack and can change it from one line to two. This fingerprint still hashes only reset/meta content and intentionally ignores percentage changes, so the old one-line cached height is reused and the new second line can be clipped. Fresh evidence in this revision is that reset wrapping was introduced while the cache key still omits presentation.titleText; include that width-affecting text in the fingerprint as well.

Useful? React with 👍 / 👎.

@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 8, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 8, 2026
steipete and others added 2 commits August 7, 2026 22:03
Co-authored-by: Yuxin Qiao <104957188+Yuxin-Qiao@users.noreply.github.com>
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Aug 8, 2026
@steipete
steipete merged commit d91fcea into steipete:main Aug 8, 2026
9 checks passed
@steipete

steipete commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Landed. Verified before merge: wrapping is bounded to one extra line at the standard 296pt width; the #2674 hover-deferral pattern is preserved (tracked-parent structural rebuilds stay deferred). A maintainer fix (b69f82f33) closed a real gap the review found: the height fingerprint omitted the title that shares width with the reset, which could churn fixed-row percentages — now conditionally fingerprinted only when a reset exists. Full suite 828/69 green locally; the arm64 Linux CI failure was diagnosed as a runner libdispatch flake (clean Docker build + clean rerun). Thanks @Yuxin-Qiao!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants