Fix sub2api usage summary - #2835
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 5:24 AM ET / 09:24 UTC. ClawSweeper reviewWhat this changesThe PR groups Sub2API balance, request, token, and cost data into localized native menu-card rows while retaining canonical provider detail labels outside that UI. Merge readinessNo actionable patch defect was found. The PR has direct native before/after proof and preserves the provider’s raw snapshot rows for CLI/plugin consumers; keep it open for routine maintainer merge after the current exact-head checks finish. Priority: P3 Review scores
Verification
How this fits togetherCodexBar converts Sub2API responses into provider detail rows, which feed both CLI output and the native usage menu card. This change applies a Sub2API-only transformation at the native menu-card boundary, leaving the emitted provider snapshot intact. flowchart LR
A[Sub2API response] --> B[Provider usage snapshot]
B --> C[Raw detail rows]
C --> D[Native menu-card grouping]
C --> E[CLI and plugin output]
D --> F[Localized usage card]
Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep raw Sub2API detail rows as the shared provider contract and land this localized, grouped rendering only in the native menu card once routine checks are green. Do we have a high-confidence way to reproduce the issue? Yes—source clearly maps a Sub2API fixture through the bundled plugin and the menu-card model, and the PR supplies corresponding native before/after captures. Is this the best way to solve the issue? Yes—the change confines presentation reshaping to the native menu-card boundary while retaining the established raw labels for CLI and plugin output. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 17afef7b84eb. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14e1cb693f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } else if input.provider == .sub2api { | ||
| "Weekly" |
There was a problem hiding this comment.
Update the provider gatekeeper fingerprint
Adding this .sub2api branch (together with the new .sub2api ternary just below) changes the exact provider-specific reference cluster in MenuCardView+ModelHelpers.swift, but ProviderArchitectureGatekeeperTests still allowlists the rateWindowLabels cluster with the old reference count/fingerprint. In CI, that drift tripwire will report the cluster as changed until the allowlist is updated alongside these new provider-specific references.
Useful? React with 👍 / 👎.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Landed on Tested:
Caveat: the native proof intentionally uses a synthetic API key and fixture payload rather than a real Sub2API account; it validates production parsing/model/rendering behavior without exercising remote authentication. |
Summary
Validation
CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --filter Sub2APIMenuCardModelTests— 4 tests passedCODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --filter ProviderArchitectureGatekeeperTests— 38 tests passedgit diff --check origin/main...HEAD— passedNative before/after proof
Both captures use Developer-ID-signed debug bundles, the same loopback-only synthetic Sub2API response, a synthetic API key, and hidden personal info. The production path exercised is bundled
sub2api.js→UsageStore→UsageMenuCardView.Model→ the real composited native menu window.main)The after image confirms that
TodayandTotalcombine requests, tokens, and cost without clipping, while weekly/monthly labels remain readable. The unchanged lower test-plugin card is synthetic and was held at the same values in both captures.