Skip to content

feat: sync with apify-sdk-js (week of 2026-11-16) - #40

Merged
metalwarrior665 merged 1 commit into
masterfrom
claude/kind-fermi-bqv2n8
Nov 16, 2026
Merged

metalwarrior665 merged 1 commit into
masterfrom
claude/kind-fermi-bqv2n8

Conversation

@metalwarrior665

Copy link
Copy Markdown
Member

Weekly sync from apify-sdk-js. It covers JS commits from 2026-11-02 to 2026-11-16 (up to #864).

Ported

  • Per-request charges in multi-tenant Server Actor runs (#831).
    • ChargeOptions::request_id is new. It is sent with every charge and written to the local charging log.
    • A run whose standby.deployment starts with MULTI_TENANT takes its pricing from the Actor's pricingInfos. It uses the latest entry with startedAt <= now. The budget is infinite and the charged counts start empty.
    • In such a run, charge needs a non-empty request_id. A synthetic event is refused. Every call is sent, and nothing is counted locally.
    • In such a run, a push with a charged event (push_data_and_charge*, buffered pushes with charge_events) fails with ChargingError::PushInMultiTenantRun before anything is stored. Plain pushes are stored and not charged.
    • Actor::get_current_run() is new. It fetches the run once and keeps it, as in JS.
    • ChargingManager::is_multi_tenant() is new.
  • Google Sheets links in the input (#859). get_input_raw / get_input replace a Google Sheets sharing link in the requestsFromUrl entries of array fields with the link of its CSV export. The new module is apify::google_sheets, with the JS test cases.
  • Charge of nothing (#854). A charge of 0 events returns at once. Nothing is sent or counted, and its idempotency key is not kept. Before this change, the key was kept with a count of 0.

Already covered or not applicable

  • #850 (checkAccess in the constructor): ProxyConfiguration::new already takes check_access in its options. Rust has no separate initialize step.
  • #857 (no -Secs suffix on lock methods): the Rust methods already take a Duration and have no suffix.
  • #864 (drop APIFY_LOCAL_STORAGE_DIR): the Rust SDK never read it.
  • The ?? undefined change to the proxy password in #831: this is a JS typing detail only.
  • Dependency, CI and theme commits.

Decisions to check

  • Where the run cache lives. JS keeps the run and Actor caches on Actor and passes getters to the ChargingManager. Here the ChargingManager owns both caches, because it already has the client and the configuration. Actor::get_current_run delegates to it. ChargingManager::new keeps its signature.
  • The standby preheat. JS starts both fetches in init for standby runs. Here charging init fetches the run and the Actor at the same time when APIFY_META_ORIGIN is STANDBY. In other runs, it fetches the Actor only when the run is multi-tenant. This is noted in docs/allowed-differences.md.
  • No lookahead in the regex crate. The JS regex rejects published links (/d/e/...) with (?!e\/). Rust checks for them after the match. \w is written as ASCII, as in JS.
  • Count type. The count stays u64, so a negative count cannot happen. This is noted in docs/allowed-differences.md.
  • Conformance. The CI conformance job still pins apify-sdk-js fbcdc9c. The golden charging cases have no zero or negative counts, so this sync does not change them. I did not bump the pin.
  • Google Sheets in two places. crawlee-rs still rewrites Google Sheets links in requestsFromUrl at the pinned revision. JS #4377 removed that rewrite, and the crawlee-rs sync PR of this week ports the removal. Running both rewrites is harmless, because an export link is left as it is. I did not change the crawlee-rs pin in this PR.

Tests

  • Unit tests cover the effective pricing entry (future entries, ties, invalid dates), a charge of 0 with a key, and the Google Sheets cases from JS.
  • tests/charging.rs checks multi-tenant pricing and the request_id rules. It also checks that deduplication is left to the platform and that a run without pay-per-event pricing ignores charges. A run of one tenant sends requestId too.
  • tests/actor.rs has two new tests. One is an end-to-end multi-tenant run: a refused charged push, an uncharged plain push, a per-request charge and one run fetch. The other checks the input rewrite. The FakeApi can now serve set runs and Actors.
  • I removed the multi-tenant push guard as a mutation check, and the end-to-end test fails without it.

Generated by Claude Code

…ver Actor runs, Google Sheets links in the input, no charge of nothing

- Port apify-sdk-js #831: `ChargeOptions::request_id`, multi-tenant Server Actor runs priced from
  the Actor's pricing history, `Actor::get_current_run`.
- Port apify-sdk-js #859: Google Sheets sharing links in `requestsFromUrl` input entries become
  CSV export links.
- Port apify-sdk-js #854: a charge of 0 events is not sent or counted, and its key is not kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016XtpQvffXFPk67HTT5HDLy
@metalwarrior665
metalwarrior665 merged commit 3c04bc0 into master Nov 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants