fix(issue): decode links per-entry, add linked-issue resolution (YT-14) #58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-links-resolved-null-YT-14"
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?
Resolves YT-14.
Problem
yt issue inspectfetched an issue's links by decoding the whole/linksarray intoVec<IssueLink>in one request. A single malformed entry failed the entire decode, so the links array was discarded wholesale: the formatted view printedLinks: (none)and--jsonreturnedlinks: [], with a warning surfaced. The nullable string fields on the link-type struct were alreadyOption<String>(from YT-11), but a strict whole-array decode still meant one bad element blanked everything. There was also no way to tell from a link whether the linked issue was already resolved without a secondinspectcall per link.Change
Decode each link entry independently. The outer array is parsed as untyped JSON first, then each element is decoded into
IssueLinkon its own; a malformed entry is skipped with alinks: skipped entry <idx>warning while the valid entries survive.Add the linked issue's resolution to both the requested fields (
issues(idReadable,summary,resolved)) and the emitted JSON.Issuegains aresolved: Option<i64>holding the YouTrack resolution timestamp (epoch millis),Nonewhen the issue is still open and omitted on serialize when absent. The formatted link list marks resolved linked issues with a[resolved]suffix.Per-link JSON shape now carries the link type name and direction (
sourceToTarget/targetToSource/directed) plus the linked issue (idReadable,summary,resolved), so a consumer can decide dependency readiness from a singleinspect.Acceptance criteria
yt issue inspect <id> --jsonreturns populatedlinkswith no decode failure whenlinkType.localizedName(or another optional string) is null.resolvedtimestamp,nullwhen open) so dependency readiness is decidable without an extrainspectper link.Tests
yt::api::tests::inspect_issue_skips_malformed_link_entry_and_keeps_rest: a nulllocalizedNameplus a resolved linked issue decode cleanly; a malformed sibling entry is skipped with exactly one indexed warning and the good entry survives.yt::models::tests::issue_resolved_decodes_and_round_trips:resolveddecodes from a timestamp, round-trips on serialize, and is omitted when null.cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo build --all-targets,cargo test --all-targets(308 passing).