Skip to content

swift-sdk: follow-ups from #5146 — test error assertions, typed contract-fetch errors, one off-main executor #5303

Open

Description

@romchornyi

Follow-ups from the review of #5146 (Swift SDK Platform queries off the caller's actor). None of them blocks that PR; they are collected here so they land together.

  1. PlatformQueryOffMainTests accepts any error. The four catch {} blocks (packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PlatformQueryOffMainTests.swift, around line 62) would still pass if a query bailed out before reaching the FFI — e.g. performBlockingQuery throwing .invalidState because the handle read as nil on the queue thread. Assert the error is not .invalidState (or is the mock's missing-expectation error), so the doc comment's "marshal arguments and make the FFI call" is enforced.
  2. Contract-fetch errors lose their type. In PlatformQueryExtensions.swift, documentListJSON's contract-fetch error path (and the same pattern around lines 462 and 682) collapses the FFI error into .internalError, while the search half goes through consumeStringResult and keeps the code — a transport failure surfaces as .networkError/.timeout on one half and not the other. Use SDKError.fromDashSDKError(error.pointee) on both. Pre-existing, not introduced by fix(sdk): run blocking Swift SDK Platform queries off the caller's actor #5146.
  3. Two off-main executors with opposite policies. dataContractQueue (serial, to bound blocked threads) and the concurrent executor behind performBlockingQuery each argue against the other in their doc comments. With every rs-sdk-ffi live-handle entry point now borrowing the SDK wrapper shared, route dataContractGetOffMain through performBlockingQuery, keeping one policy and one place that documents the thread-cost trade-off.

Raised by @llbartekll on #5146.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions