Skip to content

Run then: chains from GenericManager - #42

Merged
andrew merged 3 commits into
mainfrom
run-then-chains
Sep 16, 2026
Merged

andrew merged 3 commits into
mainfrom
run-then-chains

Conversation

@andrew

@andrew andrew commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

BuildCommands and Command.Then existed but every GenericManager
operation called BuildCommand (singular), so gomod add never ran
go mod tidy and renv add/remove/update never ran renv::snapshot.

Route all operations except Path through a run() helper that executes
the full chain, stopping on the first non-zero exit. On success the
result is the primary command's; on failure it is the failing
command's so callers see what broke.

Fixes #39


Stack created with GitHub Stacks CLIGive Feedback 💬

@andrew
andrew added this pull request to stack #43 September 15, 2026 18:18
@andrew
andrew requested a lite review from Copilot September 15, 2026 18:20

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@andrew
andrew marked this pull request as ready for review September 15, 2026 20:37
Base automatically changed from add-version-suffix to main September 16, 2026 07:06
BuildCommands and Command.Then existed but every GenericManager
operation called BuildCommand (singular), so gomod add never ran
`go mod tidy` and renv add/remove/update never ran `renv::snapshot`.

Route all operations except Path through a run() helper that executes
the full chain, stopping on the first non-zero exit. On success the
result is the primary command's; on failure it is the failing
command's so callers see what broke.

Fixes #39
The chain executor discarded every result after the first, so callers
could not see which follow-up commands ran or read their output. Add
Result.Then to carry them and make Success() consider the whole chain.

Replace still called BuildCommand directly, so a then: entry on any
operation it invokes was ignored. Route each replace step through the
chain executor and attach subsequent operation results to the first
result's Then.
A Runner that returns (nil, err) for a follow-up command, as
PolicyRunner does on a violation, had nil appended to first.Then
before the error check, so Success() on the returned Result panicked.
Skip the append when res is nil and stop the chain.
@andrew
andrew merged commit 44b8246 into main Sep 16, 2026
5 checks passed
@andrew
andrew deleted the run-then-chains branch September 16, 2026 07:14
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.

GenericManager operations ignore then: chains

2 participants