Skip to content

v2 review fixes for Pipe/runner branch#63

Open
znull wants to merge 5 commits into
pipe-and-runner-and-configfrom
znull/v2-review-fixes-pr-61
Open

v2 review fixes for Pipe/runner branch#63
znull wants to merge 5 commits into
pipe-and-runner-and-configfrom
znull/v2-review-fixes-pr-61

Conversation

@znull

@znull znull commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

This is a rebased version of #62 targeted at #61: Fixes issues discovered doing a review of the latest stage-v2-clean state.

/cc @mhagger

Copilot Summary

This PR ports the v2 review-fix commits onto PR #61's Pipe / runner / Config branch:

  • Cancel the derived Pipe context on pre-start failures and include the offending stage name in invalid stream requirement errors.
  • Close an already-configured stdout closer before Output() replaces stdout with its capture buffer, adapted to runner.output() / Pipeline.Output().
  • Expose WithStdinRequirement and WithStdoutRequirement so Function stages can participate in stream requirement negotiation without reimplementing Stage.
  • Document the known limitation for borrowed non-file stdin readers feeding command stages that can exit without draining stdin.

znull and others added 5 commits June 16, 2026 15:50
Ensure pre-start validation failures cancel the derived pipeline context,
and include the offending stage name in invalid stream-requirement errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Release any previously configured stdout stream before replacing it with
the buffer used by Output, preserving ownership of WithStdoutCloser.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add Function options for declaring stdin and stdout stream requirements,
so Function stages can participate in file-preference negotiation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Explain the known deadlock risk for borrowed non-file stdin readers feeding a command that exits without draining stdin.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address gocritic, revive, and unused-code findings in the Pipe/runner helper code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@znull znull marked this pull request as ready for review June 16, 2026 14:13
Copilot AI review requested due to automatic review settings June 16, 2026 14:13
@znull znull requested a review from a team as a code owner June 16, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports review-driven fixes onto the Pipe / runner / Config branch, tightening lifecycle cleanup and making stream-requirement negotiation and related error reporting more robust and user-facing.

Changes:

  • Ensure pipeline context is canceled on pre-start failures and include stage names in invalid stream requirement errors.
  • Make Output() close any previously configured WithStdoutCloser destination before swapping stdout to an internal capture buffer.
  • Expose WithStdinRequirement / WithStdoutRequirement for Function stages, and document a known stdin limitation for non-file readers feeding command stages.
Show a summary per file
File Description
pipe/runner.go Closes any previously configured stdout closer before capturing output into a buffer.
pipe/pipeline.go Adds a lifecycle guard to prevent calling Output() after the pipeline has started.
pipe/pipeline_test.go Adds/updates tests for stdout-closer behavior, function stream requirements, and improved invalid-requirement error messages.
pipe/pipe.go Cancels derived context on startup failures and improves invalid stream requirement errors with stage names.
pipe/options.go Documents a known limitation when using borrowed non-file stdin readers with command stages.
pipe/function.go Exposes function-stage stream requirement options and reuses them in forbid helpers.
pipe/event_error.go Minor control-flow cleanup in Error() formatting.
pipe/config.go Fixes option-slice append logic to preserve Config immutability.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 8/8 changed files
  • Comments generated: 0

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.

2 participants