Repository navigation
Name the subcommand for hooks and output logs run through Main - #1963
Merged
Merged
Conversation
`kamal app boot` records Main's `app` invocation before App's `boot`, and the subcommand was only taken from the first invocation, so every real subcommand run from the command line came out as nil: hooks got no KAMAL_SUBCOMMAND and output logs were named `app` rather than `app_boot`. Tests calling the subcommand class directly record App's invocation first, which is why they didn't notice. When the first invocation is Main running a subcommand, look up that subcommand class's own first invocation instead.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
11 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Running a subcommand from the command line never told anyone which subcommand it was.
kamal app bootgave its hooksKAMAL_COMMAND=appand noKAMAL_SUBCOMMAND, and an output logger named its file…_app.lograther than…_app_boot.log. The OTel logger's command wasappas well.subcommandlooked only at the first invocation Thor recorded. Run through Main, that's Main's ownapp, which dispatches to App'sboot, so the subcommand always came out nil. The tests didn't notice because they callKamal::Cli::App.startdirectly, where App's invocation is the first one.When the first invocation is Main running a subcommand, this looks up that subcommand class's own first invocation instead. Top-level commands are unchanged:
kamal deploystill has no subcommand, even though it invokesapp bootalong the way, andkamal proxy rebootis stillproxy rebootthrough theapp bootit invokes. The lookup doesn't add an entry to Thor's invocations hash, so it can't affect theinvokebookkeeping thatreset_invocationrelies on.The new test runs
kamal app bootthroughMain.startand checks both the hook's environment and themodify.kamalpayload the output loggers name their files from. It fails on main ({"KAMAL_COMMAND" => "app"}).Unit suite: 861 runs. The only failures are the 7 that also fail on main without a Docker builder (CliBuildTest ×4, CommandsBuilderTest ×2, ConfigurationBuilderTest ×1). RuboCop is clean.