fix(sprint): use brace grouping for Board/sprint command (YT-3) #46

Merged
David merged 1 commit from fix/sprint-set-command-braces into main 2026-05-18 18:12:26 +02:00
Owner

Summary

yt issue sprint set --board "Investigator Database" --sprint "Sprint 1" IDB-87 [...] returned HTTP 400 Unknown command: Board "Investigator Database" "Sprint 1" from the YouTrack /api/commands endpoint. Root cause: build_apply_sprint_command in src/yt/query.rs emitted Go-style double-quoted values (ported verbatim from the Go CLI), but YouTrack's command-language parser groups multi-word values with curly braces, not double quotes. Same root cause confirmed against the raw yt issue apply --command 'Sprints "Sprint 1"' passthrough, which also 400'd against the live server.

Fix is one-line at the format-string level: emit Board {<board>} {<sprint>} instead of Board "<board>" "<sprint>". This matches the brace convention already used elsewhere in the same file (build_query for the sprint search filter at src/yt/query.rs:68). The go_quote helper is no longer used and was dropped.

Escape behavior for literal { or } inside a board or sprint name is intentionally left undefined; real-world names do not contain those characters and the existing build_query makes the same simplification. Easy to revisit if a user reports it.

YouTrack

YT-3 (closes)

Test plan

  • Updated apply_sprint_command_brace_groups_both_names (was ..._quotes_both_names) in src/yt/query.rs asserts the new wire format. Added apply_sprint_command_brace_groups_single_word_names to lock in single-word handling.
  • Removed apply_sprint_command_escapes_inner_quotes_and_backslashes since the Go-style escape behavior no longer applies; nothing in the new builder needs that level of escaping.
  • Updated three wiremock body-match tests (src/yt/api.rs::apply_command_posts_query_and_issue_ids, src/yt/api.rs::set_issues_sprint_builds_command_and_posts, and three src/commands/issue/sprint_set.rs::tests::*) to pin the new Board {X} {Y} shape. These would now fail loudly if the builder regressed to Go-style quotes.
  • just pre-commit passes (fmt, clippy, build, test). One pre-existing unrelated failure remains: commands::update::tests::check_writable_returns_friendly_message_on_readonly_dir, also fails on origin/main, unrelated to this change.
  • After merge, re-run the original failing invocation against isimcha.myjetbrains.com to confirm the live repro from YT-3 is fixed.
## Summary `yt issue sprint set --board "Investigator Database" --sprint "Sprint 1" IDB-87 [...]` returned HTTP 400 `Unknown command: Board "Investigator Database" "Sprint 1"` from the YouTrack `/api/commands` endpoint. Root cause: `build_apply_sprint_command` in `src/yt/query.rs` emitted Go-style double-quoted values (ported verbatim from the Go CLI), but YouTrack's command-language parser groups multi-word values with curly braces, not double quotes. Same root cause confirmed against the raw `yt issue apply --command 'Sprints "Sprint 1"'` passthrough, which also 400'd against the live server. Fix is one-line at the format-string level: emit `Board {<board>} {<sprint>}` instead of `Board "<board>" "<sprint>"`. This matches the brace convention already used elsewhere in the same file (`build_query` for the sprint search filter at `src/yt/query.rs:68`). The `go_quote` helper is no longer used and was dropped. Escape behavior for literal `{` or `}` inside a board or sprint name is intentionally left undefined; real-world names do not contain those characters and the existing `build_query` makes the same simplification. Easy to revisit if a user reports it. ## YouTrack YT-3 (closes) ## Test plan - [x] Updated `apply_sprint_command_brace_groups_both_names` (was `..._quotes_both_names`) in `src/yt/query.rs` asserts the new wire format. Added `apply_sprint_command_brace_groups_single_word_names` to lock in single-word handling. - [x] Removed `apply_sprint_command_escapes_inner_quotes_and_backslashes` since the Go-style escape behavior no longer applies; nothing in the new builder needs that level of escaping. - [x] Updated three wiremock body-match tests (`src/yt/api.rs::apply_command_posts_query_and_issue_ids`, `src/yt/api.rs::set_issues_sprint_builds_command_and_posts`, and three `src/commands/issue/sprint_set.rs::tests::*`) to pin the new `Board {X} {Y}` shape. These would now fail loudly if the builder regressed to Go-style quotes. - [x] `just pre-commit` passes (fmt, clippy, build, test). One pre-existing unrelated failure remains: `commands::update::tests::check_writable_returns_friendly_message_on_readonly_dir`, also fails on `origin/main`, unrelated to this change. - [ ] After merge, re-run the original failing invocation against isimcha.myjetbrains.com to confirm the live repro from YT-3 is fixed.
fix(sprint): use brace grouping for Board/sprint command (YT-3)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 14s
Create release / Create release from merged PR (pull_request) Has been skipped
e75e2f1768
`yt issue sprint set` failed with HTTP 400 `Unknown command: Board "Investigator Database" "Sprint 1"` because the command-language builder emitted Go-style double-quoted values (ported verbatim from the Go CLI). YouTrack's `/api/commands` parser groups multi-word values with curly braces, not double quotes, so the rendered command was rejected outright.

Switch `build_apply_sprint_command` in `src/yt/query.rs` to emit `Board {<board>} {<sprint>}`, matching the brace convention already used by `build_query` for the sprint search filter (`Board <b>: {<s>}`). Drop the now-unused `go_quote` helper. Update the three wiremock body-match tests in `src/yt/api.rs` and `src/commands/issue/sprint_set.rs` that pinned the old wire format.

Escape behavior for literal `{` or `}` inside a board or sprint name is left undefined; no real-world names hit that case and the existing `build_query` makes the same simplification. Worth revisiting if a user reports it.

#YT-3 State Done
David merged commit fb6c06a108 into main 2026-05-18 18:12:26 +02:00
David deleted branch fix/sprint-set-command-braces 2026-05-18 18:12:27 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pandoras-box/youtrack-cli!46
No description provided.