Skip to content

/person/{id}/tagged_images ignores the page parameter, so allTaggedImages yields duplicates #488

Description

@adamayoung

Origin: Surfaced by the live probing done for issue #437 (delivered as PR #486). Deliberately deferred — it is a distinct defect from the media-type modelling that PR was scoped to, and its fix is undecided. PR #486 records the measurement in knowledge/tmdb-api-notes.md.

Problem

/person/{id}/tagged_images ignores the page query parameter. The library sends it — Sources/TMDb/Domain/Adapters/Person/PersonTaggedImagesRequest.swift builds page as a query item, and TMDbPersonService.taggedImages(forPerson:page:) exposes it — but TMDb returns the same rows regardless, so the parameter is inert.

As of main @ d455d45 (behaviour is server-side, so no library line is wrong; the issue is that the public API advertises pagination the endpoint does not honour).

Failure scenario

Measured 2026-08-20 against person 17419, 24 requests / 378 rows:

  • ?page=1, ?page=2 and ?page=3 return identical result ids.
  • The response's own page field is 0 on every request — not 1, and not the requested value.
  • It reports total_pages: 2 and total_results: 35 while only ever serving one page's worth of rows.

Two concrete consequences:

  1. allTaggedImages(forPerson:) yields duplicates. PagedAsyncSequence advances page and requests the next one; the API serves the same rows again. A caller iterating the sequence sees each image repeated once per page walked, and the sequence terminates only because total_pages is finite — not because the data was exhausted.
  2. taggedImages(forPerson:page:) silently ignores its own argument. A caller passing page: 2 gets page 1's contents with no error and no indication.

The captured fixture Tests/TMDbTests/Resources/json/tagged-image-pageable-list.json preserves the "page": 0 quirk verbatim, and TaggedImagePageableListTests.swift asserts it with a comment, so the evidence is pinned in-repo.

Fix sketch

The library cannot make the endpoint paginate; the question is what to do about advertising it.

Options, roughly in increasing cost:

  1. Document it. Add a DocC note on taggedImages(forPerson:page:) and allTaggedImages(forPerson:) stating that TMDb ignores page here, so the sequence may repeat rows. Cheapest, non-breaking, and honest.
  2. Deprecate the page parameter on this one method, since it cannot do anything.
  3. De-duplicate in allTaggedImages by tracking seen image ids and stopping when a page adds nothing new. This changes PagedAsyncSequence behaviour for one endpoint and needs care — see knowledge/gotchas.mdAn all-dropped page doesn't shorten the sequence — it ends it, which is the neighbouring hazard.
  4. Report it upstream to TMDb as an API bug, and do (1) meanwhile.

Worth confirming first whether other PageableListResult endpoints share the quirk, or whether tagged-images is unique — a one-endpoint fix and a library-wide one are different changes. Nothing else was measured this way.

Decision needed: whether to document, deprecate, or de-duplicate. All three are defensible and they are not mutually exclusive.

Breaking class: none for option 1; source-breaking for option 2; behavioural for option 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions