Skip to content

refactor: make github/uniq consistent, drop unused _open_read_stream - #348

Merged
zechengz merged 2 commits into
mainfrom
refactor/drop-open-read-stream
Jun 17, 2026
Merged

zechengz merged 2 commits into
mainfrom
refactor/drop-open-read-stream

Conversation

@zechengz

Copy link
Copy Markdown
Contributor

github/uniq was the only command wrapper in the repo passing a raw bytes-returning reader (partial(github_read, ...)) into a generic command. Every other backend (and every other github command) already wraps its reader in an async generator before passing it in.

This made the _open_read_stream helper exist solely to normalize that one wiring. The fix:

  • github/uniq now wraps github_read in stream_from_bytes, matching github/cut/github/awk/etc.
  • generic/uniq consumes read_stream(accessor, p) directly (like generic/cut); its type Callable[..., AsyncIterator[bytes]] is now accurate.
  • _open_read_stream deleted from utils/stream.py (no remaining consumers).
  • Dropped test_read_stream_returning_bytes, which covered the removed contract.

Net: one rule everywhere, backends always pass an async generator and generics never normalize. TS already follows this (uniqGeneric is typed to require a stream fn).

Replaces #344, which spread the helper to 13 generics to guard a reader shape no backend actually produces.

…ead_stream

github/uniq was the only wrapper passing a raw bytes-returning reader into
a generic command; every other backend already passes an async generator.
Wrap github_read in stream_from_bytes like its siblings, consume read_stream
directly in generic/uniq, and delete the now-unused _open_read_stream helper.
@zechengz
zechengz merged commit 3f450a6 into main Jun 17, 2026
57 checks passed
@zechengz
zechengz deleted the refactor/drop-open-read-stream branch June 17, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant