Skip to content

Commit e72897e

Browse files
sneg55Nick Sawinyhclaude
authored
docs(claude): add Celery task registration, route inventory, venv pytest, and circular-import rules (#77)
Promotions from a memory-consolidation review after shipping the map view feature. Each rule captures a concrete gotcha hit during that work that isn't derivable from reading the code. Co-authored-by: Nick Sawinyh <nikita@sawinyh.ru> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 35d9e04 commit e72897e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ createdb pingcrm_test # PostgreSQL test database (or set TEST_DATABASE_URL)
211211
cd backend && pytest
212212
cd frontend && npm install && npm test
213213

214+
# Pre-push hook (.githooks/pre-push) uses backend/.venv's pytest, not system Python.
215+
# Any new test dependency added to requirements-test.txt must also be installed in
216+
# the venv or the hook will fail at push time:
217+
cd backend && source .venv/bin/activate && pip install -r requirements-test.txt
218+
214219
# Celery worker + beat (combined, for development)
215220
cd backend && celery -A worker.celery_app worker --beat --loglevel=info
216221

@@ -244,6 +249,9 @@ See @.claude/rules/exception-handling.md for the full policy (logging requiremen
244249
- **No debug endpoints in prod** — never add debug/temporary endpoints unless the user explicitly asks
245250
- **Twitter polling strategy** — cron only polls bios via bird CLI; tweet fetching + LLM classification is on-demand for suggestion generation (not daily)
246251
- **No silent errors** — when editing any file, also fix existing silent error patterns in that file (bare `except:`, `except: pass`, empty `catch {}`, catch-with-only-console.log). Every exception handler must log with context and either re-raise or return a sentinel. See `.claude/rules/exception-handling.md`. Add `# silent-ok` or `// silent-ok` only for genuinely intentional cases.
252+
- **Register new Celery tasks in `app/services/tasks.py`** — Celery discovers tasks via `include=["app.services.tasks"]` in `app/core/celery_app.py`. Tasks defined in `app/services/task_jobs/<module>.py` only get registered when re-exported from `tasks.py` (both the import and the `__all__` list). Skipping this causes `.delay()` to silently enqueue to a task name no worker consumes.
253+
- **Update the route-inventory snapshot when adding contact routes**`backend/tests/test_route_inventory.py` keeps two lists (`expected` and `must_be_before_param`) that mirror `/api/v1/contacts/*` paths. Adding any sub-router under `contacts_routes/` requires appending to both. The pre-push hook catches this.
254+
- **Avoid circular imports via `app/models/__init__.py`** — that file eagerly imports every model. A listener in `app/models/` (e.g., `listeners.py`) that imports from `app/services/` risks a partial-init cycle whenever the service transitively imports a model. Lazy-import the service inside the handler body, not at module top level.
247255

248256
### Platform Integrations
249257
1. **Gmail** - OAuth + Gmail API for per-message email sync + BCC logging

0 commit comments

Comments
 (0)