Skip to content

Replace std::time::Instant in Cloudflare-reachable core code #1075

Description

@jevansnyc

Description

Follow-up from PR #1074 review. std::time::Instant::now() panics on the Cloudflare adapter's wasm32-unknown-unknown target, according to the original report. PR #1074 changed its new timing paths to web_time::Instant, but two pre-existing Cloudflare-reachable core paths still import the standard-library type:

  • crates/trusted-server-core/src/auction/telemetry.rs uses std::time::Instant for AuctionObservationContext::started_at, creation, and elapsed time.
  • crates/trusted-server-core/src/integrations/datadome/protection_scope.rs imports std::time::{Duration, Instant} and uses Instant::now() when reading and populating the dynamic IP CIDR source cache.

These imports and calls remain in the current source. Reaching either call on Cloudflare can trap the worker. The original report notes that the Cloudflare integration fixture has auctions disabled and no DataDome configuration, so compile and native tests do not exercise these runtime paths.

Expected behavior

Auction telemetry and the configured DataDome IP CIDR source cache use an Instant implementation that works on Cloudflare, with their current elapsed-time and expiry behavior retained on other targets.

Proposed change

Use web_time::Instant at both sites, retaining std::time::Duration in the DataDome import. web-time is already a workspace dependency and, as noted in the original report, re-exports the standard Instant on non-wasm targets. Check that no value from either site is compared with a std::time::Instant elsewhere.

Done when

  • Both Cloudflare-reachable call sites use web_time::Instant; no mixed Instant types are introduced.
  • Target-matched build and existing native tests pass for the affected core and Cloudflare adapter paths.
  • Runtime coverage reaches auction telemetry with auctions enabled in workerd, closing the gap identified in the original report. Exercise the configured DataDome IP CIDR source path as well if the fixture supports it.

Related

Activity

  1. added this to the 202610 milestone on Oct 1, 2026
  2. added theissue type on Oct 1, 2026
  3. self-assigned this
    on Oct 1, 2026
  4. added a commit that references this issue on Oct 6, 2026
    c052b59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions