feat(prices): balance.service prices section + rate-limit + tests (#156) #166

Merged
maximus merged 1 commit from issue-156-balance-service-prices into main 2026-04-28 01:32:42 +00:00
Owner

Summary

  • New prices namespace export on balance.service.ts
  • Local rate-limit (1 request / 2s), in-flight dedup, exponential backoff (2/4/8s, max 3 retries on 5xx-class errors), no retry on 401/403/404/429, hard 100/session cap
  • Annexe B i18n mapping wired (PriceError → balance.priceFetching.errors.* keys)
  • 9 vitest tests with vi.useFakeTimers() — happy, auth/premium/404 no-retry, 429 no-retry, 5xx retries, dedup, pacing, session cap

Test plan

  • npx tsc --noEmit clean
  • npx vitest run src/services/balance.service.test.ts — 94/94 green (existing 85 + 9 new)
  • No external test libs — only vi.fn() on invoke

Depends on Rust side from #155 PR (string-based invoke; this PR works in isolation against mocked invoke).

Closes #156

Generated autonomously by /autopilot run of 2026-04-27

## Summary - New `prices` namespace export on `balance.service.ts` - Local rate-limit (1 request / 2s), in-flight dedup, exponential backoff (2/4/8s, max 3 retries on 5xx-class errors), no retry on 401/403/404/429, hard 100/session cap - Annexe B i18n mapping wired (PriceError → `balance.priceFetching.errors.*` keys) - 9 vitest tests with `vi.useFakeTimers()` — happy, auth/premium/404 no-retry, 429 no-retry, 5xx retries, dedup, pacing, session cap ## Test plan - [x] `npx tsc --noEmit` clean - [x] `npx vitest run src/services/balance.service.test.ts` — 94/94 green (existing 85 + 9 new) - [x] No external test libs — only `vi.fn()` on invoke Depends on Rust side from #155 PR (string-based invoke; this PR works in isolation against mocked invoke). Closes #156 Generated autonomously by /autopilot run of 2026-04-27
maximus added 1 commit 2026-04-27 12:28:37 +00:00
feat(prices): balance.service prices section with rate-limit + dedup + retries
All checks were successful
PR Check / rust (push) Successful in 27m27s
PR Check / frontend (push) Successful in 2m49s
PR Check / rust (pull_request) Successful in 28m58s
PR Check / frontend (pull_request) Successful in 2m57s
920f81fce5
- prices.fetchPrice wraps invoke('fetch_price', ...) with local rate-limit (1/2s), in-flight dedup, exp backoff on 5xx (2/4/8s, max 3 retries), no retry on 4xx/429, hard 100/session cap
- 9 vitest tests with vi.useFakeTimers() (happy, 401/403/404, 429 no-retry, 5xx retries, dedup, pacing, session cap)
- Annexe B i18n mapping wired (PriceError → balance.priceFetching.errors.* keys)
- Session cap checked before rate-limit/dedup; failures do not consume budget (MEDIUM decision)

Closes #156

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
maximus added the
autopilot:pending-human
status:approved
type:feature
labels 2026-04-27 12:28:44 +00:00
maximus merged commit 97f91f87aa into main 2026-04-28 01:32:42 +00:00
maximus deleted branch issue-156-balance-service-prices 2026-04-28 01:32:42 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: maximus/Simpl-Resultat#166
No description provided.