fix(mcp): resolve link target to its internal id on removal #131
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/YT-78-remove-issue-link-internal-id"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The DELETE path for a link removal (
/api/issues/{id}/links/{slot}/issues/{target}) requires the target's INTERNAL issue id in the trailing segment; the readable id the caller supplied was interpolated verbatim, so everyremove_issue_linkcall made with readable ids 404d with "Entity with id ROCI-55 not found" even though the link existed. The source issue and the link slot were already resolved, which is why only the trailing entity failed.delete_linknow resolves the target through/api/issues/{ref}?fields=id,idReadable, which accepts either id form, so readable and internal ids both work andremove_issue_linkis a true inverse oflink_issues. Resolving the target also makes it cheap to check the slot's member list first, so removing a link that does not exist is now anApiError::Invalidsurfaced as an MCP invalid-params error naming the missing link, distinct from an unresolvable issue id.Tests cover both link directions, an internal target id, the missing-link error, and an end-to-end create-then-remove entirely by readable id asserting
linkedIssueCountsdrops.#YT-78
The DELETE path for a link removal (`/api/issues/{id}/links/{slot}/issues/{target}`) requires the target's INTERNAL issue id in the trailing segment; the readable id the caller supplied was interpolated verbatim, so every `remove_issue_link` call made with readable ids 404d with "Entity with id ROCI-55 not found" even though the link existed. The source issue and the link slot were already resolved, which is why only the trailing entity failed. `delete_link` now resolves the target through `/api/issues/{ref}?fields=id,idReadable`, which accepts either id form, so readable and internal ids both work and `remove_issue_link` is a true inverse of `link_issues`. Resolving the target also makes it cheap to check the slot's member list first, so removing a link that does not exist is now an `ApiError::Invalid` surfaced as an MCP invalid-params error naming the missing link, distinct from an unresolvable issue id. Tests cover both link directions, an internal target id, the missing-link error, and an end-to-end create-then-remove entirely by readable id asserting `linkedIssueCounts` drops. #YT-78