Skip to content

Reframe reef health as water conditions for non-reef sites - #919

Open
ericgriffin wants to merge 9 commits into
mainfrom
worktree-water-conditions
Open

Reframe reef health as water conditions for non-reef sites#919
ericgriffin wants to merge 9 commits into
mainfrom
worktree-water-conditions

Conversation

@ericgriffin

Copy link
Copy Markdown
Member

Summary

The "Reef health" card presented NOAA Coral Reef Watch data in coral-bleaching
terms at every site with coordinates. The underlying dhw_5km product covers
the 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.

  • "Ecosystem" section (site page, was "Reef"): the habitat row now appears
    only when the site is on a reef (or the check failed); the permanent
    "Not on a reef" row is gone.
  • WaterConditionsCard (was ReefHealthCard): always shows SST, the
    observation 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.
  • Freshwater sites skip the NOAA fetch and show a "satellite water
    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.
  • Dive detail: the toggleable section keeps its persisted id
    (DiveDetailSectionId.reefHealth) but displays as "Water Conditions", uses
    the same gated card via a new cache-shared habitatFor lookup, and hides
    entirely for freshwater sites.
  • TemperatureUnit.convertDelta: the anomaly converts as a temperature
    difference (scale only, no +32 offset), respecting the diver's unit setting.
  • l10n updated in all 11 locales.

Test plan

  • New: gate matrix on WaterConditionsCard (habitat ok/empty/unavailable/null
    x health states), freshwater fetch-skip repository tests, habitatFor
    cache-sharing tests, anomaly delta-conversion vectors (unit + widget),
    Ecosystem section behavior (title, habitat-row hiding, freshwater message).
  • Full suite: 15,732 tests pass; flutter analyze clean; dart format clean.

Spec: docs/superpowers/specs/2026-08-08-water-conditions-design.md
Plan: docs/superpowers/plans/2026-08-08-water-conditions.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.16667% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ef/presentation/widgets/water_conditions_card.dart 88.88% 6 Missing ⚠️
.../dive_log/presentation/pages/dive_detail_page.dart 60.00% 4 Missing ⚠️
...atures/reef/data/repositories/reef_repository.dart 78.57% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📦 Build artifacts for this PR · commit d491f6d

Platform Download
Android (APK) android-apk
macOS macos-build
Windows windows-build
Linux linux-build

Artifacts expire in 7 days. Downloading requires being signed in to GitHub. macOS needs two extractions: unzip the downloaded artifact, then unzip the submersion-macos.zip inside it to get a runnable submersion.app. The build is ad-hoc signed — right-click → Open on first launch.

Updated automatically on each push.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants