Repository navigation
fix(native-tray): guard oversized quota percentages - #6099
Conversation
A finite percentage at or above Double(Int.max) passed NativeTrayFormat.number and trapped when percentText or percentDescription converted it to Int. Both formatters now return their unavailable strings before the conversion, and the NativeTray test executable covers 1e20 and the Int upper boundary. Carries #6082. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughPercentage formatting now returns unavailable strings for nonnegative values at or above ChangesPercentage formatting bounds
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The menu-bar formatters now return their unavailable text instead of trapping on oversized finite percentages, while preserving ordinary formatting. No material merge risk is evident; merge after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
리뷰 · 우선순위 44 / 80이 PR은 맥 상단 막대(트레이)가 사용량 퍼센트를 글자로 만들 때, 너무 큰 숫자 때문에 프로그램이 꺼지지 않게 해요. 베이스는 사용량 숫자는 소수점을 버린 뒤 정수로 바꿔 "89%"처럼 적어요. 라인 - 라인 - 라인 - 메인테이너의 판단이 필요한 지점 정수로 못 바꾸는 퍼센트를 창 전체에서 "없는 값"으로 볼지예요. 글자만 숨기면 막대는 가득 찬 빨간색으로 남아요. #6082와 이 PR은 고친 코드가 같아요. 어느 쪽을 남길지 정해 주세요. 너의 추천 창의 값에서 거르세요. 이 PR을 남기고 #6082는 닫으세요. 경계 테스트는 이쪽에만 있어요. 막대까지 맞춘 다음 머지하세요. 이 댓글은 grok-bot이 작성했습니다 |
|
Maintainer integration into
|
Summary
The macOS menu bar companion could crash while formatting a quota bar.
NativeTrayFormat.numberaccepts any finite, nonnegativeDouble, andpercentText/percentDescriptionthen converted it withInt(percent.rounded(.down)). A finite value at or aboveDouble(Int.max)(for example1e20from a malformed quota payload) trapped that conversion. Both formatters now return their existing unavailable strings ("—" visibly, "Unavailable" for VoiceOver) before converting, and ordinary flooring (89.9% reads "89%") is unchanged.numberitself is untouched, because other consumers apply their own clamping (the bar fill is capped at 100 inModels.swift).This carries #6082 by @luvs01, with the same two-line guard and additional boundary assertions at
Double(Int.max)and its next-lower representable value.Co-authored-by: luvs01 27862058+luvs01@users.noreply.github.com
Verification
swift run --package-path app NativeTrayTests: PASS, 59 assertions (53 ondevbefore this change, plus 6 new).1e20(exit 133). With the guard it passes.git diff --checkclean. Swift files are outside the file-size ratchet, and no TypeScript changed, sotypecheck/test:changedhave nothing to exercise here. The local full Bun suite was not run because this is Swift-only and seven release lanes share the machine. The macOS widget CI job is the hosted proof.Checklist
structure/companion.mdwas reviewed and does not describe which raw values render, so it needed no change.)Summary by CodeRabbit