add hybrid calculator refactor and comprehensive billing test suite
Move planner financial model from client-side JS to server-side Python (calculator.py + /planner/calculate endpoint). Add full test coverage: 227 calculator tests and 371 billing tests covering SQL helpers, webhooks, routes, and subscription gating with Hypothesis fuzzing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
28
CHANGELOG.md
Normal file
28
CHANGELOG.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
- Server-side financial calculator (`planner/calculator.py`) — ported JS `calc()`, `pmt()`, `calcIRR()` to Python so the full financial model is no longer exposed in client-side JavaScript
|
||||
- `POST /planner/calculate` endpoint for server-side computation
|
||||
- Pre-computed initial data (`window.__PADELNOMICS_INITIAL_D__`) injected on page load for instant first render
|
||||
- Debounced API fetch pattern in `planner.js` with `AbortController` for in-flight request cancellation
|
||||
- Computing indicator CSS (`.planner-app--computing`) with subtle "computing..." text
|
||||
- Comprehensive test suite for calculator (`tests/test_calculator.py` — 227 tests) covering all 4 venue/ownership combos, edge cases, and Hypothesis property-based fuzzing
|
||||
- Comprehensive billing test suite (371 tests total):
|
||||
- `tests/conftest.py` — shared fixtures (DB, app, clients, subscriptions, webhook helpers)
|
||||
- `tests/test_billing_helpers.py` — unit tests for SQL helpers, feature/limit access, plan determination (60+ tests + parameterized + Hypothesis)
|
||||
- `tests/test_billing_webhooks.py` — integration tests for LemonSqueezy webhooks (signature verification, all lifecycle events, Hypothesis fuzzing)
|
||||
- `tests/test_billing_routes.py` — route tests (pricing, checkout, manage, cancel, resume, subscription_required decorator)
|
||||
- Added `hypothesis>=6.100.0` and `respx>=0.22.0` to dev dependencies for property-based testing and httpx mocking
|
||||
- **Factored into Copier template** — all billing tests now generate as `.jinja` templates with provider-specific conditionals for Stripe, Paddle, and LemonSqueezy at `/var/home/Deeman/Projects/materia_saas_boilerplate/{{project_slug}}/tests/`
|
||||
|
||||
### Changed
|
||||
- `planner.js` no longer contains `calc()`, `pmt()`, or `calcIRR()` functions — computation moved server-side
|
||||
- `render()` split into `render()` (tab switching + schedule calc) and `renderWith(d)` (DOM updates from data)
|
||||
- Tab switching now renders from `_lastD` cache (instant, no API call)
|
||||
- Slider input triggers 200ms debounced server call instead of synchronous client-side calc
|
||||
Reference in New Issue
Block a user