feat(issue): add a clear verb for single-value custom fields #134

Merged
Claude-Run merged 1 commit from feat/YT-80-clear-custom-field into main 2026-08-01 02:37:32 +02:00
Member

Every write path in the repo constructed a non-null value, so a single-value custom field such as AI Agent could be set but never returned to its unset state. list_issue_custom_fields already reports a cleared field as null, so the read side modelled absence correctly while the write side could not produce it.

Adds clear_custom_field to youtrack-client: the same POST the set path uses, with value as JSON null, routed through post_with_type_retry so the discover-on-400 $type fallback applies identically. That makes it field-generic rather than enum-specific: AI Agent clears as SingleEnumIssueCustomField, Due Date clears as the discovered DateIssueCustomField. post_with_type_retry now takes &(dyn Fn(&str) -> Value + Sync) so the returned future stays Send, which the MCP tool dispatch requires of every handler it boxes.

Exposes it as the MCP clear_issue_field tool and as yt issue clear-field <ISSUE_ID> <FIELD>, which honours the global --dry-run flag and --json. Clearing an already-unset field is a no-op that reports success (nothing reads the current value first); clearing a field the project marks required fails with YouTrack's own 400 body surfaced to the caller rather than a silent success. There is no pre-check for required-ness: that would cost an admin-endpoint round trip on every call, and the admin endpoint is already known to be inaccessible to non-admin tokens.

#YT-80

Every write path in the repo constructed a non-null `value`, so a single-value custom field such as `AI Agent` could be set but never returned to its unset state. `list_issue_custom_fields` already reports a cleared field as `null`, so the read side modelled absence correctly while the write side could not produce it. Adds `clear_custom_field` to youtrack-client: the same POST the set path uses, with `value` as JSON null, routed through `post_with_type_retry` so the discover-on-400 `$type` fallback applies identically. That makes it field-generic rather than enum-specific: `AI Agent` clears as `SingleEnumIssueCustomField`, `Due Date` clears as the discovered `DateIssueCustomField`. `post_with_type_retry` now takes `&(dyn Fn(&str) -> Value + Sync)` so the returned future stays `Send`, which the MCP tool dispatch requires of every handler it boxes. Exposes it as the MCP `clear_issue_field` tool and as `yt issue clear-field <ISSUE_ID> <FIELD>`, which honours the global `--dry-run` flag and `--json`. Clearing an already-unset field is a no-op that reports success (nothing reads the current value first); clearing a field the project marks required fails with YouTrack's own 400 body surfaced to the caller rather than a silent success. There is no pre-check for required-ness: that would cost an admin-endpoint round trip on every call, and the admin endpoint is already known to be inaccessible to non-admin tokens. #YT-80
feat(issue): add a clear verb for single-value custom fields
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 40s
Create release / Create release from merged PR (pull_request) Has been skipped
62b44fee6e
Every write path in the repo constructed a non-null `value`, so a single-value custom field such as `AI Agent` could be set but never returned to its unset state. `list_issue_custom_fields` already reports a cleared field as `null`, so the read side modelled absence correctly while the write side could not produce it.

Adds `clear_custom_field` to youtrack-client: the same POST the set path uses, with `value` as JSON null, routed through `post_with_type_retry` so the discover-on-400 `$type` fallback applies identically. That makes it field-generic rather than enum-specific: `AI Agent` clears as `SingleEnumIssueCustomField`, `Due Date` clears as the discovered `DateIssueCustomField`. `post_with_type_retry` now takes `&(dyn Fn(&str) -> Value + Sync)` so the returned future stays `Send`, which the MCP tool dispatch requires of every handler it boxes.

Exposes it as the MCP `clear_issue_field` tool and as `yt issue clear-field <ISSUE_ID> <FIELD>`, which honours the global `--dry-run` flag and `--json`. Clearing an already-unset field is a no-op that reports success (nothing reads the current value first); clearing a field the project marks required fails with YouTrack's own 400 body surfaced to the caller rather than a silent success. There is no pre-check for required-ness: that would cost an admin-endpoint round trip on every call, and the admin endpoint is already known to be inaccessible to non-admin tokens.

#YT-80
Claude-Run deleted branch feat/YT-80-clear-custom-field 2026-08-01 02:37:32 +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!134
No description provided.