Initial commit
This commit is contained in:
57
project-docs/lifeos-conversation-context-convo-test1.md
Normal file
57
project-docs/lifeos-conversation-context-convo-test1.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Life OS - Conversation Context (Test Infrastructure - Convo Test1)
|
||||
|
||||
## What This Is
|
||||
Life OS is my personal productivity web application, live at https://lifeos-dev.invixiom.com on my self-hosted Hetzner server (defiant-01, 46.225.166.142). Convos 1-4 built 18 routers covering hierarchy, tasks, knowledge, daily workflows, search, admin, meetings, decisions, weblinks, appointments, and time tracking. Convo Test1 built a dynamic, introspection-based automated test suite that discovers routes from the live FastAPI app at runtime -- no hardcoded routes anywhere.
|
||||
|
||||
## How to Use the Project Documents
|
||||
|
||||
**lifeos-development-status-test1.md** - START HERE. Source of truth for the test infrastructure: what's deployed, how it works, what state it's in, and what to do next.
|
||||
|
||||
**lifeos-development-status-convo4.md** - Application source of truth. What's built, routers, templates, deploy patterns, remaining features. The test suite tests THIS application.
|
||||
|
||||
**lifeos-architecture.docx** - Full system specification. 50 tables, all subsystems. Reference when adding seed data for new entities.
|
||||
|
||||
**lifeos_r1_full_schema.sql** - Intended R1 schema. The test DB is cloned from the live dev DB (not this file), so always verify against: `docker exec lifeos-db psql -U postgres -d lifeos_dev -c "\d table_name"`
|
||||
|
||||
**life-os-server-config.docx** - Server infrastructure: containers, ports, Docker networks, Nginx, SSL.
|
||||
|
||||
## Current Tech Stack
|
||||
- Python 3.12 / FastAPI / SQLAlchemy 2.0 async (raw SQL via text(), no ORM models) / asyncpg
|
||||
- Jinja2 server-rendered templates, vanilla HTML/CSS/JS, no build pipeline
|
||||
- PostgreSQL 16 in Docker, full-text search via tsvector
|
||||
- Dark/light theme via CSS custom properties
|
||||
- Container runs with hot reload (code mounted as volume)
|
||||
- GitHub repo: mdombaugh/lifeos-dev (main branch)
|
||||
|
||||
## Key Patterns (Application)
|
||||
- BaseRepository handles all CRUD with soft deletes (is_deleted filtering automatic)
|
||||
- Every route calls get_sidebar_data(db) for the nav tree
|
||||
- Forms use standard HTML POST with 303 redirect (PRG pattern)
|
||||
- Templates extend base.html
|
||||
- Exception: time_entries has no updated_at column, so use direct SQL for deletes instead of BaseRepository.soft_delete()
|
||||
- Timer state: get_running_task_id() helper in routers/tasks.py queries time_entries WHERE end_at IS NULL
|
||||
|
||||
## Key Patterns (Test Suite)
|
||||
- Tests introspect `app.routes` at import time to discover all paths, methods, Form() fields, and path params
|
||||
- Dynamic tests auto-parametrize from the route registry -- adding a new router requires zero test file changes for smoke/CRUD coverage
|
||||
- Business logic tests (timer constraints, soft delete behavior, search safety) are hand-written in test_business_logic.py
|
||||
- Test DB: `lifeos_test` -- schema cloned from `lifeos_dev` via pg_dump on each deploy
|
||||
- Per-test isolation: each test runs inside a transaction that rolls back
|
||||
- Seed data: 15 entity fixtures inserted via raw SQL, composite `all_seeds` fixture
|
||||
- `PREFIX_TO_SEED` in registry.py maps route prefixes to seed fixture keys for dynamic path resolution
|
||||
- Form data auto-generated from introspected Form() signatures via form_factory.py
|
||||
|
||||
## Deploy Cycle (Application)
|
||||
Code lives at /opt/lifeos/dev/ on the server. The container mounts this directory and uvicorn --reload picks up changes. No rebuild needed for code changes. Claude creates deploy scripts with heredocs that are uploaded via SCP and run with bash.
|
||||
|
||||
## Deploy Cycle (Tests)
|
||||
```bash
|
||||
scp deploy-tests.sh root@46.225.166.142:/opt/lifeos/dev/
|
||||
ssh root@46.225.166.142
|
||||
cd /opt/lifeos/dev && bash deploy-tests.sh
|
||||
docker exec lifeos-dev bash /app/tests/run_tests.sh report # Verify introspection
|
||||
docker exec lifeos-dev bash /app/tests/run_tests.sh # Full suite
|
||||
```
|
||||
|
||||
## What I Need Help With
|
||||
[State your current task here]
|
||||
Reference in New Issue
Block a user