Skip to content

fleet-dispatch-test: page_items treats a malformed page as an empty final page, silently truncating the listing (from PR #9149) #9556

Closed

Description

@dezren39

Finding (from PR review, never addressed)

page_items in pkgs/fleet/crates/fleet-dispatch-test returns an empty vector for any page body that has no array field — including a malformed page whose array field is null or absent — so fetch_all_pages treats the malformed page as an empty final page, returns Ok, and append_page rewrites total_count to the partial length: the listing ends silently short, against this crate's own "never truncate silently" rule.

CodeRabbit (Minor, Data Integrity & Integration) in its review on PR #9149, pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs:421:

"Reject malformed pages instead of treating them as an empty final page. page_items returns an empty vector for any body that has no array. This includes an object whose array field is null or absent. fetch_all_pages then treats that page like an empty final page, returns Ok, and append_page rewrites total_count to the partial length. The listing ends without an error and reports a short count. This conflicts with the stated rule to never truncate silently. Distinguish a missing or non-array field from a real empty array. A legitimate [] or "workflow_runs": [] must keep ending the walk. A missing or non-array page must return an error that names the listing. Add a test with a second page of {"workflow_runs": null} that expects Err."

Evidence

No-response evidence

Still live on current main (verified 2026-11-13 by the pr-comment-review job)

  • pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs on main: page_items (line 410) returns Vec::new() whenever the body is neither a bare array nor an object containing an array value — a {"workflow_runs": null} page yields the empty vec.
  • fetch_all_pages (line 460) stops the walk when a page's item count is below PAGE_SIZE and returns Ok(merged); append_page (line 428) rewrites an object body's total_count to the merged (partial) length. A malformed second page therefore produces a silent short count presented as exact.

Acceptance criteria

  • page_items / the page-reading path used by fetch_all_pages distinguishes a real empty array (ends the walk) from a missing or non-array listing field (returns an error naming the listing).
  • A regression test covers a second page of {"workflow_runs": null} expecting Err, and a real empty array page still terminates the walk normally.
  • Or: resolve by a documented decision on this issue explaining why treating malformed pages as final pages is acceptable here despite the never-truncate-silently rule.

Filed by the pr-comment-review job from an unaddressed PR review comment (source: PR #9149). This issue deliberately does not reply to or resolve the source review thread.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 13, 2026
  2. developing-today commented on Nov 13, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    Triage (task 16110, lane any-b, 2026-11-13): small-fix, priority/normal, effort/s. Fixing inline in this same claim.

    Fresh verification:

    Labels decided: task/small-fix (replaces task/triage), priority/normal (stands), effort/s, kind/bug (stands).

    Fix plan (acceptance): page_items returns Result — a bare array or an object with an array field is a page (a real empty array still ends the walk); an object with no array field, or a non-container body, is Err naming the listing fields present. append_page/fetch_all_pages propagate. Regression test: full first page + second page {"workflow_runs": null} expects Err naming workflow_runs; object page with {"workflow_runs": []} still terminates normally; malformed first page also errors.

  5. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    effort/sSmall: expected under 2 hours of work
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 13, 2026
  6. added a commit that references this issue on Nov 13, 2026
  7. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    Done (task 16110, lane any-b, 2026-11-13): fixed and merged via PR #9562, merge commit d3e02af. This issue auto-closed via the PR's Closes line.

    • page_items now returns Result: a malformed page (listing field null/absent, or a non-container body) errors naming the fields present instead of reading as an empty final page; append_page/fetch_all_pages propagate. A real empty array page still ends the walk.
    • Oracle: cargo test -p fleet-dispatch-test — 23 passed, 0 failed on the laptop, including new regression test pagination_malformed_page_errors_instead_of_truncating (second page {"workflow_runs": null} → Err naming workflow_runs; malformed first page → Err; {"workflow_runs": []} terminates with 100 runs and total_count 100). cargo fmt --check clean.
    • Review gate: Codex's review run failed to execute (usage limits) and produced no findings; CodeRabbit posted only a rate-limit notice — disposition recorded on PR fix(fleet-dispatch-test): malformed list page errors instead of silently truncating (#9556) #9562 before merge.
  8. dezren39 commented on Nov 13, 2026

    @dezren39
    MemberAuthor

    Agent note — already done (task 16115, lane code-c)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/fleetpkgs/fleet multicall binary + platform crateseffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-comment-reviewFiled by the pr-comment-review jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions