Skip to content

ensure_channel() returns a stale, unverified encoding #9

Description

@mijahauan

ensure_channel() should not return an encoding it has not verified. It returns whatever the one post-create poll happened to report, and that poll matches on frequency alone (control.py, ensure_channel's poll_channel(ssrc, expected_freq=frequency_hz, …) and the comment above it: "radiod may grant a different encoding …; the returned ChannelInfo carries the granted value, which consumers use authoritatively"). But radiod takes OUTPUT_ENCODING only as a separate command sent after the create packet (control.py:1601-1618), so that poll can — and does — land before the library's own follow-up has been reflected in status. Measured live on DASI002, 2026-08-23, twice, same SSRC: ensure_channel(encoding=F32LE, preset="iq", sample_rate=12000) returned ChannelInfo.encoding = 2 (S16BE); a poll_channel(ssrc, expected_freq=…) 4 s later returned encoding = 4 and verify_channel(ssrc, expected_encoding=F32LE) returned True; and the wire itself measured 4.00 bytes/component over 6000 packets (5,760,000 B ÷ 8 = 720,000 samples = exactly 60.0 s at 12 kHz). So the grant was honoured and only the returned value was stale — radiod is not misreporting. This is dangerous because RadiodStream decodes with the value on the ChannelInfo (getattr(self.channel, 'encoding', 0)): believing it parses 2 bytes where 4 were sent and yields a plausible, well-formed array at twice the sample count with clean completeness and zero gaps — the playbook's first station trap ("Stale encoding from ensure_channel"), and what event-recorder works around by probing the wire (Costas-array/src/event_recorder/channel.py). verify_channel(expected_encoding=…) already exists and already knows how to say "the grant was not honored or was lost" (control.py:1666-1677); ensure_channel should re-poll or call it before returning, or the returned field should be documented as provisional.

Docs page(s) blocked/affected: sigmond/docs/scientist/capture-quickstart.md §Option B, sigmond/docs/hardware/character.md §The encoding you asked for is a second command

Provenance: docs-gap ledger row 39, HamSCI/sigmond docs/contributor/docs-gap-ledger.md (2026-08 documentation program, Phase 2).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocs-gapfound by the 2026-08 documentation program

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions