feat(issue): yt issue history reads activity stream (YT-4) #47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/issue-history"
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
Adds
yt issue history <ID>for reading a YouTrack issue's activity stream. Flags:--category(repeatable),--since,--until(YYYY-MM-DDUTC, converted to ms-since-epoch on the wire),--limit(default 100, paginates with$top/$skipuntil satisfied), and--json.The motivating use case from YT-4 is finding issues where YouTrack silently reset
StatefromDonetoTo doafter a project move (when the destination project's State bundle differs from the source). That pattern appears in the default human output as two adjacent rows: anIssueProjectCategoryentry with the project shortName flip, followed immediately by aCustomFieldCategoryentry wherefield=Stateandremoved -> addedshows the State values.YouTrack
YT-4 (closes)
What got added
src/yt/models.rs: newActivity,ActivityCategory,ActivityField,ActivityCustomFieldRef.added/removedstored as untypedserde_json::Valuebecause their shape varies per category, same pattern asCustomField.value.src/yt/api.rs:list_issue_activities(client, issue_id, categories, since, until, limit)handles pagination and query-param assembly.src/cli.rs:IssueCommands::History(IssueHistoryArgs)variant + args struct.src/commands/issue/history.rs: new module withrun,render,parse_ymd_to_ms_utc,summarize/summarize_one, plus tests.src/commands/issue/mod.rs: one line of dispatch wiring.Discovery worth flagging
YouTrack's
/api/issues/<id>/activitiesendpoint REQUIRES thecategories=query param. A missing or empty filter returns HTTP 400No requested categories specified as a filter parameter. The YT-4 issue body's "Default: all categories" assumption was wrong; there is no wildcard on the wire. The CLI papers over this with a curatedDEFAULT_CATEGORIESlist atsrc/commands/issue/history.rs:15(creation, summary, description, custom field, project, comments, links, tags, sprint, attachments, work items) used when the caller passes no--categoryflag. Users wanting a narrower or wider set pass explicit--categoryflags.Test plan
src/commands/issue/history.rs: date parsing happy/sad path, summarize for object/array/null shapes, smoke-render, query-param wiring (categories/start/end), JSON mode, missing-credentials error, zero-limit error.src/yt/api.rs:list_issue_activities_decodes_each_categorycovers all three motivating categories (CustomFieldCategory,IssueProjectCategory,CommentsCategory) in a single response;list_issue_activities_paginates_and_respects_limitcovers$top/$skipand the--limittruncation path.just pre-commitpasses (fmt, clippy, build, test). Same pre-existing unrelatedcommands::update::tests::check_writable_returns_friendly_message_on_readonly_dirflake as in #45 and #46; reproduces onorigin/main, out of scope.niceguyit.myjetbrains.com:yt issue history YT-2 --limit 5returns creation, two comments, and the recentState To do -> In Progresstransition (the one this PR-author triggered earlier today).Out of scope / follow-up
/api/activitiesPage(cursored, multi-issue). Called out as a deferred follow-up in YT-4. The per-issue command shipped here is ergonomic enough that a Nushelleachloop builds the scan in a single shell pipeline.