Skip to content

feat: sync Java client with apify-client-js reference updates and spec v2-2026-10-01T153946Z - #20

Open
Pijukatel wants to merge 2 commits into
masterfrom
claude/sharp-clarke-ciag1b
Open

Pijukatel wants to merge 2 commits into
masterfrom
claude/sharp-clarke-ciag1b

Conversation

@Pijukatel

@Pijukatel Pijukatel commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Syncs the Java client against the OpenAPI spec (v2-2026-09-28T115051Z → v2-2026-10-01T153946Z, apify/apify-docs#3024, apify/apify-docs#3037) and the cross-language-relevant subset of the apify-client-js v3 rewrite (apify/apify-client-js#985 … #1104).

  • Build.getImageDigest() (spec: Build.imageDigest).
  • Fix ScheduleClient.getLog(): it returned the raw response body as text, but the endpoint returns a JSON envelope of ScheduleInvoked entries.
  • Fix DatasetClient.iterateItems() to paginate by the X-Apify-Pagination-Count scanned-row count whenever that count is nonzero. This covers both server-side item filters and unwind, which can push the returned count above or below the scanned count. It falls back to the returned count only when the header reports an implausible 0 alongside real returned items, which was seen as a transient eventual-consistency artifact on the live API right after a write.
  • Add ApifyApiException subclasses by HTTP status (InvalidRequestError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, RateLimitError, ServerError).
  • A 404 on a resource client reached through a run or build with no ID of its own (run.dataset(), run.keyValueStore(), run.requestQueue(), run.log(), build.log()) now throws NotFoundError instead of resolving to empty or no-op. DatasetClient.getStatistics() and TaskClient.getInput() likewise throw on 404 instead of returning Optional.empty().
  • Harden ResourceContext.toSafeId/encodePathSegment against path traversal.
  • Skip request-body compression for content types that already carry their own compression.
  • Fix ApifyClientBuilder base URL normalization doubling /v2 when the caller already included it.
  • Add createItemsPublicUrl(options, expiresInSecs, format) overload.

Bumps Version.API_SPEC_VERSION and bumps Version.CLIENT_VERSION to 0.7.0.

Review: /review-client round 1 was rejected with one high-severity finding: the pagination guard broke unwind iteration. It is fixed in d37d5b2 together with a regression test and the remaining review items. Round 2 was Approved with no open items.

Verified locally: spotless:check, compile spotbugs:check, -Prelease package (javadoc), unit tests (164/164), integration tests (69/69, live API), ExamplesTest+DocSnippetsTest (8/8, live API). CI test is green on d37d5b2.

…c v2-2026-10-01T153946Z

- Add Build.getImageDigest() (spec apify-docs#3037).
- Fix ScheduleClient.getLog(): was returning the raw response body as text; the
  endpoint returns a JSON envelope of ScheduleInvoked entries.
- Fix DatasetClient.iterateItems() to paginate by the X-Apify-Pagination-Count
  scanned-row count (falling back to the returned count when the header is
  absent or implausibly low), fixing repeated/skipped items when combined with
  server-side item filters.
- Add ApifyApiException subclasses by HTTP status (InvalidRequestError,
  UnauthorizedError, ForbiddenError, NotFoundError, ConflictError,
  RateLimitError, ServerError).
- A 404 on a resource client reached through a run/build with no id of its own
  (run.dataset(), run.keyValueStore(), run.requestQueue(), run.log(),
  build.log()) now throws NotFoundError instead of resolving to empty/no-op.
  DatasetClient.getStatistics() and TaskClient.getInput() likewise throw on
  404 instead of returning Optional.empty().
- Harden ResourceContext.toSafeId/encodePathSegment against path traversal
  (replace every slash, reject dot-only/empty path segments).
- Skip request-body compression for content types that already carry their
  own compression (images, audio, video, archives, fonts).
- Fix ApifyClientBuilder base URL normalization doubling /v2 when the caller
  already included it.
- Add createItemsPublicUrl(options, expiresInSecs, format) overload.

Bump Version.API_SPEC_VERSION to v2-2026-10-01T153946Z, CLIENT_VERSION to 0.7.0.
@apify-service-account apify-service-account added the tested Temporary label used only programatically for some analytics. label Oct 2, 2026
@apify-service-account apify-service-account added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 2, 2026
…s review feedback

The X-Apify-Pagination-Count guard added in the previous commit discarded the
reported scanned count whenever it was smaller than the returned item count.
That is wrong for unwind, which legitimately returns more items than were
scanned (one scanned row's array field splits into several output items) -
the guard then advanced the offset by the larger returned count and silently
dropped rows on the next page.

Narrow the guard to only distrust a reported zero when the page also returned
real items (the one combination that can never be genuine, since scanning
zero rows can't produce items); any other nonzero reported value - including
one smaller than the returned count - is now trusted, matching the reference
client's behavior for both the filtered-page and unwind cases.

Also:
- Strengthen the getLog/getInput integration assertions to check decoded
  content instead of just non-null.
- Add a regression test and MockTransport request-URL tracking covering the
  unwind case specifically (asserts the actual offset sent, since the mock
  otherwise serves scripted pages regardless of the request).
- Consolidate the "flat zero observed on the live API" rationale to its one
  canonical location instead of restating it in five places.
@Pijukatel Pijukatel added the adhoc Ad-hoc unplanned task added during the sprint. label Oct 2, 2026 — with Claude

This branch has not been deployed

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

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants