Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## Summary

*

## Test plan

* `cargo fmt --all --check`
* `cargo clippy --all-targets -- -D warnings`
* `cargo test --all-targets`

### Manual verification

<!-- Describe how a reviewer can manually verify the change.
If the change requires building the CLI with a local path override, include
setup/teardown steps so they can test with and without the fix. -->

**Setup:**

```bash
# In the cli repo, temporarily override the engine dependency:
cd cli/rust
# Edit Cargo.toml → cli-engine = { features = ["pkce-auth"], path = "../../cli-engine" }
cargo build --release && cp target/release/gddy ~/.local/bin/gddy
```

**Test WITHOUT the fix (baseline):**

```bash
cd cli-engine && git checkout main
cd cli/rust && cargo build --release && cp target/release/gddy ~/.local/bin/gddy
# <command to reproduce the issue>
# Expected: <describe broken behavior>
```

**Test WITH the fix:**

```bash
cd cli-engine && git checkout <this-branch>
cd cli/rust && cargo build --release && cp target/release/gddy ~/.local/bin/gddy
# <same command>
# Expected: <describe fixed behavior>
```

**Cleanup:**

```bash
# Revert cli/rust/Cargo.toml back to:
# cli-engine = { features = ["pkce-auth"], version = "<published-version>" }
```
8 changes: 2 additions & 6 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ impl Cli {
&self,
args: I,
stdout: &mut O,
stderr: &mut E,
_stderr: &mut E,
shutdown: Shutdown,
) -> std::io::Result<ExitCode>
where
Expand All @@ -999,11 +999,7 @@ impl Cli {
{
on_shutdown();
}
if output.exit_code == 0 {
stdout.write_all(output.rendered.as_bytes())?;
} else {
stderr.write_all(output.rendered.as_bytes())?;
}
stdout.write_all(output.rendered.as_bytes())?;
Ok(process_exit_code(output.exit_code))
}

Expand Down
12 changes: 6 additions & 6 deletions tests/foundation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ async fn cli_runtime_root_help_includes_find_commands_without_modules() {
}

#[tokio::test]
async fn cli_execute_from_writes_success_to_stdout_and_errors_to_stderr() {
async fn cli_execute_from_writes_all_output_to_stdout() {
// execute_from publishes the config-derived User-Agent process-wide, so this
// test shares the lock with the user-agent tests and restores the default
// on exit (including panic) via the RAII guard, while the lock is held.
Expand Down Expand Up @@ -502,13 +502,13 @@ async fn cli_execute_from_writes_success_to_stdout_and_errors_to_stderr() {
.await
.expect("execute should write");
assert_eq!(code, std::process::ExitCode::from(1));
assert!(stdout.is_empty());
let rendered = String::from_utf8(stderr).expect("utf8");
assert!(stderr.is_empty());
let rendered = String::from_utf8(stdout).expect("utf8");
assert!(rendered.contains("missing"));
}

#[tokio::test]
async fn cli_execute_from_shutdown_signal_writes_interrupt_to_stderr() {
async fn cli_execute_from_shutdown_signal_writes_interrupt_to_stdout() {
// execute_from_until_signal publishes the config-derived User-Agent
// process-wide; share the lock and restore the default (panic-safe) like above.
let _ua_guard = USER_AGENT_TEST_LOCK.lock().await;
Expand Down Expand Up @@ -540,9 +540,9 @@ async fn cli_execute_from_shutdown_signal_writes_interrupt_to_stderr() {
.expect("execute should write interrupt output");

assert_eq!(code, std::process::ExitCode::from(130));
assert!(stdout.is_empty());
assert!(stderr.is_empty());
assert_eq!(
String::from_utf8(stderr).expect("stderr should be utf8"),
String::from_utf8(stdout).expect("stdout should be utf8"),
"command interrupted\n"
);
assert_eq!(shutdown_count.load(Ordering::SeqCst), 1);
Expand Down