Skip to content

fix(gh,glab): don't pre-reject view/checks/run subcommands missing the id - #2123

Merged
aeppling merged 1 commit into
rtk-ai:developfrom
B-Galati:fix/optional-gh-glab-id
May 29, 2026
Merged

aeppling merged 1 commit into
rtk-ai:developfrom
B-Galati:fix/optional-gh-glab-id

Conversation

@B-Galati

Copy link
Copy Markdown
Contributor

Problem

gh and glab accept several subcommands without an explicit id and resolve it from the current branch (or open an interactive picker). RTK was pre-rejecting these with "X number required" before the underlying tool ever ran.

Example:

$ rtk glab mr view
rtk: MR number required

…even though glab mr view (no args) is valid and looks up the MR for the current branch.

Fix

Six call sites in gh_cmd.rs / glab_cmd.rs now treat the identifier as optional and forward the request unchanged, letting gh/glab decide:

  • gh pr view, gh pr checks, gh issue view, gh run view
  • glab mr view, glab issue view

A new private parse_optional_identifier helper in each file captures the (Option<id>, Vec<extra>) parse so the no-id branch is unit-testable.

format_run_view also drops the dangling # from its header when the run id is empty (interactive-picker passthrough).

Tests

8 new unit tests (1954 total, all passing):

  • parse_optional_identifier — empty / flags-only / with-id paths × 2 files
  • format_run_view — with and without an id
cargo fmt --all && cargo clippy --all-targets && cargo test --all
# clippy: clean, tests: 1954 passed, 6 ignored

End-to-end verified on glab mr view (now defers to glab; in this repo glab returns its own "no GitLab remote configured" message instead of RTK's pre-rejection).

…e id

gh and glab both accept several subcommands without an explicit id and
resolve it from the current branch (gh pr view, gh pr checks, glab mr
view) or open an interactive picker (gh run view). RTK was pre-rejecting
with "X number required" before the underlying tool ever ran.

Six call sites now treat the identifier as optional and forward the
request unchanged, letting gh/glab decide:

- gh pr view, gh pr checks, gh issue view, gh run view
- glab mr view, glab issue view

A new `parse_optional_identifier` helper in each file captures the
"(Option<id>, Vec<extra>)" parse so the no-id branch is unit-testable.
format_run_view also drops the dangling `#` from its header when the
run id is empty (interactive-picker passthrough).
@CLAassistant

CLAassistant commented May 27, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@B-Galati

B-Galati commented May 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @aeppling! Let me know please if anything is missing 🙏

@aeppling aeppling self-assigned this May 29, 2026
@aeppling

Copy link
Copy Markdown
Contributor

hey @B-Galati clean one

LGTM, thanks for contributing to RTK :)

@aeppling
aeppling merged commit 3c8d29a into rtk-ai:develop May 29, 2026
12 checks passed
@aeppling aeppling mentioned this pull request May 29, 2026
@B-Galati

Copy link
Copy Markdown
Contributor Author

Thanks 🙏

@B-Galati
B-Galati deleted the fix/optional-gh-glab-id branch May 29, 2026 20:38
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
rtk 0.42.3

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## [0.42.3](rtk-ai/rtk@v0.42.2...v0.42.3) (2026-06-05)

### Feats

- feat(copilot): CLI native integration #2101

### Fix

- fix(docs): replace remaining MIT license references with Apache 2.0 [#2084](rtk-ai/rtk#2084)
- fix: prevent crashes when output is piped rtk-ai/rtk#1048 close rtk-ai/rtk#1004
- fix(grep): parse single-file output containing colons rtk-ai/rtk#1554; close rtk-ai/rtk#1436.
- fix(ls): preserve permission info as octal when -l/-la is passed rtk-ai/rtk#1675
- fix(cicd): MIT to Apache 2.0 [#2092](rtk-ai/rtk#2092)
- fix(pkg): rtk is Apache 2.0 and no MIT [#2082](rtk-ai/rtk#2082)
- fix(hook): collapse bash line continuations before matching #1572 close Hook matcher: leading backslash-newline
  defeats command rewrite #1564
- fix(gh,glab): don't pre-reject view/checks/run subcommands missing the id rtk-ai/rtk#2123
- fix(git): fix panic on multibyte chars in commit output rtk-ai/rtk#1266

### Other

- docs(readme): add Portuguese translation #2128
- doc(init): fix documentation inconsistencies arount rtk init rtk-ai/rtk#2173
- fix(provider): sanatize more chars when encoding claude code project pathes https://github.com/rtk-ai/rtk/pull/2172</pre>
  <p>View the full release notes at <a href="https://github.com/rtk-ai/rtk/releases/tag/v0.42.3">https://github.com/rtk-ai/rtk/releases/tag/v0.42.3</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!10665
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.

3 participants