Skip to content

Fix sub2api usage summary - #2835

Merged
steipete merged 5 commits into
steipete:mainfrom
weirdo-adam:fix/sub2api-usage-summary
Aug 10, 2026
Merged

Fix sub2api usage summary#2835
steipete merged 5 commits into
steipete:mainfrom
weirdo-adam:fix/sub2api-usage-summary

Conversation

@weirdo-adam

@weirdo-adam weirdo-adam commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • localize the sub2api usage summary and quota labels in the menu card
  • group request and token totals into Today and Total rows with an explicit Cost label
  • preserve canonical provider detail labels for CLI and plugin output

Validation

  • exact-head CI: all 9 checks passed, including both macOS Swift test shards, Linux builds/tests, lint, architecture gates, and security checks
  • CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --filter Sub2APIMenuCardModelTests — 4 tests passed
  • CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --filter ProviderArchitectureGatekeeperTests — 38 tests passed
  • git diff --check origin/main...HEAD — passed
  • Developer-ID-signed debug bundles built successfully for both pinned revisions
  • structured autoreview — secret scan clean; no accepted/actionable findings

Native 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.jsUsageStoreUsageMenuCardView.Model → the real composited native menu window.

Before (main) After (this PR)
Sub2API menu before grouping Sub2API menu after grouping

The after image confirms that Today and Total combine 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.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 5:24 AM ET / 09:24 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 1 item remains

No 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
Reviewed head: 912ebb7a36cb696a01a07a3e087286e66145d5f3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused UI repair with direct native proof, targeted regression coverage, and no identified correctness blocker.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Redacted before/after native menu screenshots directly demonstrate the grouped rendered rows from signed bundles using the production Sub2API-to-menu-card path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Redacted before/after native menu screenshots directly demonstrate the grouped rendered rows from signed bundles using the production Sub2API-to-menu-card path.
Evidence reviewed 5 items Current provider data contract: The bundled Sub2API plugin emits the canonical “Usage summary” rows for balance, today, and all-time request/token totals; the PR reshapes those rows only after snapshot creation.
Narrow presentation boundary: The PR locates grouping/localization in the native menu-card model and invokes it only for Sub2API details, preserving the raw provider snapshot used elsewhere.
Focused regression coverage: The branch asserts grouped English values and the selected zh-Hans labels through the production plugin runtime plus menu-card model seam.
Findings None None.
Security None None.

How this fits together

CodexBar 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]
Loading

Before merge

  • Complete next step (P2) - No discrete repair is needed; this is awaiting normal exact-head CI completion and maintainer merge review.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and coverage delta production +52/-1, tests +87/-20 The production presentation change is paired with focused model/localization coverage and updated architecture guardrails.

Technical review

Best 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.

Labels

Label justifications:

  • P3: This is a contained provider-specific menu-card usability and localization repair with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Redacted before/after native menu screenshots directly demonstrate the grouped rendered rows from signed bundles using the production Sub2API-to-menu-card path.
  • proof: sufficient: Contributor real behavior proof is sufficient. Redacted before/after native menu screenshots directly demonstrate the grouped rendered rows from signed bundles using the production Sub2API-to-menu-card path.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Redacted before/after native menu screenshots directly demonstrate the grouped rendered rows from signed bundles using the production Sub2API-to-menu-card path.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current Sub2API snapshot rows are attributed to the current release baseline, and the history includes a dedicated Sub2API presentation completion commit. (role: recent core presentation contributor; confidence: high; commits: ae1111e39912, 251faa721428; files: Sources/CodexBarCore/Resources/Plugins/sub2api.js, Sources/CodexBar/MenuCardView+ModelHelpers.swift)
  • weirdo-adam: Prior history attributes the original Sub2API provider-support commit to this contributor, in addition to the current focused UI update. (role: original provider contributor; confidence: high; commits: bf92f4ab8f3a, 14e1cb693f89; files: Sources/CodexBarCore/Resources/Plugins/sub2api.js, Tests/CodexBarTests/Sub2APIMenuCardModelTests.swift)

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 (4 earlier review cycles)
  • reviewed 2026-08-10T07:38:07.877Z sha 14e1cb6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T08:12:00.273Z sha ea0dcdc :: needs real behavior proof before merge. :: [P2] Match the zh-Hans Today assertion to the resource
  • reviewed 2026-08-10T08:36:22.909Z sha acd2ce2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T09:06:33.098Z sha acd2ce2 :: needs real behavior proof before merge. :: none

@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: 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".

Comment on lines +474 to +475
} else if input.provider == .sub2api {
"Weekly"

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 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 clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Aug 10, 2026
@steipete

Copy link
Copy Markdown
Owner

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 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 proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 10, 2026
@steipete
steipete merged commit abad945 into steipete:main Aug 10, 2026
9 checks passed
@steipete

Copy link
Copy Markdown
Owner

Landed on main as abad945bc07ff356d66b90d9a7195b60f6a6ccf1.

Tested:

  • CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --filter Sub2APIMenuCardModelTests — 4 tests passed.
  • CODEXBAR_SUPPRESS_TEST_KEYCHAIN_ACCESS=1 swift test --filter ProviderArchitectureGatekeeperTests — 38 tests passed.
  • make check — passed after the final current-main/changelog update.
  • Developer-ID-signed debug bundles for pinned before/after revisions were run against the same loopback-only synthetic Sub2API response; the PR body contains the sanitized native composited-menu captures. They exercise bundled sub2api.jsUsageStoreUsageMenuCardView.Model → the real menu window and show the grouped rows without clipping.
  • Final structured autoreview against origin/main — secret scan clean; no accepted/actionable findings.
  • Exact-head CI run https://github.com/steipete/CodexBar/actions/runs/31374144153 — all 9 checks passed, including lint, both macOS test shards, Linux glibc ARM64/x86_64, Linux musl, aggregate check, and GitGuardian.

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.

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. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants