You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(command): Action options run the middlewares - #135
Action options such as --version now run instead of the selected command, with applicable middleware applied to the action result.
Bug Fixes
Help requests now run runner middleware, including help requested after a nested subcommand. Actions on nested commands stop command traversal at the command where the action option is defined.
No actionable comments were generated in the recent review.
Walkthrough
CommandRunner now checks for action options before descending to nested commands. When specified, the action runs through the middleware of the command that defines it, and the command chain stops. Tests cover action options at runner, branch, and leaf levels, and update middleware expectations for help requests.
_runNested checks for a specified action option before descending. It runs the action through the defining command’s middleware and stops the chain. Documentation describes action options and limits the documented help behavior to --help and -h.
Tests cover runner-, branch-, and leaf-level action options, including middleware-wrapped results and skipped commands. Help tests now expect runner middleware in the trace.
sequenceDiagram
participant CommandRunner
participant CommandMiddleware
participant ActionOption
participant NestedCommand
CommandRunner->>CommandMiddleware: Run action through defining command middleware
CommandMiddleware->>ActionOption: Invoke action
ActionOption-->>CommandMiddleware: Return action result
CommandMiddleware-->>CommandRunner: Return middleware-wrapped result
Note over CommandRunner,NestedCommand: Nested command does not run when an action option is specified
Loading
Possibly related PRs
serverpod/cli_tools#134: Introduces the CommandRunner framework, including middleware and action handling that this change updates.
Suggested reviewers:nielsenko
Merge Risk: Minimal · up to 37193
Action options such as --version now run through the middleware of the command that defines them, and the command chain stops there. Help requests now also run runner middleware. Tests cover the new behavior, and no merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title says action options run the middlewares. The change makes _runNested check for a specified action option, run it through the defining command's middleware, and stop the chain there. Tests …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title says action options run the middlewares. The change makes _runNested check for a specified action option, run it through the defining command's middleware, and stop the chain there. Tests cover --version as a runner global option action and branch and leaf action options, with middleware running around the action. The title names the main change. It follows the conventional commit style used by the commit message.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Essentials
Run ID: 457ee28b-c9a2-416b-941b-e2a38397a59d
Commits
Reviewing files that changed from the base of the PR and between b628aa8 and 371938a.
Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
--versionnow run instead of the selected command, with applicable middleware applied to the action result.