Skip to content

Lead the shared usage card with spend - #3704

Open
Chipagosfinest wants to merge 9 commits into
steipete:mainfrom
Chipagosfinest:fix/share-card-layout
Open

Chipagosfinest wants to merge 9 commits into
steipete:mainfrom
Chipagosfinest:fix/share-card-layout

Conversation

@Chipagosfinest

@Chipagosfinest Chipagosfinest commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Scope note: the singular-caption fix that started here landed separately in #3706, so this PR is now
purely the presentation change.

Before / after

Sparse card — 1 subscription, no model history:

Before After
before sparse after sparse

Dense card — 5 subscriptions, 3 models, ~$123,456.78:

Before After
before dense after dense

Multi-currency — 3 currencies:

Before After
before multi after multi

What changed

Before After
Hero token count at 104pt; spend at 32pt on the right spend at 76pt; tokens at 42pt supporting
Baselines two independently-spaced columns, labels on different lines one HStack, same label / value / detail rhythm
"local / aggregate" stated 4x: badge, "native currencies kept separate", "Only aggregate usage…", footer stated once, in the footer
Header badge LOCAL SNAPSHOT (duplicated the footer) removed
Empty models column a sentence floating at the top of the column a row-shaped empty state matching the real rows
Secondary currencies a bare "+N more" pointer explicit per-currency totals via ShareStatsFormatting.spendCoverage

Card size stays 1200x630 — it is an OG image and the ratio is load-bearing.

What the renders settled

Dense fits. The 286pt rankings reservation is load-bearing. An earlier revision of this branch
removed it, and since SwiftUI does not clip an oversize frame, five provider rows plus three model
rows would have pushed the footer out of the image. Restored, alignment only.

The hero no longer scales. ~$123,456.78 renders unscaled at 76pt. At the original 104pt it
needed roughly 660-780pt against 654pt of available width (1200 - 104 padding - 52 spacing - 390 right column), so the headline would have silently shrunk on realistic values. The 104pt slot
previously held compactCount output, at most six characters, so it never exercised
minimumScaleFactor.

Two of my own earlier choices were wrong, and the renders caught both. Centring the rankings
split the sparse card's empty space and put a gap under the divider that reads as a fault; top
alignment leaves one contiguous region that reads as absent content. And replacing LOCAL SNAPSHOT
with the period label put 30 DAYS directly above EST. 30-DAY SPEND — one redundancy traded for
another, so the badge is gone entirely.

Method, and its limit

ShareStatsCardView is a pure function of ShareStatsPayload, so these were produced by compiling
the view verbatim alongside the payload types and ShareStatsFormatting from each revision and
rendering through ImageRenderer at the card's own size. Only UsageFormatter.currencyString and
SpendDashboardSource.scanDays are stubbed, neither of which affects layout. Method and payloads are
recorded in docs/research/share-card-layout.md.

These are not production-bundle renders — the app was not built for them. The view code is
identical to this branch so layout and typography are faithful, but if you want output from a signed
build before merging, say so and I will produce it.

Tests

  • spend coverage preserves secondary currency when subscriptions overflow — single, dual and
    triple-currency cases pinning the exact coverage string.
  • The caption pluralisation test now comes from main via fix(share): use singular subscription captions #3706; the duplicate here was dropped.
  • All 400 ProviderArchitectureGatekeeperTests line anchors re-verified: zero stale.

…al disclaimer

The shared snapshot set the token count at 104pt and the spend figure at 32pt,
so the least meaningful number was the hero and the reason the card exists was
secondary. The two hero columns were also spaced independently, leaving their
labels on different baselines.

Spend now leads, tokens support it, and both columns run the same
label / value / detail rhythm. The card said it was local and aggregate four
separate times; the LOCAL SNAPSHOT badge and the aggregate sentence are gone and
the footer keeps the claim. The rankings block no longer reserves a fixed 286pt,
so a sparse snapshot centres instead of leaving a void above the footer, and the
empty model column reads as a row rather than an apology.

Also fixes a plural bug: the most common card there is rendered
"1 subscriptions".
@clawsweeper

clawsweeper Bot commented Sep 17, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. 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. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed September 21, 2026, 7:08 PM ET / 23:08 UTC (Revision 10).

ClawSweeper review

What this changes

The PR makes estimated spend the shared card’s headline, simplifies supporting text, and adds currency-formatting coverage and native layout renders.

Merge readiness

Needs changes before merge - 2 items remain

The presentation proposal remains distinct from the merged caption fix. The new production-render images resolve the earlier visual-proof gap; one minor documentation defect remains.

Priority: P3
Reviewed head: 90ccfcbfe478c05c0189301641568330480fb147

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused presentation patch with convincing native visual output and one small, repairable documentation defect.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The three inspected native PNGs exercise ShareStatsCardView through the production NSHostingView PNG renderer used by save/copy export and visibly show readable sparse, dense, and multi-currency layouts with intact footers. This closes the earlier renderer gap for the visual change; tests alone are supplemental, and these artifacts do not claim a full application workflow run.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The three inspected native PNGs exercise ShareStatsCardView through the production NSHostingView PNG renderer used by save/copy export and visibly show readable sparse, dense, and multi-currency layouts with intact footers. This closes the earlier renderer gap for the visual change; tests alone are supplemental, and these artifacts do not claim a full application workflow run.
Evidence reviewed 8 items Introduced scope: Reviewed the pinned merge-base-to-head changes: two production Swift files, two test files, one research document, and nine PNGs. Production changes are confined to presentation and currency-caption formatting.
Still distinct on main and in the latest release: The fetched main revision and v0.64.0 source both retain the token-first headline and LOCAL SNAPSHOT badge. The spend-first presentation is therefore still absent from both inspected versions.
Owner explicitly preserved the presentation proposal: The owner’s comment confirms that #3706 extracted only the singular-caption correction and left this presentation proposal open. The merged commit likewise says it preserves the existing layout.
Findings 1 actionable finding [P3] [P3] Correct the production-render image links
Security None None.

How this fits together

CodexBar turns aggregate provider usage and spend into a shareable image. The changed card view consumes that prepared data and feeds the native PNG renderer used by image export and clipboard copying.

flowchart LR
    A[Provider usage and spend] --> B[Aggregate sharing data]
    B --> C[Currency captions]
    B --> D[Shared card layout]
    C --> D
    D --> E[Native PNG renderer]
    E --> F[Save image or copy image]
Loading

Before merge

  • [P3] Correct the production-render image links (P3) - These relative URLs resolve to docs/research/assets/production-*.png, but the committed images live in docs/research/share-card-layout/assets/. Consequently, none of the three production-proof images displays when readers open this document. Use share-card-layout/assets/production-*.png so the newly supplied proof is accessible.
  • Complete next step (P2) - Correct the three production-image links in docs/research/share-card-layout.md.

Findings

  • [P3] [P3] Correct the production-render image links — docs/research/share-card-layout.md:51
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test changes Production +75/−48 lines; tests +253/−0 lines The net 27-line production increase supports the stated layout and currency-caption changes; test growth mostly supplies three native rendering fixtures.

Technical review

Best possible solution:

Keep the presentation change focused on the existing card and renderer, with working links to its inspected native output.

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

Yes, for the remaining documentation defect: resolving the three relative image URLs against the document directory points to nonexistent files. The layout proposal itself is not a reported runtime bug.

Is this the best way to solve the issue?

Yes: reusing the existing card and native exporter is a focused approach, and the inspected renders support the layout; only the proof-document paths need correction.

Full review comments:

  • [P3] [P3] Correct the production-render image links — docs/research/share-card-layout.md:51
    These relative URLs resolve to docs/research/assets/production-*.png, but the committed images live in docs/research/share-card-layout/assets/. Consequently, none of the three production-proof images displays when readers open this document. Use share-card-layout/assets/production-*.png so the newly supplied proof is accessible.
    Confidence: 1

Overall correctness: patch is correct
Overall confidence: 0.92

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b99a91694d78.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The three inspected native PNGs exercise ShareStatsCardView through the production NSHostingView PNG renderer used by save/copy export and visibly show readable sparse, dense, and multi-currency layouts with intact footers. This closes the earlier renderer gap for the visual change; tests alone are supplemental, and these artifacts do not claim a full application workflow run.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The three inspected native PNGs exercise ShareStatsCardView through the production NSHostingView PNG renderer used by save/copy export and visibly show readable sparse, dense, and multi-currency layouts with intact footers. This closes the earlier renderer gap for the visual change; tests alone are supplemental, and these artifacts do not claim a full application workflow run.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: This is a bounded presentation improvement with one minor documentation-link defect and no identified runtime regression.
  • 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): The three inspected native PNGs exercise ShareStatsCardView through the production NSHostingView PNG renderer used by save/copy export and visibly show readable sparse, dense, and multi-currency layouts with intact footers. This closes the earlier renderer gap for the visual change; tests alone are supplemental, and these artifacts do not claim a full application workflow run.
  • proof: sufficient: Contributor real behavior proof is sufficient. The three inspected native PNGs exercise ShareStatsCardView through the production NSHostingView PNG renderer used by save/copy export and visibly show readable sparse, dense, and multi-currency layouts with intact footers. This closes the earlier renderer gap for the visual change; tests alone are supplemental, and these artifacts do not claim a full application workflow run.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The three inspected native PNGs exercise ShareStatsCardView through the production NSHostingView PNG renderer used by save/copy export and visibly show readable sparse, dense, and multi-currency layouts with intact footers. This closes the earlier renderer gap for the visual change; tests alone are supplemental, and these artifacts do not claim a full application workflow run.

