#15

feat(stack): add landing commands

DraftstylesshContributorwants to merge intofrom

Summary

  • add try stack land, try stack land-status, and try stack land-cancel
  • resolve repository context and render current landing status for human and JSON output
  • cover the public API methods, paths, and request bodies with command tests

Verification

  • cargo fmt --check
  • cargo test config::cli::tests::test_stack_api_flags_parse
  • cargo test --test trylle_cli_commands_mock stack_landing_commands_use_the_public_api
  • full cargo test: all 263 unit tests pass; the existing macOS /private/var versus /var path assertion in tests/about_cli.rs fails

Companion platform branch: stylessh/stack-landing

Activity

3
trylle-botreviewed4mo ago
trylle-bot4mo ago

Reviewed the full diff against the surrounding code in src/trylle/mod.rs, src/trylle/api.rs, and src/main.rs. The command wiring, request paths, and body shapes all match the existing conventions in this file, and the test coverage of the API surface (methods, paths, Do/allow_stack_partial_merge bodies) is genuinely good — stack_landing_commands_use_the_public_api asserts the request bodies, not just the responses.

Three findings, left inline. One I'd consider blocking.

Blocking

  • stack status exits 1 when no landing exists (src/trylle/mod.rs:2807). stack_landing_from_status errors on absent/null stackLanding, and main.rs turns that into exit(1) with empty stdout — even under --json. "Not started yet" is the normal state for the obvious polling loop, so try stack status --json | jq breaks and set -e scripts abort. Suggest emitting Value::Null for status (the prevailing idiom in this file) while keeping the hard error for cancel.

Non-blocking

  • Unencoded landing_id in the request path (src/trylle/mod.rs:2827). Every other dynamic segment here goes through api::encode_segment; this one is server-controlled and interpolated raw. reqwest::Url::parse collapses ../, so a malformed id retargets an authenticated POST rather than 404ing. Latent today, one-line fix.
  • Cancel is a read-then-write with no revalidation, and ignores cancelable (src/trylle/mod.rs:2814). A landing that completes between the GET and the POST means cancelling a different landing than the user saw. Separately, the cancelable flag in the response is never read (grep -rn cancelable src/ is empty), so cancelling a terminal landing surfaces as a raw HTTP 4xx string.

Coverage notes

  • No test exercises the missing-stackLanding path at the command level — extracts_stack_landing_from_pull_status covers the helper in isolation, which is why the exit-code behavior above isn't caught.
  • No test covers the id-missing branch (landing present but no id), nor --pull omitted so resolve_stack_pull falls back to the current branch.
  • The naming in the PR body doesn't match the code: the description says try stack land / land-status / land-cancel, but the subcommands are merge / status / cancel. Worth reconciling before this lands so the release notes are right.

I did not run the build — no Rust toolchain in this sandbox, so the cargo test results in the PR description are taken as reported and not independently verified.

This pull request is a draft

Merging is unavailable until it is marked ready for review.