stream: handling invalid stream arguments in `stream.pipeline()`
オープン
まだ誰も着手していません。
never-stale
stream
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
A few "what goes where"-related inconsistencies with stream.pipeline(). Validation of stream objects is very hit-and-miss:
| Passing this: | as this: | should do this: | and does this: |
|---|---|---|---|
| Non-readable Node stream | source | Should be rejected. | :x: Passes validation. Gets passed to Duplex.from(), resulting in a write-only Duplex. The pipeline will never receive any data. |
| transform | Should be rejected. | :heavy_check_mark: Fails validation. | |
| destination | Should be accepted. | :heavy_check_mark: Passes validation. | |
| Non-writable Node stream | source | Should be accepted. | :heavy_check_mark: Passes validation. |
| transform | Should be rejected. | :x: Passes validation. Fails asynchronously at runtime: when the previous stream in the pipeline emits data, raises a TypeError due to attempting to call missing Writable methods. | |
| destination | Should be rejected. | :x: Same as above. | |
ReadableStream |
source | Should be accepted. | :heavy_check_mark: Passes validation. |
| transform | Should be rejected. | :heavy_check_mark: Fails validation. | |
| destination | Should be rejected. | :x: Passes validation. Fails asynchronously at runtime: raises a TypeError due to attempting to call the missing getWriter() method. |
|
TransformStream |
source | Undocumented, but should be accepted. | :heavy_check_mark: Passes validation. |
| transform | Should be accepted. | :heavy_check_mark: Passes validation. | |
| destination | Undocumented, but should be accepted. | :heavy_check_mark: Passes validation. | |
WritableStream |
source | Should be rejected. | :x: Passes validation. Gets passed to Duplex.from(), resulting in a write-only Duplex. The pipeline will never receive any data. |
| transform | Should be rejected. | :heavy_check_mark: Fails validation. | |
| destination | Should be accepted. | :heavy_check_mark: Passes validation. |
These should probably be validated consistently.
Other observations:
- The docs should specify that
TransformStreams are valid source and destination streams, as well as valid return values. - The transform validation error message doesn't specify which parameter failed validation, which is a pain in terms of debugging. Its counterparts in
stream.compose()pass the parameter name to the error constructor asstreams[n], which would be a fairly straightforward improvement.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
lib/internal/streams/pipeline.js のリンクされた検証パスから始め、特に 306-308、376、391-395 行付近の source、transform、destination の処理を確認します。stream.compose() で使用されているパラメーター名を比較し、関連する stream のドキュメントを調べます。無効な引数が一貫して拒否され、検証エラーが失敗したパラメーターを特定し、TransformStream のサポートが説明どおりにドキュメント化されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- backend, documentation
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100