Evidence

Acceptance criteria:

  • [P1] git ls-files docs/research/share-card-layout/assets/production-sparse.png docs/research/share-card-layout/assets/production-dense.png docs/research/share-card-layout/assets/production-multi.png.
  • [P1] git diff --check.
  • [P1] Verify all three Markdown image URLs resolve relative to docs/research/share-card-layout.md.

What I checked:

  • Introduced scope: Reviewed the pinned merge-base-to-head changes: two production Swift files, two test files, one research document, and nine PNGs. Production changes are confined to presentation and currency-caption formatting. (Sources/CodexBar/ShareStatsCardView.swift:61, 90ccfcbfe478)
  • Still distinct on main and in the latest release: The fetched main revision and v0.64.0 source both retain the token-first headline and LOCAL SNAPSHOT badge. The spend-first presentation is therefore still absent from both inspected versions. (Sources/CodexBar/ShareStatsCardView.swift:70, b99a91694d78)
  • Owner explicitly preserved the presentation proposal: The owner’s comment confirms that fix(share): use singular subscription captions #3706 extracted only the singular-caption correction and left this presentation proposal open. The merged commit likewise says it preserves the existing layout. (1239617059f7)
  • Production rendering proof inspected: Inspected all three committed production PNGs directly. Sparse, dense, and three-currency cards show readable totals, complete rows, and intact footers. The new harness imports CodexBar and calls ShareStatsRenderer.pngData, whose NSHostingView path is also called by saveImage and copyImage. These observed native artifacts resolve the earlier standalone ImageRenderer limitation for this presentation-only change; the byte-count assertion alone would not. (Tests/CodexBarTests/ShareStatsLayoutProductionRenderTests.swift:30, 90ccfcbfe478)
  • Broken production-proof links: The document links assets/production-*.png, which resolves under docs/research/assets/. The actual tracked images are under docs/research/share-card-layout/assets/. All three new image links therefore miss their targets. (docs/research/share-card-layout.md:51, 90ccfcbfe478)
  • Re-review continuity: The production view, formatting helper, and existing sharing tests are unchanged since the previously reviewed head. The prior currency-total, initializer-order, and missing-brace findings remain resolved. The broken documentation links were added with the new proof commit. (docs/research/share-card-layout.md:51, 90ccfcbfe478)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rank-up moves

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

  • Correct the three relative image paths so reviewers can see the production renders from the proof document.

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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-17T03:39:21.144Z sha 22ccc4f :: needs real behavior proof before merge. :: [P2] Pass currency fixture arguments in initializer order
  • reviewed 2026-09-17T03:46:02.240Z sha da46eb6 :: needs real behavior proof before merge. :: [P2] Pass currency fixture arguments in initializer order
  • reviewed 2026-09-17T03:52:39.744Z sha 2e67e1a :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-17T03:56:09.820Z sha 2e67e1a :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-17T16:14:36.115Z sha 5e1218c :: needs real behavior proof before merge. :: [P2] [P2] Close the caption test before declaring the currency test
  • reviewed 2026-09-17T18:42:21.345Z sha 88cef38 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-17T19:00:11.055Z sha 88cef38 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-17T20:57:23.097Z sha 86dbe22 :: needs real behavior proof before merge. :: none

@Chipagosfinest

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 17, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Dropping the fixed rankings reservation removed the only guarantee that a dense
card fits 630pt. SwiftUI does not clip an oversize frame by default, so five
provider rows plus three model rows could have pushed the footer out of the
image. The reservation is back; the void this PR set out to fix came from
content hugging the top of that block, not from the block itself, so it now
centres inside it.

The 104pt slot previously held a compact token count (never more than six
characters, so it never scaled). It now holds a currency string: 654pt of
available width cannot fit "~$123,456.78" at 104pt, which would have silently
scaled the headline down. 76pt fits twelve characters unscaled and still reads
as dominant over the 42pt token count. The coverage line is pinned to one line
now that it carries explicit secondary-currency totals.
@Chipagosfinest

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 17, 2026

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@Chipagosfinest
Chipagosfinest marked this pull request as ready for review September 17, 2026 03:48
@Chipagosfinest

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 17, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. and removed P2 Normal priority bug or improvement with limited blast radius. labels Sep 17, 2026
steipete added a commit that referenced this pull request Sep 17, 2026
Correct the one-subscription caption while preserving the existing card layout, currency overflow text, totals and reporting date. Reuse the contributor's pluralization helper and cover zero, one and multiple subscription counts.

Related to #3704. Validated with 58 sharing/architecture tests, synthetic before/after production renders, make check and clean P2 review.

Co-authored-by: Alec Gutman <44984861+Chipagosfinest@users.noreply.github.com>
@steipete

Copy link
Copy Markdown
Owner

The singular subscription caption correction has landed in #3706, with 58 focused tests, green macOS/Linux CI, and inspected before/after production renders. The card now says “1 subscription” for a single included subscription.

This PR remains open for the larger presentation proposal. Thanks for contributing the formatter and identifying the caption issue.

steipete extracted the plural fix from this PR and shipped it as steipete#3706, so the
helper and its test now come from main; our duplicates are dropped. What
remains here is the layout work: spend leads the hero, the local/aggregate
disclaimer is stated once, the rankings block centres inside its reservation,
and secondary currency totals stay explicit via spendCoverage.
@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Sep 17, 2026
…d badge

Rendering the card at 1200x630 across sparse, dense and multi-currency payloads
showed two problems with earlier revisions of this branch.

Centring the rankings inside its reservation split the empty space on a sparse
card and left a gap directly under the divider, reading as a layout fault rather
than as absent content. Top alignment keeps one contiguous region below the
content.

Replacing the LOCAL SNAPSHOT badge with the period label put "30 DAYS" directly
above "EST. 30-DAY SPEND". The badge is removed instead, since the footer
already carries the local/aggregate claim and the spend label already carries the
period. periodLabel is now unused and removed with it.

Renders and method are recorded in docs/research/share-card-layout.md.
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 17, 2026
@Chipagosfinest

Copy link
Copy Markdown
Contributor Author

Cross-link: #3747 keeps retained top-model families on the shared card when a sibling USD provider is unpriced (the empty TOP MODELS column on current 0.61.0). Independent of this spend-first layout. Verified against installed 0.61.0.

@clawsweeper this is a related ranking fix, not a substitute for the layout proof here.

… path

ClawSweeper flagged the existing layout proof (docs/research/share-card-layout.md)
as a standalone ImageRenderer harness, not the app's actual exporter. Add
ShareStatsLayoutProductionRenderTests, which renders the same sparse/dense/multi
payloads through ShareStatsRenderer.pngData — the literal NSHostingView path
ShareStatsExporter.saveImage/copyImage use in production — and commit the
resulting PNGs.
@Chipagosfinest

Chipagosfinest commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Added production-path proof: Tests/CodexBarTests/ShareStatsLayoutProductionRenderTests.swift renders the sparse/dense/multi payloads through ShareStatsRenderer.pngData (NSHostingView) — the literal path ShareStatsExporter.saveImage/copyImage use in production — instead of the standalone ImageRenderer harness docs/research/share-card-layout.md already disclaimed as non-production. Each PNG is asserted non-trivial (> 10_000 bytes) so the test fails if the frame ever renders blank/degenerate, and the resulting images are committed under docs/research/share-card-layout/assets/production-*.png plus linked from the doc.

@clawsweeper re-review — this should close the outstanding proof gap.

@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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 status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 21, 2026
ClawSweeper caught it: the links used assets/production-*.png, which
resolves relative to docs/research/ (where the doc lives), but the
committed images are at docs/research/share-card-layout/assets/.
@Chipagosfinest

Copy link
Copy Markdown
Contributor Author

Fixed the broken image links — docs/research/share-card-layout.md was linking assets/production-*.png, which resolves relative to docs/research/ (where the doc lives), not docs/research/share-card-layout/ where the images actually landed. Corrected to share-card-layout/assets/production-*.png and verified all three resolve on disk.

@clawsweeper re-review

This branch has not been deployed

No deployments
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