Add a Postgres integration test tier and close named coverage gaps #68
Labels
No labels
area:ai
area:ci-cd
area:notifications
area:observability
area:public-pages
backlog
bug
duplicate
enhancement
help wanted
invalid
question
type:decision
type:feature
type:infra
type:maintenance
type:security
v1.0.1
v1.1.0
v1.2.0
v1.3.0
v2.0.0
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/WeatherBot#68
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
conftest monkey-patches JSONB→JSON and runs on in-memory SQLite
(tests/conftest.py:17-20,58-74), so pg_notify/SSE, JSONB behavior, real
unique-constraint dedup, and timestamptz handling are never exercised.
Zero-coverage modules: api/sse.py, api/media.py, api/location_subs.py
(authz mirrors the tested channel-keyed API — test that layer),
notifiers/discord_bot.py. Add: (1) a small Postgres tier run in CI (F-26) —
sent_alerts dedup under asyncpg, pg_notify→SSE smoke test, channel-delete
SET NULL behavior (F-09); (2) unit tests for named gaps: SPC cross-day
(F-03) and reissuance (F-05) regressions, notifier link-failure injection
(F-15), VTEC parse edge cases + SPC GIF fallback (radar.py:155-522), AI
total-timeout branch (ai_summarizer.py:1086-1090). Also correct CLAUDE.md's
stale "no automated tests" line.
Acceptance criteria:
Filed from the 2026-07-17 codebase audit (
docs/.internal/report-2026-07-17.md), finding F-29.Picking this up as part of v1.1.0 Phase 1 (with #65). Approach: gate the conftest JSONB→JSON monkeypatch on
WEATHERBOT_TEST_DB=postgresso the Postgres tier runs as a separate pytest invocation against a real PG (real JSONB/FK/unique-null semantics), selected by apostgresmarker; the SQLite suite stays the fast default (addopts = -m "not postgres"). Postgres-tier tests:sent_alertsdedup under asyncpg,pg_notifyLISTEN/NOTIFY round-trip (the SSE contract), and channel-deleteSET NULL(the authoritative F-09 check SQLite couldn't do). Remaining named unit gaps (VTEC parse edges, SPC GIF fallback, AI total-timeout) added as regular tests; the SPC cross-day/reissuance/notifier-link gaps already got tests in v1.0.2. Will also correct CLAUDE.md's stale "no automated tests" line.Done in #94 (merged to
main). Added a Postgres integration tier: the conftest JSONB→JSON monkeypatch is gated onWEATHERBOT_TEST_DB=postgres, newpg_engine/pg_dbfixtures build the schema from ORM metadata, and@pytest.mark.postgrestests are excluded from the default SQLite run. Tier coverssent_alertsUNIQUE dedup under asyncpg, dashboard NULL-channel rows not being deduped (documents the gap #57 will close), channel-deleteON DELETE SET NULL(the authoritative F-09 check), and apg_notifyLISTEN/NOTIFY round-trip. Coverage-gap unit tests added for VTEC parsing edges, SPC GIF assembly/fallback, and the AI total-timeout branch. CLAUDE.md's stale "no automated tests" note corrected. Verified on the dev server (Postgres tier 4 passed) and green in CI.