fix(ogc): gate ogc_waterlevels on the well's release status - #877
Open
jirhiker wants to merge 1 commit into
Open
fix(ogc): gate ogc_waterlevels on the well's release status#877jirhiker wants to merge 1 commit into
jirhiker wants to merge 1 commit into
Conversation
ogc_waterlevels filtered on the reading's own release_status only, so a well whose own release_status was 'draft' or 'private' still published its public readings through OGC API - EDR -- with the well's name and coordinates attached to every one of them. ogc_water_chemistry has required the parent thing to be public since d9e0f1a2b3c4; this brings water levels onto the same rule, which is what made the inconsistency visible in the first place. ogc_internal_waterlevels is deliberately untouched. It carries non-public records by design for authenticated staff clients, exactly as ogc_internal_water_chemistry does. Downgrade restores the definition by importing z9a0b1c2d3e4 rather than copying its SQL, so the reverted view cannot drift from the definition of record -- the same approach b7c8d9e0f1a2 took. No rows change on the dev database: it has no non-public well carrying readings today, so this closes the hole rather than retracting published data. Whether that also holds in production is worth checking before deploy. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #876 (→ #874 → #866). Base is
fix/edr-instances-contract; GitHub retargets as the chain merges.Fixes the inconsistency flagged in #876.
The hole
ogc_waterlevelsfiltered on the reading'srelease_statusonly:So a well whose own
release_statuswasdraftorprivatestill published its public readings through OGC API - EDR — with the well's name and coordinates attached to every row.ogc_water_chemistryhas required the parent thing to be public sinced9e0f1a2b3c4; water levels never got the same rule, which is why the two collections disagreed about the same well.Now both branches of the union carry:
ogc_internal_waterlevelsis deliberately untouched — it carries non-public records by design for authenticated staff clients, exactly asogc_internal_water_chemistrydoes.Data impact
No rows change on the dev database — 88,852 rows before and after, because no non-public well there carries readings. So this closes a hole rather than retracting published data. Worth confirming the same holds in production before deploy:
Downgrade
Restores the previous definition by importing
z9a0b1c2d3e4rather than copying its SQL, so the reverted view cannot drift from the definition of record — the approachb7c8d9e0f1a2already established.Tests
test_ogc_waterlevels_excludes_readings_from_a_non_public_welltakes a public reading on a draft well and asserts three things: it is absent fromogc_waterlevels, still present inogc_internal_waterlevels, and published again once the well goes public.Verification
uv run pytest --ignore=tests/transfers→ 1099 passed, 81 skipped, 6 xpassedDROP_AND_REBUILD_DB=1 uv run behave tests/features --tags="@backend and @production and not @skip"→ 9 features, 85 scenarios, 0 failedpg_get_viewdefboth wayspre-commit(black, flake8) clean🤖 Generated with Claude Code