Skip to content

Per-manufacturer audit: which CCR parsers set dc_gasmix_t.usage reliably (follow-up to #1747/#1752) #1801

Open

Description

@alpheios-one

Summary

#1752 uses dc_gasmix_t.usage (DC_USAGE_OXYGEN/DC_USAGE_DILUENT) to identify diluent
and oxygen-supply cylinders on a sensorless CCR import, falling back to a relative
O2/He ranking only for gases with no reported usage. That change was verified against a
single parser (shearwater_predator_parser.c). Every other CCR-capable parser in the
vendored libdivecomputer fork needs the same verification before the sensorless CCR
role logic can be trusted for them.

What "reliably" means here

For a parser to be trustworthy for #1752's role inference, it needs to, for a CCR dive:

  1. Set gasmix->usage = DC_USAGE_DILUENT on every gas mix the diver configured as a
    diluent, and DC_USAGE_OXYGEN on the oxygen-supply mix, whenever a tank/transmitter
    record does not already carry dc_tank_t.usage for that mix.
  2. Never set DC_USAGE_DILUENT/DC_USAGE_OXYGEN on an open-circuit/bailout gas.
  3. Report DC_DIVEMODE_CCR (via DC_FIELD_DIVEMODE) for the dives this applies to, since
    feat(dive-computer): rank sensorless CCR bailout gases against each other #1752's bailout ranking only activates on that mode.

A parser that reports CCR dives but never sets diluent/oxygen usage (see McLean Extreme
below) will have every one of its gases -- including the real diluent -- routed through
the bailout ranking instead, silently producing wrong roles.

Known starting point (from grepping the vendored source, not yet dive-tested)

Parser Sets DC_USAGE_DILUENT/OXYGEN? CCR dive mode reported? Status
shearwater_predator_parser.c Yes Yes Verified in #1752
halcyon_symbios_parser.c Yes Unverified Needs audit
divesoft_freedom_parser.c Yes Unverified Needs audit
hw_ostc_parser.c Yes Unverified Needs audit (OSTC has both OC and CCR variants -- check whether usage is set only on the CCR-capable ones)
suunto_eonsteel_parser.c Yes Unverified Needs audit (EON Steel Black has a CCR mode)
mclean_extreme_parser.c No -- hardcoded DC_USAGE_NONE Yes (DC_DIVEMODE_CCR) Known gap: a CCR-only computer whose diluent will be misrouted into the bailout ranking
All other parsers No Mostly OC-only or gauge Out of scope unless they turn out to report CCR dives

Poseidon and rEvo are not supported by libdivecomputer at all (no parser exists for
either brand in this fork), so they are out of scope for this audit regardless of how
common they are among CCR divers.

Proposed approach

  1. For each parser with CCR dive-mode support (start from the "Sets usage" and "gap"
    rows above, then re-scan DC_FIELD_DIVEMODE/DC_DIVEMODE_CCR across src/ in case
    a CCR-capable parser was missed), read the source to determine exactly when
    gasmix->usage is set to DC_USAGE_DILUENT/DC_USAGE_OXYGEN, and whether that
    coverage is unconditional or depends on a tank/transmitter record already being
    present (which would make feat(dive-computer): rank sensorless CCR bailout gases against each other #1752's fallback unreachable for the wrong reason, rather
    than genuinely correct).
  2. Where real sample data exists (test fixtures under
    packages/libdivecomputer_plugin/android/src/androidTest/assets/,
    packages/libdivecomputer_plugin/test/native/, or a diver-contributed download),
    confirm the finding against an actual parsed dive rather than source reading alone.
  3. Record the result per parser (reliable / unreliable / needs a fix) in a table, similar
    to the one above but verified.
  4. For McLean Extreme specifically: decide whether to patch the parser (in
    submersion-app/libdivecomputer) to set DC_USAGE_DILUENT/OXYGEN the way Shearwater
    does, or to special-case it in _inferSensorlessRoles some other way.
  5. For any other parser found unreliable: same decision -- patch the fork, or exclude it
    from the CCR-specific ranking (i.e. keep it on the original single-threshold heuristic)
    until it can be fixed.

Out of scope

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions