Skip to content

SDK: refuse a cursor over an unpinned derived index property before sending #5776

Open

Description

@shumkov

Problem

The SDK's check before sending a documents query (FromProof<Q> for Documents::check_request, added in #5774) runs Drive's construct_path_query(None, …), the lowering the verifier runs on every page. With no cursor document, that lowering never reaches DriveDocumentQuery::cursor_with_derived_values, so its refusal of a startAt / startAfter page over a derived index property that no equality pins is not applied before sending.

That refusal depends only on the selected index and the request's clauses, not on the cursor document. A node refuses such a page when it lowers the query with the cursor document, and so does the verifier, so the SDK sends a request that cannot be answered and only learns it after a round trip. should_page_with_a_cursor_only_where_the_query_fixes_the_derived_property (drive-abci, contract_user_moderation/tests/derived_index_properties.rs) shows the refused shape: a range on postId.$ownerId with a cursor.

The other check in the cursor lowering, whether the cursor document holds a requested array element, reads the document and stays a node-side decision.

Proposed change

  • Extract the equality-pin requirement from cursor_with_derived_values into a request-only Drive helper (verify-available), called by the cursor lowering at the same point, so the server's refusal text and order stay byte-identical.
  • Call it from the documents check before sending when the request carries a cursor.
  • Tests: a negative preflight test for the unpinned derived property with a cursor, its equality-pinned positive sibling, and a drive-abci agreement case (the node refuses ⇔ the check refuses).

Deferred from #5774, where it was a non-goal of the agreed design (the derived-index cursor rule is applied only while placing a cursor document).

Activity

  1. added this to the v5.1.0 milestone on Nov 5, 2026
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions