[Arch] db.py (1,350 lines, 72 functions) has no dedicated test file #65

Closed
opened 2026-07-01 07:27:17 +02:00 by bullitt · 1 comment
Owner

Severity: Medium | Category: Testing

db.py is at 78% coverage, but only as a side effect of test_api.py/test_ingest.py/test_pipeline.py — no tests/test_db.py exists to assert its own contracts directly (e.g. upsert collision behavior, update allowlist behavior).

Recommendation: Add tests/test_db.py covering upsert_shipment create/update/collision paths, update_shipment's allowlist behavior, add_event/add_scrape_log, and the transaction helper once added.

Full detail: docs/architecture-review.md § C + § H.8

**Severity:** Medium | **Category:** Testing `db.py` is at 78% coverage, but only as a side effect of `test_api.py`/`test_ingest.py`/`test_pipeline.py` — no `tests/test_db.py` exists to assert its own contracts directly (e.g. upsert collision behavior, update allowlist behavior). **Recommendation:** Add `tests/test_db.py` covering `upsert_shipment` create/update/collision paths, `update_shipment`'s allowlist behavior, `add_event`/`add_scrape_log`, and the transaction helper once added. Full detail: `docs/architecture-review.md` § C + § H.8
Author
Owner

Fixed on branch architecture-rework, commit 40bb96b: added tests/test_db.py with 12 direct tests covering upsert_shipment (create/update/backfill/state-forward-only), update_shipment's column allowlist, add_event, add_scrape_log, and db.transaction() (commit-on-success and rollback-on-failure). Full suite: 252 passed.

Fixed on branch `architecture-rework`, commit 40bb96b: added `tests/test_db.py` with 12 direct tests covering `upsert_shipment` (create/update/backfill/state-forward-only), `update_shipment`'s column allowlist, `add_event`, `add_scrape_log`, and `db.transaction()` (commit-on-success and rollback-on-failure). Full suite: 252 passed.
Sign in to join this conversation.
No labels
arch
harness
security
ux
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bullitt/trackbox#65
No description provided.