modified: make_post_sell/lib/crypto_watcher/__init__.py modified: make_post_sell/tests/test_double_spend_integration.py
4.5 KiB
Claude Development Notes
Project Setup
This project uses a Makefile for most development operations. Use make commands instead of running tools directly.
Common Development Tasks
Testing
- Run tests:
make test- This installs development dependencies and runs the test suite with py.test
- Tests are located in
make_post_sell/tests/
Installation & Setup
- Install from source for development:
make install-from-source - Install from PyPI:
make install-from-pypi - Initialize database:
make init-db
Development Server
- Start development server:
make serve- Runs with auto-reload enabled
- Uses
data/development.iniconfiguration
Environment Management
- Create virtual environment:
make venv - Clean up environment:
make clean - Activate environment:
source env/bin/activate
Code Structure
Key Directories
make_post_sell/views/- View controllersmake_post_sell/models/- Database modelsmake_post_sell/tests/- Test suite
Important Files
make_post_sell/views/cart.py- Cart and checkout logicdevelopment.ini- Configuration file
Testing Notes
The project uses pytest with unittest framework. There are three types of tests:
Test Types
- Unit tests (
test_models.py) - Test individual model methods and properties in isolation - Integration tests (
test_integration.py) - Test interactions between models and business logic - Functional tests (
test_functional.py) - End-to-end tests through the web interface
Running Tests
Before running tests: Source environment variables with source vars.sh to set required Stripe API keys and other configuration.
# Run all tests
make test
# Run specific test types
env/bin/py.test make_post_sell/tests/test_models.py # Unit tests
env/bin/py.test make_post_sell/tests/test_integration.py # Integration tests
env/bin/py.test make_post_sell/tests/test_functional.py # Functional tests
# Run with coverage
env/bin/py.test --cov=make_post_sell.models.cart --cov-report=term-missing make_post_sell/tests/test_models.py::TestCart
Current Coverage
- Cart model unit tests cover critical business logic like
requires_paymentthreshold (64 cents) - Integration tests verify the original AttributeError bug fix for free coupon checkout
- Functional tests provide end-to-end coverage of cart/checkout/payment flows
Database Location
The SQLite database is located at: data/make_post_sell.sqlite
CRITICAL WARNING: NEVER delete or remove database files without explicit user permission. The database contains production data and cannot be easily recovered. Always ask before any destructive operations.
MANDATORY: ALWAYS create a backup of the database before any database operations (migrations, schema changes, etc.):
cp data/make_post_sell.sqlite data/make_post_sell.sqlite.backup-$(date +%Y%m%d-%H%M%S)
Query crypto payments:
-- Note: Remove dashes from UUIDs when querying
SELECT * FROM mps_crypto_payment WHERE id = 'paymentuuidherewithoutdashes';
Common Issues and Solutions
UUID Objects
Always use uuid_str when you need a string copy of the identifier. Models inherit uuid_str property from RBase.
IMPORTANT: UUIDs are stored in the database WITHOUT dashes. When querying by ID, remove dashes from the UUID:
- Correct:
WHERE id = '0f92cd2a86f54dc1b98ef5c8b37bc7f8' - Wrong:
WHERE id = '0f92cd2a-86f5-4dc1-b98e-f5c8b37bc7f8'
Development Standards and Expectations
CRITICAL WORK ETHIC: The user pays significant money for development work and expects thorough, complete solutions. NEVER try to do the minimum or cut corners. When asked to implement features, provide comprehensive, production-ready implementations that consider all aspects of the request.
TESTING INTEGRITY: NEVER skip, delete, or disable unit tests or integration tests when they break. When tests fail:
- FIX THE TESTS - Update them to work with new functionality
- FIX THE CODE - If the tests reveal actual bugs, fix the underlying issue
- ADD MORE TESTS - Ensure new functionality is properly covered
Disabling or removing tests weakens the codebase and is unacceptable. Tests are critical safety nets that prevent regressions.
Commit Message Guidelines
CRITICAL: Do not include Claude Code attribution in commit messages. Attributing human work to Claude is inappropriate and misrepresents the actual authorship of the code. All code changes should be attributed to the human developer who reviewed, approved, and committed the work.