fix(issue): tolerate null fields in comment and link decode (YT-11) #55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-inspect-null-fields-YT-11"
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?
Summary
Fixes YT-11.
yt issue inspectwas dropping the entirecommentsandlinksarrays into awarningsentry whenever YouTrack returned an explicit JSONnullfor an optional field on a comment (created/updated for system- or agent-authored comments) or on a link type (localizedName / sourceToTarget / targetToSource on link types without those labels).#[serde(default)]covers the missing case but rejects explicit null, so a single null upstream blanked the whole sub-fetch.Changes
src/yt/models.rs:IssueComment.created/updatedare nowOption<i64>per the issue's proposed approach.IssueLinkType.localized_name/source_to_target/target_to_sourceare nowOption<String>(withskip_serializing_if = "Option::is_none"so--jsonoutput stays clean).IssueComment.text,Issue.summary,Author.login,Author.full_name,IssueLinkType.name, andIssueLinkType.directeduse the existingnull_or_missing_to_defaulthelper so the type stays stable for consumers and a JSON null no longer kills decode.src/commands/issue/inspect.rs:print_commentprints-whencreatedisNone;pick_link_labelwalksOption<String>link-type labels withas_deref+is_emptyguards.IssueComment,IssueLinkType, andIssueLink(with a nullsummaryinside the nestedIssue). Updated existingpick_link_labeland full-inspect render fixtures for the new shape.Verification
Live smoke test against
niceguyit.myjetbrains.comconfirms all acceptance criteria:yt issue inspect MK-16returns the three agent-authored comments with full body text and no warnings (was: emptyRecent comments:plus twoinvalid type: nullwarnings).yt issue inspect --json MK-16returnslen(comments) == 3, each with a populatedtextfield, andwarnings == [].yt issue inspect YT-11no longer emits the two decode warnings cited in the issue description.cargo test --all-targets: 285 passed, 0 failed.cargo clippy --all-targets -- -D warnings: clean.The
comments-endpoint failure column 7442 /links-endpoint failure column 101 both reproduced before this patch and are gone after it.Test plan
cargo test --all-targetspasses locally.cargo clippy --all-targets -- -D warningspasses locally.yt issue inspect MK-16against live YT shows all three comments with no warnings.yt issue inspect --json MK-16populatescommentsandwarningsis empty.yt issue inspect YT-11against live YT shows no decode warnings.--jsonoutput still parses for any tooling that depends onlocalized_namealways being a string (the field is now omitted when null instead of being an empty string).YouTrack issue: YT-11. Will auto-transition to
Doneon merge via the commit trailer.