Commit Graph

59 Commits

Author SHA1 Message Date
cc32370d49 perf: speed up test suite with parallel execution
- Enable pytest-xdist with -n auto for parallel test execution
- Consolidate migrated_db fixture in conftest.py (was duplicated in 4 files)
- Remove local fixture definitions and unused imports from test files

Test execution: ~24s -> ~5s (~5x speedup)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 07:25:18 +00:00
262739d8ec feat: add event tables schema and models
Create migration for events, event_revisions, event_tombstones,
idempotency_nonces, and event_animals tables with ULID checks
and JSON validation. Add Pydantic models with field validators.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 21:37:19 +00:00
4579229734 feat: add repositories and reference data seeder
Implements Step 1.5: Creates ULID generation utility, repositories for
all reference types (species, locations, products, feed_types, users),
and an idempotent seeder that populates initial data. Updates CLI seed
command to run migrations and seed data.

Seed data:
- 3 users (ppetru, ines as admin; guest as recorder)
- 8 locations (Strip 1-4, Nursery 1-4)
- 3 species (duck, goose active; sheep inactive)
- 7 products (egg.duck, meat, offal, fat, bones, feathers, down)
- 3 feed types (starter, grower, layer - 20kg bags)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 19:40:55 +00:00
2e28827683 feat: add reference tables schema and Pydantic models
Implements Step 1.4: Creates migration for species, locations, products,
feed_types, and users tables with full CHECK constraints. Adds Pydantic
models with validation for all reference types including enums for
ProductUnit and UserRole.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 19:18:08 +00:00
7d7cd2bb57 feat: add migration framework with FastMigrate integration
- Add migrations.py with create_migration, run_migrations, get_db_version
- Implement CLI migrate and create-migration commands
- Use FastMigrate's sequential 0001-*.sql naming convention
- Add comprehensive unit, integration, and E2E tests (35 tests)
- Add fresh_db_path and temp_migrations_dir test fixtures

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 18:25:28 +00:00
d8910d6571 feat: add database module with connection factory and transactions
Implements Step 1.2:
- constants.py: END_OF_TIME_UTC = 32503680000000 (year 3000 sentinel)
- db.py: get_db() with pragmas (WAL, synchronous=FULL, foreign_keys, busy_timeout)
- db.py: transaction() context manager with BEGIN IMMEDIATE

Includes 12 TDD tests for pragmas, commit/rollback, and concurrent writes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:58:29 +00:00
61f704c68d feat: add config module with environment variable handling
Implements Step 1.1 config.py with Pydantic Settings:
- PORT (default 3366), DB_PATH, BASE_PATH
- AUTH_HEADER_NAME, TRUSTED_PROXY_IPS (comma-separated)
- CSRF_SECRET (required), CSRF_COOKIE_NAME
- SEED_ON_START, LOG_LEVEL (validated), METRICS_ENABLED

Includes 28 TDD tests covering defaults, overrides, and validation.
Also fixes pytest pythonpath configuration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:54:21 +00:00
d213abf9d9 chore: add pre-commit hook with ruff and pytest
- Add git pre-commit hook running ruff check, ruff format, pytest
- Fix import ordering in conftest.py
- Add placeholder test for test infrastructure
- Generate flake.lock

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:41:32 +00:00
c0b939627b feat: initial project setup with implementation plan
- Add PLAN.md with 40-step checklist across 10 phases
- Add CLAUDE.md with project-specific instructions
- Set up nix flake with FastHTML/MonsterUI dependencies
- Create Python package skeleton (src/animaltrack)
- Vendor FastHTML and MonsterUI documentation
- Add Docker build configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 17:37:16 +00:00