From bfedf257c780c560862e9ba6bd3cb076d0c76e03 Mon Sep 17 00:00:00 2001 From: Eric Griffin Date: Wed, 5 Aug 2026 15:50:03 -0400 Subject: [PATCH 01/20] Add design spec for CCR equipment support (#804) Covers three phases: a rebreather equipment type with CCR/SCR attributes, reusable cylinder configurations (schema v139) with a conservative merge that never overwrites downloaded gas mixes, and built-in rebreather service kinds for scrubber repack, O2 cell replacement, and annual service. --- .../specs/2026-08-05-ccr-equipment-design.md | 347 ++++++++++++++++++ 1 file changed, 347 insertions(+) create mode 100644 docs/superpowers/specs/2026-08-05-ccr-equipment-design.md diff --git a/docs/superpowers/specs/2026-08-05-ccr-equipment-design.md b/docs/superpowers/specs/2026-08-05-ccr-equipment-design.md new file mode 100644 index 0000000000..c656d1e535 --- /dev/null +++ b/docs/superpowers/specs/2026-08-05-ccr-equipment-design.md @@ -0,0 +1,347 @@ +# CCR as Equipment Type, Cylinder Configurations, and Rebreather Service + +**Date:** 2026-08-05 +**Issue:** [#804](https://github.com/submersion-app/submersion/issues/804) +**Status:** Approved design, pending implementation plan + +## Motivation + +Issue #804 reports that there is no way to record which rebreather was used on +a dive. Open-circuit gear is covered by the `regulator` equipment type, and CCR +gas is covered by tanks and tank roles, but the unit itself has no +representation. The reporter's workaround is to register the CCR controller as +a dive computer and infer the unit from it. + +The issue makes three asks: + +1. An equipment type for rebreathers, so a specific unit can be linked to a + dive. +2. Reusable configurations per unit, because entering diluent and bailout + setups by hand "can otherwise be quite involved." +3. Service-date tracking per unit. + +All three are in scope, phased. + +## Current state (survey findings) + +The app already models more of CCR diving than the issue implies. What is +missing is a physical unit to attach it to. + +- `DiveMode` (`lib/core/constants/enums.dart:318`) already has + `oc` / `ccr` / `scr` / `gauge`; `dives.dive_mode` defaults to `'oc'`. +- `TankRole` (`enums.dart:292`) already includes `diluent`, `oxygenSupply`, + and `bailout` alongside the OC roles. +- Dives already carry CCR setpoints, and `ScrType` (CMF / PASCR / ESCR) + already exists. +- `EquipmentType` (`enums.dart:4`) is a hardcoded Dart enum of 19 values with + no rebreather. Values persist as raw strings in `equipment.type` + (`database.dart:872`), so adding a value is cheap but splitting one later + would be a data migration. +- Everything type-specific about an equipment item lives in + `EquipmentAttributeCatalog` + (`lib/features/equipment/domain/constants/equipment_attribute_catalog.dart`), + a per-type map of typed attribute definitions stored as KV rows in + `equipment_attributes` (v115, PR #608). Adding attributes for a new type + requires no schema migration. +- Equipment type labels render from the enum's hardcoded English `displayName` + (`equipment_edit_page.dart:207`) and are **not** localized. Attributes + **are**, via `attrLabel_` / `attrChoice__