Reframe reef health as water conditions for non-reef sites - #919
Reframe reef health as water conditions for non-reef sites#919ericgriffin wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reframes the existing “Reef health” UI to a more general “Water conditions” presentation for non-reef ocean sites, while explicitly skipping NOAA health fetches for freshwater sites to avoid incorrect coastal fallback temperatures. It introduces a new gated WaterConditionsCard, rekeys the reef snapshot provider to include a fetchHealth flag, adds a cache-sharing habitat lookup for the dive detail page, and updates localization strings across all 11 locales.
Changes:
- Replace “Reef Health” card/section wording with “Water Conditions”, and gate coral-bleaching stress lines based on reef habitat availability (reef-possible vs definitively non-reef).
- Skip NOAA health fetches for freshwater sites (and hide the dive-detail section for freshwater), closing the coastal “nearest water pixel” correctness leak.
- Add SST anomaly rendering with correct delta unit conversion via
TemperatureUnit.convertDelta, plus broad test coverage for gating, conversions, and provider behavior.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/features/reef/presentation/widgets/water_conditions_card_test.dart | New widget tests covering gating, anomaly formatting, and freshwater precedence. |
| test/features/reef/presentation/widgets/reef_section_test.dart | Updates and expands section behavior tests (title, habitat-row hiding, freshwater message). |
| test/features/reef/presentation/widgets/nearby_species_tier_test.dart | Updates provider family invocation to use ReefSnapshotRequest. |
| test/features/reef/presentation/providers/reef_providers_test.dart | Updates provider tests for new snapshot request type and adds habitat-provider coverage. |
| test/features/reef/data/repositories/reef_repository_test.dart | Adds tests for freshwater health-skip and cache-sharing habitatFor. |
| test/core/constants/units_test.dart | New unit tests for TemperatureUnit.convertDelta. |
| test/core/constants/dive_detail_sections_test.dart | Updates expectations for renamed section display name. |
| lib/l10n/arb/app_en.arb | Updates English strings: “Ecosystem”, “Water conditions”, freshwater note, anomaly line. |
| lib/l10n/arb/app_ar.arb | Arabic locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_de.arb | German locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_es.arb | Spanish locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_fr.arb | French locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_he.arb | Hebrew locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_hu.arb | Hungarian locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_it.arb | Italian locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_nl.arb | Dutch locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_pt.arb | Portuguese locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_zh.arb | Chinese locale updates for the renamed section/card and new strings. |
| lib/l10n/arb/app_localizations.dart | Generated localization API updates (new water-conditions getters, removed reef-health title keys). |
| lib/l10n/arb/app_localizations_en.dart | Generated English localization implementation updates. |
| lib/l10n/arb/app_localizations_ar.dart | Generated Arabic localization implementation updates. |
| lib/l10n/arb/app_localizations_de.dart | Generated German localization implementation updates. |
| lib/l10n/arb/app_localizations_es.dart | Generated Spanish localization implementation updates. |
| lib/l10n/arb/app_localizations_fr.dart | Generated French localization implementation updates. |
| lib/l10n/arb/app_localizations_he.dart | Generated Hebrew localization implementation updates. |
| lib/l10n/arb/app_localizations_hu.dart | Generated Hungarian localization implementation updates. |
| lib/l10n/arb/app_localizations_it.dart | Generated Italian localization implementation updates. |
| lib/l10n/arb/app_localizations_nl.dart | Generated Dutch localization implementation updates. |
| lib/l10n/arb/app_localizations_pt.dart | Generated Portuguese localization implementation updates. |
| lib/l10n/arb/app_localizations_zh.dart | Generated Chinese localization implementation updates. |
| lib/features/reef/presentation/widgets/water_conditions_card.dart | New gated card: always SST/date/anomaly; stress lines only while reef is possible; freshwater messaging. |
| lib/features/reef/presentation/widgets/reef_section.dart | Retitles to “Ecosystem”, hides habitat row when definitively non-reef, passes water-type-aware snapshot request. |
| lib/features/reef/presentation/widgets/reef_health_card.dart | Removes the old reef-health-specific card widget. |
| lib/features/reef/presentation/widgets/nearby_species_tier.dart | Threads waterType into snapshot request to share a single fetch/cache entry with the section. |
| lib/features/reef/presentation/providers/reef_providers.dart | Rekeys reefSnapshotProvider with ReefSnapshotRequest and adds reefHabitatProvider. |
| lib/features/reef/data/repositories/reef_repository.dart | Adds includeHealth to snapshotFor and a cache-sharing habitatFor method. |
| lib/features/marine_life/presentation/widgets/site_marine_life_section.dart | Forwards site water type to nearby species tier for shared snapshot request. |
| lib/features/dive_sites/presentation/pages/site_detail_page.dart | Passes site.waterType into ReefSection and SiteMarineLifeSection. |
| lib/features/dive_log/presentation/pages/dive_detail_page.dart | Uses WaterConditionsCard, fetches habitat separately, and hides section for freshwater sites. |
| lib/core/constants/units.dart | Adds TemperatureUnit.convertDelta for anomaly/delta conversions (no Fahrenheit offset). |
| lib/core/constants/dive_detail_sections.dart | Updates fallback English display name/description for the persisted reefHealth section id. |
| docs/superpowers/specs/2026-08-08-water-conditions-design.md | Adds the approved design spec documenting decisions, gating rules, and freshwater semantics. |
| docs/superpowers/plans/2026-08-08-water-conditions.md | Adds the implementation plan describing tasks, constraints, and test strategy. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
📦 Build artifacts for this PR · commit
Artifacts expire in 7 days. Downloading requires being signed in to GitHub. macOS needs two extractions: unzip the downloaded artifact, then unzip the Updated automatically on each push. |
Summary
The "Reef health" card presented NOAA Coral Reef Watch data in coral-bleaching
terms at every site with coordinates. The underlying
dhw_5kmproduct coversthe entire global ocean, so sea surface temperature and its anomaly are valid
at kelp forests, temperate wrecks, and muck sites — only the coral framing was
wrong there. This PR reframes the presentation; services, entities, and the
reef cache are untouched.
only when the site is on a reef (or the check failed); the permanent
"Not on a reef" row is gone.
WaterConditionsCard(wasReefHealthCard): always shows SST, theobservation date, and the SST anomaly (fetched all along but never
displayed). The bleaching alert level and Degree Heating Weeks appear only
while habitat data has not definitively ruled a reef out — an offline
habitat provider never hides an active bleaching alert.
temperature covers oceans only" note on the site page. Skipping the fetch
also closes a correctness leak: the nearest-water-pixel fallback could hand
a quarry within ~8 km of a coast the adjacent ocean's temperature.
(
DiveDetailSectionId.reefHealth) but displays as "Water Conditions", usesthe same gated card via a new cache-shared
habitatForlookup, and hidesentirely for freshwater sites.
TemperatureUnit.convertDelta: the anomaly converts as a temperaturedifference (scale only, no +32 offset), respecting the diver's unit setting.
Test plan
WaterConditionsCard(habitat ok/empty/unavailable/nullx health states), freshwater fetch-skip repository tests,
habitatForcache-sharing tests, anomaly delta-conversion vectors (unit + widget),
Ecosystem section behavior (title, habitat-row hiding, freshwater message).
flutter analyzeclean;dart formatclean.Spec:
docs/superpowers/specs/2026-08-08-water-conditions-design.mdPlan:
docs/superpowers/plans/2026-08-08-water-conditions.md