Skip to content

fix(web): mobile layout pass, a phone funds cue and a spend ledger that reconciles - #84

Merged
PastaPastaPasta merged 2 commits into
masterfrom
fix/web-mobile-layout
Sep 27, 2026
Merged

PastaPastaPasta merged 2 commits into
masterfrom
fix/web-mobile-layout

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Owner

Summary

This PR makes Forge usable on phones and tablets. It fixes D-043 (no funds cue on phones) and D-044 (the spend ledger had no per-repo totals and was missing Forge's own key updates).

1. Mobile layout pass (Chromium, WebKit and Firefox)

Tap targets:

  • Every visible control is at least 44×44 CSS px on touch screens.
  • A new Tailwind coarse: variant (@media (pointer: coarse)) does the sizing, so desktop (fine pointer) keeps its dense sizes. I measured the desktop controls before and after, and they are identical.
  • A hit-area utility (touch only) adds an invisible 44 px ::after box to small chips and standalone text links: identity pills, OIDs, footer links, tag names. It enlarges the tap area without drawing anything bigger.
  • Where a clipping card would cut that box off, the row itself grows instead: card headers with author pills, diff file headers, ref rows and spend rows.
  • The Button and Input primitives get touch sizes. Inputs also get 16 px text on touch, so iOS Safari no longer zooms into a field when it takes focus.

Header:

  • The icon buttons are 44 px on touch.
  • On phones the devnet badge reads DEVNET (the full name stays in its title), the account button shows only the avatar, and the New chevron is hidden.
  • The bar still fits 320 px.

Repo tab strip (it used to be clipped on phones):

  • It now scrolls sideways with the scrollbar hidden.
  • The active tab stays in view, adjusted by scrolling the strip only, never the page.
  • An edge fade marks the side that has more tabs.
  • Every tab is reachable and 44 px tall.

PR page:

  • Diffs are unified on phones even when a split preference is saved. This was already true through useMinWidth(1024); the spec now pins it.
  • Inline review threads stay within the screen width (a sticky 100cqw box).
  • On touch, the review flow is all 44 px: the collapse control, the file list, the diff toggles, the inline composer, Approve / Request changes, and new PR.

Also covered:

Two kinds of target are exempt, and both are marked data-tap-exempt with a code comment:

  • Per-line comment buttons in the diff gutter. A 44 px row per code line would halve how much of the diff a phone shows, so the whole gutter cell is the target.
  • Links inside Markdown and other prose, under the WCAG 2.5.8 inline exception.

2. D-043: funds cue on phones and the low-balance banner (ux-dx-spec.md §4)

  • The funds pill was hidden sm:flex. On a phone it now appears as a 44 px wallet icon with a dot in the level's colour (amber when low, red when empty), only when funds are low or empty, and it opens the top-up sheet.
  • A new LowFundsBanner shows below the header at every width. It names the specific fix (Top up, or Renew key for a key that is low, expiring or spent) and can be dismissed once per state per session. The copy comes from fundsNotice() in lib/view/funds.ts.

3. D-044: spend ledger

  • Settings → Spend now shows per-repo totals, with repo names read from Platform and the repo id as a fallback. The four-column table is now stacked rows that read at 320 px, and a ledger read error is shown as an error rather than as "no writes".
  • Forge's own identity updates now go into the ledger with kinds key:register, key:renew, key:topup, key:revoke, key:encryption and identity:create. They cover importIdentity, topUpKey, revokeStored, encryption-key registration in Settings → Keys, the create-identity flow, and its resume path.
    • AuthController.charged() reads the balance, sends the update and measures the change, all while it holds the identity's writer lock. A queued document write therefore cannot fold into the key's row.
    • The measurement works the same way as write.ts measureActual.
    • An update that sent nothing (a revoke of an already disabled key) is not recorded.
    • A failed update is recorded only if the balance moved.
    • Reconciliation therefore no longer counts Forge's own key updates as "unexplained".
  • Fees, checked against the pinned Platform source (v4.2.0-beta.4, 6c95cd8):
    • IdentityUpdate and IdentityKeyLimitsUpdate are metered (storage plus processing, no flat fee). The only constant is a 100,000-credit balance floor (state_transition_min_fees/v1.rs).
    • A key's budget is a cap, not an escrow, and a revoke refunds nothing.
    • IdentityCreate takes its fee from the asset lock, so its "before" balance is the lock's credit value (CREDITS_PER_DUFF = 1000).
    • Actual costs are measured, never assumed. Estimates come from moutai measurements (key register about 27.2M credits); revoke, encryption key and create show no estimate because they have not been measured yet.

Tests

  • e2e/mobile.spec.ts (new mobile project; add E2E_ALL_ENGINES=1 for the mobile-webkit and mobile-firefox projects). The default chromium project is unchanged and ignores this file.
    • On iPhone SE, Pixel 7 and iPad Mini, over repo, tree, commits, issues, PR, Explore and repo settings, it checks that nothing is wider than the screen and that every control is at least 44 px. The 44 px is measured including any hit area and after clipping by overflow:hidden ancestors.
    • The tabs are reachable, and the strip marks its hidden side.
    • The Platform-unreachable banner fits a phone.
    • A Pixel 7 gets a unified diff even with a saved split preference.
    • Signed in with a low balance (E2E_WRITE=1 E2E_MOBILE_LOW_ID=<identity file>), in both themes, the phone header shows the cue, the banner names the fix, the cue opens the sheet, and a dismissed banner stays gone.
  • Vitest:
    • lib/auth/key-spend.test.ts: register, renew, top-up and revoke each report the measured balance change; the measurement happens before a queued write runs; refused updates and revokes that sent nothing are not recorded; chargedUpdate records an encryption key; the recorded rows reconcile with 0 unexplained.
    • spendKindLabel
    • fundsNotice in lib/view/funds.test.ts
  • Fails before, passes after:
    • On master, the mobile spec fails every layout test: 6,404 undersized targets over the audited matrix, the Releases tab 31 px off screen, and inline threads 590 px wide on a 412 px phone.
    • On master, the new vitest cases fail (setSpendListener, fundsNotice and spendKindLabel do not exist).
    • On this branch, all pass.
  • Results on this branch:
    • pnpm typecheck, pnpm lint and pnpm test pass (1641 tests).
    • Mobile spec: Chromium 26/26 (including the signed-in tests in both themes), Firefox 21/21, WebKit 21/21. The signed-in tests were skipped in Firefox and WebKit, and two WebKit tests passed only on a re-run after DAPI read timeouts.
    • The desktop specs v2-reads, v2-home, a11y (both themes) and keyboard-theme pass, 71/71.

Live QA (devnet moutai)

  • Route audit script (every a, button, input, select, [role=button] and summary on screen gets its box measured, including hit areas and clipping):
    • Coverage: 24 routes (repo home, tree, blob, commits, commit, branches, tags, issues, issue, PR list, PR page, new PR, stargazers, repo settings, releases, release, Explore, profile, notifications, login, new repo, settings, storage wizard), on iPhone SE, iPhone 13, Pixel 7 and iPad Mini, in both themes.
    • Before: 6,404 undersized targets (Chromium).
    • After: 0, with no horizontal overflow and no off-screen controls. The same holds in WebKit and Firefox.
  • Signed in on an iPhone SE with a newly minted low-balance identity (not a fixture identity):
    • The cue and the banner both show.
    • Settings → Spend records the key registration at its measured 0.000272 DASH, and reconciliation shows "0 DASH unexplained".
    • The PR review flow works on the phone: a tap on a line number opens the inline composer, and the composer, Approve, Request changes and new-PR create buttons are all 44 px.

Evidence (before/after pairs named <route>--<device>--<theme>--<engine>.png, plus the audit data and scripts): dash-forge-qa/evidence/impl/ui-pass/mobile/.

Review

The code-review-validator found no blockers. I fixed its medium findings:

  • Measure inside the writer lock, and only record updates that were actually sent.
  • Record encryption-key registration.
  • Stop hit areas from being clipped, and make the spec check for clipping.
  • Scroll only the tab strip.

I also fixed its low findings: banner dismissals per state, the gap in the commit meta row, and parallel repo-name reads.

Deferred to a follow-up: shortening how long the writer lock is held during a key registration's read-back verify. That wait was already there on master; this PR only adds the ~1–8 s balance measurement.

Notes

Fixes D-043, D-044.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0b14b814-90d9-481a-afaa-ef22f7c01a0d

📥 Commits

Reviewing files that changed from the base of the PR and between 8d48372 and 5c189a4.

📒 Files selected for processing (59)
  • forge-web/app/explore/page.tsx
  • forge-web/app/page.tsx
  • forge-web/app/settings/page.tsx
  • forge-web/app/settings/storage/page.tsx
  • forge-web/components/app-footer.tsx
  • forge-web/components/app-header.tsx
  • forge-web/components/app-shell.tsx
  • forge-web/components/auth/create-identity-flow.tsx
  • forge-web/components/auth/wallet-connect-flow.tsx
  • forge-web/components/author.tsx
  • forge-web/components/encryption-key-panel.tsx
  • forge-web/components/funds-pill.tsx
  • forge-web/components/login-modal.tsx
  • forge-web/components/low-funds-banner.tsx
  • forge-web/components/markdown-view.tsx
  • forge-web/components/repo-card.tsx
  • forge-web/components/repo/blob-content.tsx
  • forge-web/components/repo/clone-box.tsx
  • forge-web/components/repo/commit-content.tsx
  • forge-web/components/repo/commits-content.tsx
  • forge-web/components/repo/diff-view.tsx
  • forge-web/components/repo/file-list.tsx
  • forge-web/components/repo/inline-comments.tsx
  • forge-web/components/repo/issue-content.tsx
  • forge-web/components/repo/issues-content.tsx
  • forge-web/components/repo/new-pull-content.tsx
  • forge-web/components/repo/path-breadcrumb.tsx
  • forge-web/components/repo/pull-content.tsx
  • forge-web/components/repo/pulls-content.tsx
  • forge-web/components/repo/ref-list-content.tsx
  • forge-web/components/repo/ref-switcher.tsx
  • forge-web/components/repo/releases-content.tsx
  • forge-web/components/repo/repo-header.tsx
  • forge-web/components/repo/repo-home-content.tsx
  • forge-web/components/repo/repo-rail.tsx
  • forge-web/components/repo/repo-settings-sections.tsx
  • forge-web/components/repo/timeline.tsx
  • forge-web/components/spend-panel.tsx
  • forge-web/components/storage/repo-storage-policy.tsx
  • forge-web/components/ui/button.tsx
  • forge-web/components/ui/copy-link.tsx
  • forge-web/components/ui/copy-row.tsx
  • forge-web/components/ui/input.tsx
  • forge-web/components/ui/network-badge.tsx
  • forge-web/components/ui/oid.tsx
  • forge-web/components/ui/platform-status.tsx
  • forge-web/contexts/auth-context.tsx
  • forge-web/e2e/mobile.spec.ts
  • forge-web/lib/auth/controller.ts
  • forge-web/lib/auth/create-identity.ts
  • forge-web/lib/auth/key-spend.test.ts
  • forge-web/lib/auth/limited-key.ts
  • forge-web/lib/sdk/cost.ts
  • forge-web/lib/sdk/index.ts
  • forge-web/lib/spend.ts
  • forge-web/lib/view/funds.test.ts
  • forge-web/lib/view/funds.ts
  • forge-web/playwright.config.ts
  • forge-web/tailwind.config.js

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…at reconciles

Every visible control is at least 44x44 CSS px on touch screens (a coarse: Tailwind variant and a touch-only hit-area utility), with no horizontal overflow, on iPhone SE, iPhone 13, Pixel 7 and iPad in both themes and three engines; desktop sizes are unchanged. The repo tab strip scrolls with an edge fade and keeps the active tab in view; PR diffs stay unified on phones and inline threads fit the screen.

D-043: phones show the low/empty funds cue as a 44 px wallet icon, and a dismissible low-balance banner (once per state per session) names the fix: top up or renew the key.

D-044: Settings -> Spend shows per-repo totals and reads on a 320 px phone. Key register, renew, top-up and revoke, encryption-key registration and identity creation are recorded with the balance change measured inside the writer lock, so reconciliation no longer counts Forge's own key updates as unexplained.

Tests: e2e/mobile.spec.ts (mobile project; mobile-webkit and mobile-firefox with E2E_ALL_ENGINES=1), lib/auth/key-spend.test.ts, fundsNotice cases in lib/view/funds.test.ts.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…s min-height on select)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@PastaPastaPasta
PastaPastaPasta merged commit 8eae3c0 into master Sep 27, 2026
5 checks passed
PastaPastaPasta added a commit that referenced this pull request Sep 27, 2026
Carries #84's coarse-pointer touch targets onto the F-1 issue list tabs, issue body header and timeline cards.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant