fix: expand actively_monitored_wells to include wells from all groups(BDMS-974/1178) - #866
Conversation
Coverage✅ 79.19% total — gate is 75%. No measured coverage for the Python files changed here. |
4d15dd1 to
1112edd
Compare
There was a problem hiding this comment.
Pull request overview
Expands actively monitored well OGC views to include wells from all groups while retaining the current monitoring filter.
Changes:
- Recreates public and internal views without the group-name restriction.
- Adds coverage for wells in other groups.
- Updates related OGC cleanup scenarios.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Summary |
|---|---|
tests/test_ogc.py |
Adds regression coverage for wells in non-default groups. |
tests/features/ogc-cleanup-sprint1.feature |
Updates A4/A6 OGC scenarios and removes stale assertions. |
alembic/versions/986e0eb85ab3_expand_actively_monitored_wells_to_all_.py |
Requires a public group-release filter (critical, 3 votes), coverage for the internal mirror (moderate, 2 votes), and unique feature IDs for per-group rows (critical, 1 vote). |
Suppressed comments (1)
tests/test_ogc.py:597
- This migration changes both the public and internal views, but the new regression test only queries
ogc_actively_monitored_wells. A regression in_create_internal_actively_monitored_wells_view()would still pass, leaving/ogcapi-internalwith the old group-name restriction; run the same assertion against both relations (or exercise the internal endpoint) so both changed definitions are covered.
row = session.execute(
text(
"SELECT group_id, group_name, group_type "
"FROM ogc_actively_monitored_wells WHERE id = :thing_id"
),
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| FROM "group" AS g | ||
| JOIN group_thing_association AS gta ON gta.group_id = g.id | ||
| JOIN ogc_internal_water_well_summary AS wws ON wws.id = gta.thing_id | ||
| JOIN latest_monitoring_status AS lms ON lms.thing_id = wws.id | ||
| WHERE {group_filter}lms.status_value = 'Currently monitored' |
| wws.id, | ||
| wws.name, |
There was a problem hiding this comment.
@jirhiker and @ksmuczynski
Copilot flagged that a well in multiple groups now produces duplicate rows sharing the same id, breaking /items/{id} lookups (verified live — it silently returns just one group, no error, not even deterministic). Need a decision on the fix:
- Aggregate: one row per well, group info becomes arrays (group_names: [...]) instead of single values. Keeps id meaning "the well" everywhere, consistent with every other collection in this API.
- Composite ID: keep one row per (well, group), but make composite id of well and group. Keeps per-group rows, but id would no longer match the well's real id the way it does in water_wells/water_well_summary today.
05a6436 to
cc19645
Compare
…d_wells view and added tests for internal"
BDMS-974/1178: Expand actively_monitored_wells to include wells from all groups
Why
How
Notes