A pipe returns its final output and nothing else. When that output is empty, there is no way to tell why: whether the source found nothing, a filter matched nothing, or which stage emptied the stream. The only way to find out is to take the pipe apart and run it a stage at a time.
The same blindness shows up when a pipe returns far more than expected: a filter that matched thousands of lines looks the same as one that matched three, and there is no sign of it until the whole result is already in hand. When a result is large enough to be stored behind a ref, its size and shape are gone too.
In each case the result can only be re-run, not reasoned about.
Guidance
A shape sketched earlier, as one possible answer and not a spec: the result carries a one-line record of what each stage did (Find: 12 files -> Read: 12 files, 1,240 lines -> Match: 3 files, 8 lines), held in an envelope { summary, body } so it survives when the body is stored behind a ref. Worked out but open: units spelled, per-stage counts, 0 files as the empty signal, whether every stage reports.
A pipe returns its final output and nothing else. When that output is empty, there is no way to tell why: whether the source found nothing, a filter matched nothing, or which stage emptied the stream. The only way to find out is to take the pipe apart and run it a stage at a time.
The same blindness shows up when a pipe returns far more than expected: a filter that matched thousands of lines looks the same as one that matched three, and there is no sign of it until the whole result is already in hand. When a result is large enough to be stored behind a ref, its size and shape are gone too.
In each case the result can only be re-run, not reasoned about.
Guidance
A shape sketched earlier, as one possible answer and not a spec: the result carries a one-line record of what each stage did (
Find: 12 files -> Read: 12 files, 1,240 lines -> Match: 3 files, 8 lines), held in an envelope{ summary, body }so it survives when the body is stored behind a ref. Worked out but open: units spelled, per-stage counts,0 filesas the empty signal, whether every stage reports.