Fix spending-limits usage & persistence, wire shell i18n, run e2e in CI - #737
Merged
Jambox11 merged 2 commits intoAug 29, 2026
Merged
Conversation
Closes mux-labs#648, mux-labs#649, mux-labs#650, mux-labs#651. mux-labs#648 — Compute spending-limits todayUsage from real activity - Add getBackendApiBaseUrl() (reads server-only MUX_BACKEND_URL); the production /api/spending-limits proxy imported it but it did not exist, so the route threw at runtime. Register MUX_BACKEND_URL in env schema and .env.example. - /api/demo/spending-limits no longer returns a hardcoded todayUsage: 750. It derives the figure from the mock transaction store via the new computeTodayUsage() helper (sum of completed transaction amounts on the latest day). The real route already gets todayUsage straight from mux-backend. mux-labs#649 — Stop writing spending limits to localStorage as account state - SpendingLimitsCard no longer reads or writes the "spending-limits" localStorage key. Limits are account state owned by the backend; a per-browser copy is wrong for a second device or a shared machine. - On a failed load it shows an explicit error plus clearly-labelled default limits (no silent cache fallback). todayUsage starts at 0 instead of a fabricated 750 placeholder. mux-labs#650 — Consume shellLabels in Sidebar and TopNav - Sidebar nav items and TopNav (network switcher labels, page-title map, breadcrumb "Home", sign-out label) now source copy from src/lib/i18n/shellLabels.ts. Added nav.users and header.breadcrumbHome; header.logout set to the existing visible text ("Sign out"). - Repaired the pre-existing broken Sidebar.test.tsx (missing useRouter mock / imports) so the suite runs again. mux-labs#651 — Run Playwright e2e in CI - Add an e2e-tests job to .github/workflows/ci.yml that installs Chromium and runs `pnpm run test:e2e` against the in-repo mock API routes. - tests/ci-workflow.test.ts guards the job so it can't silently regress. Docs: README env table + smoke-tests section, docs/frontend-env-vars.md, src/docs/API_Hooks.md updated to match. Note: pre-existing typecheck errors in APIKeyModal.tsx / ApiKeysTable.tsx and unrelated failing route tests on staging are untouched by this branch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AnArGB2SYQdyydwngKE6qC
|
@synkijojo-byte Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #648, closes #649, closes #650, closes #651.
#648 — Compute spending-limits
todayUsagefrom real activitysrc/app/api/spending-limits/route.tsimportedgetBackendApiBaseUrlfrom@/lib/api/config, but that helper did not exist — the production proxy threw at runtime (tests passed only because they mock the whole module). AddedgetBackendApiBaseUrl()reading the server-onlyMUX_BACKEND_URL, normalised, returning""when unset so the route responds503instead of fabricating data. RegisteredMUX_BACKEND_URLinsrc/lib/env.tsand.env.example.src/app/api/demo/spending-limits/route.tsno longer returns a hardcodedtodayUsage: 750. It derives the figure from the mock transaction store via the newcomputeTodayUsage()(src/lib/spending-limits/todayUsage.ts) — the sum of completed transaction amounts on the latest day. The real route already getstodayUsagestraight frommux-backend(backend work is out of scope here).#649 — Stop writing spending limits to
localStorageas account stateSpendingLimitsCardno longer reads or writes thespending-limitslocalStoragekey. Limits are account state owned by the backend; a per-browser copy is wrong for a second device or a shared machine.todayUsagestarts at0rather than a fabricated750placeholder.#650 — Consume
shellLabelsin Sidebar and TopNavsrc/lib/i18n/shellLabels.ts. Addednav.usersandheader.breadcrumbHome;header.logoutset to the existing visible text ("Sign out") so no user-facing copy changes.Sidebar.test.tsx(missinguseRoutermock and imports) so the suite runs again.#651 — Run Playwright e2e in CI
e2e-testsjob to.github/workflows/ci.ymlthat installs Chromium and runspnpm run test:e2eagainst the in-repo mock API routes (NEXT_PUBLIC_API_URL="").tests/ci-workflow.test.tsguards the job so it cannot silently regress.Docs
README env table + smoke-tests section,
docs/frontend-env-vars.md, andsrc/docs/API_Hooks.mdupdated to match.Testing
pnpm exec vitest runover every touched file: 92 passed.stagingfor the touched directories: 0 new failures, 14 pre-existing failures fixed (the wholeSidebar.test.tsxsuite + one obsolete cache test).stagingis left untouched: parse errors inAPIKeyModal.tsx/ApiKeysTable.tsx(already noted inplaywright.config.ts) that block thetypecheckjob, and route tests failing on a missingisMockFallbackAllowedimport insrc/app/api/auth/login/route.ts.🤖 Generated with Claude Code