fix: enforce no-silent-truncation on every collection read #81
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pagination-invariant-sweep"
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?
Problem
YTCLI-26 (PR #80) fixed
list_projectsafter the missing-pagination bug surfaced as a falseproject 'VAPP' not foundin production. That fix addressed one site. An invariant sweep of the whole client found the same defect across many call sites: the reported bug was one instance of a class.Invariant: a collection read must never silently truncate. When
$topis omitted, the YouTrack REST server caps the response at its default page size (42 rows) and drops the tail. Every collection read must page with$top/$skipuntil a short page, or be explicitly bounded with a stated reason.Change
Add a shared
fetch_all_pages<T>helper (pages$top=100/$skipuntil a short page, same shape asfetch_all_sprints) so the invariant lives in one place, and route every violating site through it:Top-level collections:
list_boards(/api/agiles),fetch_issues(/api/issues?query),check_work(assigned-issue query and the per-issue work-item probe),list_projects(/api/admin/projects, refactored onto the helper),resolve_vcs_server_id(/api/admin/vcsServers),list_link_types(/api/issueLinkTypes),list_articles(when no explicit--top; an explicit--topstays a deliberate single-page bound),resolve_timeline_ids(/api/issues?query).Per-issue subcollections that also cap at 42 on active issues: issue-inspect comments and work items,
list_work_items_full,list_attachments.Left unchanged (already compliant):
fetch_all_sprints,list_issue_activities,list_users(caller-bounded via requiredtop), thelistcommand auto-paginate andfetch_issues_page. Domain-bounded N/A (capped by the data model well under 42): per-issue sprint membership, per-issue link slots, per-project custom fields.Tests
Added a wiremock pagination test per converted function (full first page of 100 plus a partial second page returns 101), a direct
fetch_all_pagesloop test, and aget_projectregression proving a project on page two resolves instead of erroring. Client crate: 137 tests (was 126).just pre-commit(fmt, clippy -D warnings, build, test) passes.Supersedes
This supersedes PR #80: it re-implements the
list_projectsfix on the shared helper and fixes the rest of the class in one change. Closing #80 in favor of this.Fixes YTCLI-27. Fixes YTCLI-26.