Skip to content

refactor(sdk): extract transport-free query core into dash-platform-queries - #4388

Open
PastaPastaPasta wants to merge 4 commits into
v4.2-devfrom
refactor/dash-platform-queries
Open

refactor(sdk): extract transport-free query core into dash-platform-queries#4388
PastaPastaPasta wants to merge 4 commits into
v4.2-devfrom
refactor/dash-platform-queries

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Aug 13, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Dash Core's Platform GUI integration (PastaPastaPasta/dash#67, tracked in dashpay/dash#7512) needs the SDK's query-building, wire-encoding, and proof-related core without the networking stack. Per maintainer guidance to refactor rather than duplicate ("make an SDK with a feature set so small it matches what you want / split up rs-sdk"), this extracts that core instead of letting embedders reimplement it.

Second slice of the feat/transport-free-embedder-core series (#4335), following #4344 and #4345.

What was done?

  • New packages/dash-platform-queries crate: DocumentQuery building and wire encoding for both request versions, aggregate proof helpers (count/sum/average/ranked), DPNS username helpers, and structural state-transition validation — with no transport, no tokio, no tonic channel/TLS anywhere in its dependency graph.
  • dash-sdk depends on the new crate and re-exports every moved item at its old path — no rs-sdk consumer changes imports (verified: dash-sdk, wasm-sdk, rs-sdk-ffi, and platform-wallet all compile unchanged).
  • CI: transport-free feature-cut checks cover the new crate; check-features knows about it.
  • Docs: crate README + rs-sdk README pointer describing the embedder consumption path.

Wire-request decoding, request-driven proof verification, and pure DPNS/DashPay document builders follow in the next slice.

How Has This Been Tested?

  • cargo test -p dash-platform-queries (24 tests), cargo check for dash-sdk (incl. --tests --features mocks), wasm-sdk, rs-sdk-ffi, platform-wallet, check-features; cargo fmt --check; cargo clippy -p dash-platform-queries clean.
  • Cargo.lock delta is exactly one new [[package]] entry plus the dash-sdk dependency edge — no version churn.
  • The equivalent code (as part of the full series branch) has been exercised end-to-end by the Dash Core embedder in feat(qt): back Dash Platform GUI internals with real grovedb/drive/dpp crates PastaPastaPasta/dash#67, including live-testnet E2E.

Breaking Changes

None. All moved items remain importable at their previous dash_sdk paths.

Summary by CodeRabbit

  • New Features

    • Added transport-free platform query capabilities, including document queries, proof verification, DPNS username validation, finalized-epoch queries, and transition validation.
    • Added configurable query settings for protocol version and proof handling.
    • Made the new query functionality available through the Rust and WASM SDKs.
    • Added support for document history queries and aggregate document results.
  • Documentation

    • Added usage guidance for transport-free queries and expanded gRPC and query package documentation.
  • Bug Fixes

    • Improved validation of metadata, usernames, state transitions, and supported wire requests.

…ueries

Split rs-sdk per the maintainer guidance to refactor rather than duplicate: the query-building, wire-encoding, and proof-decoding core that a transport-free embedder needs now lives in a new packages/dash-platform-queries crate, and rs-sdk depends on it and re-exports every moved item at its old path, so no rs-sdk consumer changes imports.

Moved out of rs-sdk: DocumentQuery and its wire encoders (document_query.rs), the count/sum/average/ranked proof helpers and their FromProof aggregate views (DocumentCount, DocumentSum, DocumentAverage, DocumentSplitCounts, DocumentSplitSums, DocumentSplitAverages, DocumentRankedEntries), DocumentHistoryQuery, block_info_from_metadata, QuerySettings, FinalizedEpochQuery, ensure_valid_state_transition_structure, and the DPNS username helpers (convert_to_homograph_safe_chars, is_valid_username, is_contested_username). Sdk-bound pieces stay behind: the contract-fetching DocumentQuery constructor (now the DocumentQuerySdk extension trait), the Query<GetDocumentsRequest> encoder impl, the Fetch bindings for the aggregate views, and the Query impls for FinalizedEpochQuery.

QuerySettings loses its request_settings field: it was documented dead weight (not consulted by any encoder) and was the only rs-dapi-client tie in the moved struct. Sdk::query_settings and the few test construction sites were updated accordingly.

The new crate has its own small thiserror enum (Config/Drive/Protocol); rs-sdk converts it via From, so existing ? call sites keep compiling. wasm-sdk gains the matching From impl for WasmSdkError, routed through SdkError so the mapping is unchanged.

Coherence fallout: with DocumentQuery now foreign to rs-sdk, the blanket 'impl Query<T> for T where T: TransportRequest' would conflict with the explicit identity impl for DocumentQuery. The blanket is now additionally bounded by a local, explicitly-implemented WireQuery marker covering every wire request proto (list mirrors rs-dapi-client's TransportRequest impls); rustc can then prove the impl sets disjoint. The new crate's dependency tree is transport-free: no rs-dapi-client, hyper, rustls, or tonic transport.
dapi-grpc gets a crate-level feature table (including the new transport
feature and the types-only build recipe), dash-platform-queries gets a
README describing who the crate is for and what lives in it, and rs-sdk's
README points transport-free embedders at the split crate.
Feature unification hides transport-stack regressions in whole-workspace
builds, so add a PR-time step checking the standalone graphs (types-only
dapi-grpc, drive-proof-verifier, dash-platform-queries) and failing if
hyper, rustls, or tower leaks into drive-proof-verifier's tree. Add both
verification crates to the nightly per-feature check matrix and to the
check-features tool's crate list.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@PastaPastaPasta, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 420ab6fb-fd54-482d-bc01-69627d4719cd

📥 Commits

Reviewing files that changed from the base of the PR and between a6ad3e0 and fb66886.

📒 Files selected for processing (1)
  • Dockerfile
📝 Walkthrough

Walkthrough

The PR adds the transport-free dash-platform-queries crate. It extracts query types, document proof handling, DPNS helpers, validation, and metadata conversion from rs-sdk, then restores SDK-specific transport bindings and updates workspace validation.

Changes

Transport-free query extraction

Layer / File(s) Summary
Query crate foundation
Cargo.toml, packages/dash-platform-queries/*, packages/dapi-grpc/src/lib.rs
Adds the new workspace crate, public error and settings types, metadata conversion, finalized epoch queries, mock support, and crate documentation.
Transport-free query utilities
packages/dash-platform-queries/src/documents/*, packages/dash-platform-queries/src/dpns_usernames.rs, packages/dash-platform-queries/src/transition/*
Adds document query modules, history parameters, DPNS normalization and validation, and state-transition structure validation. Removes SDK transport bindings from shared document result types.
SDK transport boundary and re-exports
packages/rs-sdk/Cargo.toml, packages/rs-sdk/src/platform/*, packages/wasm-sdk/src/error.rs
Re-exports the new crate, adds SDK document-query construction and fetch bindings, introduces WireQuery, and maps query errors into SDK and WASM errors.
Workspace and feature validation
.github/package-filters/*, .github/workflows/*, packages/check-features/src/main.rs
Adds the new crate to package filters, feature checks, nightly checks, and transport-free validation.
SDK settings and query test updates
packages/rs-sdk/src/sdk.rs, packages/rs-sdk/tests/fetch/*
Removes RequestSettings from QuerySettings construction and updates document-query imports and error assertions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Mergeability Score: 🟡 Moderate · up to a6ad3

The refactor currently risks sending document queries with proofs enabled when callers disable them and may break existing consumers using the prior DocumentQuery constructor, contradicting the stated compatibility goal. These bounded correctness and integration issues should be fixed or explicitly accepted before merging.

Sequence Diagram(s)

sequenceDiagram
  participant SDK
  participant DocumentQuerySdk
  participant dash-platform-queries
  participant DAPI
  SDK->>DocumentQuerySdk: create SDK-bound document query
  DocumentQuerySdk->>DAPI: fetch data contract
  DAPI-->>DocumentQuerySdk: return contract metadata
  DocumentQuerySdk->>dash-platform-queries: build and encode query
  dash-platform-queries-->>SDK: return typed query or proof result
Loading

Possibly related PRs

Suggested reviewers: lklimek, quantumexplorer, shumkov

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: extracting the transport-free query core into the new dash-platform-queries crate.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/dash-platform-queries

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

⛔ Blockers found — Opus deferred (commit fb66886)
Canonical validated blockers: 5

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
.github/workflows/tests-rs-workspace.yml (1)

201-205: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Guard the new crate's transport-free dependency graph.

cargo check -p dash-platform-queries verifies compilation only. The cargo tree assertions cover other packages, not dash-platform-queries. A future tokio, tonic, hyper, rustls, or tower dependency could pass this job and violate the crate's transport-free contract. Add an equivalent cargo tree assertion or verify that another workflow enforces it.

Suggested check
           cargo check -p dash-platform-queries --locked
+          for banned in hyper rustls tower tokio tonic; do
+            if cargo tree --locked -p dash-platform-queries -e normal -i "$banned" 2>/dev/null | grep -q .; then
+              echo "::error::$banned leaked into dash-platform-queries's dependency tree"
+              exit 1
+            fi
+          done
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/tests-rs-workspace.yml around lines 201 - 205, Add a
transport-free dependency assertion alongside the dash-platform-queries cargo
check in “Check transport-free feature cuts”. Ensure its cargo tree validation
fails if tokio, tonic, hyper, rustls, or tower enters the crate’s dependency
graph, matching the existing assertions for other packages.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/dash-platform-queries/README.md`:
- Around line 19-20: Define valid Markdown reference links for ContextProvider
and drive-proof-verifier in the README, or replace both references with inline
links, ensuring the rendered documentation makes each referenced project or
component clickable.

In `@packages/dash-platform-queries/src/documents/document_query.rs`:
- Line 300: Update the examples at
packages/dash-platform-queries/src/documents/document_query.rs:300,
packages/dash-platform-queries/src/documents/document_ranked_entries.rs:83, and
packages/dash-platform-queries/src/documents/document_ranked_entries.rs:130 by
moving SDK-dependent examples to packages/rs-sdk documentation or rewriting them
to use dash-platform-queries APIs; after doing so, restore the rust,no_run
annotation on all three documentation fences.

In `@packages/rs-sdk/src/platform/documents/document_query_sdk.rs`:
- Around line 61-68: Update DocumentQuery::query to apply settings.prove to the
encoded GetDocumentsRequest for both supported wire versions, rather than only
passing settings.protocol_version. Preserve the existing versioned conversion
and return behavior, and add regression coverage verifying prove: false is
encoded when configured through QuerySettings.
- Around line 18-21: Preserve source compatibility for callers importing only
DocumentQuery by exposing new_with_data_contract_id through an API that does not
require DocumentQuerySdk to be explicitly in scope. Update the DocumentQuerySdk
extension-trait arrangement or add a compatible facade while retaining the
existing DocumentQuery::new_with_data_contract_id(...) call pattern; otherwise
explicitly treat the change as a versioned breaking API change.

---

Nitpick comments:
In @.github/workflows/tests-rs-workspace.yml:
- Around line 201-205: Add a transport-free dependency assertion alongside the
dash-platform-queries cargo check in “Check transport-free feature cuts”. Ensure
its cargo tree validation fails if tokio, tonic, hyper, rustls, or tower enters
the crate’s dependency graph, matching the existing assertions for other
packages.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a8827f5-26a3-4480-b7f4-bb2ddb628fb0

📥 Commits

Reviewing files that changed from the base of the PR and between 806890c and a6ad3e0.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (58)
  • .github/package-filters/rs-packages-direct.yml
  • .github/package-filters/rs-packages-no-workflows.yml
  • .github/package-filters/rs-packages.yml
  • .github/workflows/tests-rs-nightly-long-running.yml
  • .github/workflows/tests-rs-workspace.yml
  • Cargo.toml
  • packages/check-features/src/main.rs
  • packages/dapi-grpc/src/lib.rs
  • packages/dash-platform-queries/Cargo.toml
  • packages/dash-platform-queries/README.md
  • packages/dash-platform-queries/src/block_info_from_metadata.rs
  • packages/dash-platform-queries/src/documents/average_proof_helpers.rs
  • packages/dash-platform-queries/src/documents/count_proof_helpers.rs
  • packages/dash-platform-queries/src/documents/document_average.rs
  • packages/dash-platform-queries/src/documents/document_count.rs
  • packages/dash-platform-queries/src/documents/document_history_query.rs
  • packages/dash-platform-queries/src/documents/document_query.rs
  • packages/dash-platform-queries/src/documents/document_ranked_entries.rs
  • packages/dash-platform-queries/src/documents/document_split_averages.rs
  • packages/dash-platform-queries/src/documents/document_split_counts.rs
  • packages/dash-platform-queries/src/documents/document_split_sums.rs
  • packages/dash-platform-queries/src/documents/document_sum.rs
  • packages/dash-platform-queries/src/documents/mod.rs
  • packages/dash-platform-queries/src/documents/ranked_proof_helpers.rs
  • packages/dash-platform-queries/src/documents/sum_proof_helpers.rs
  • packages/dash-platform-queries/src/dpns_usernames.rs
  • packages/dash-platform-queries/src/error.rs
  • packages/dash-platform-queries/src/lib.rs
  • packages/dash-platform-queries/src/mock.rs
  • packages/dash-platform-queries/src/query_settings.rs
  • packages/dash-platform-queries/src/transition/mod.rs
  • packages/dash-platform-queries/src/transition/validation.rs
  • packages/dash-platform-queries/src/types/finalized_epoch.rs
  • packages/dash-platform-queries/src/types/mod.rs
  • packages/rs-sdk/Cargo.toml
  • packages/rs-sdk/README.md
  • packages/rs-sdk/src/error.rs
  • packages/rs-sdk/src/lib.rs
  • packages/rs-sdk/src/platform.rs
  • packages/rs-sdk/src/platform/delegate.rs
  • packages/rs-sdk/src/platform/documents/document_query_sdk.rs
  • packages/rs-sdk/src/platform/documents/fetch_bindings.rs
  • packages/rs-sdk/src/platform/documents/mod.rs
  • packages/rs-sdk/src/platform/dpns_usernames/mod.rs
  • packages/rs-sdk/src/platform/identities_contract_keys_query.rs
  • packages/rs-sdk/src/platform/query.rs
  • packages/rs-sdk/src/platform/query_settings.rs
  • packages/rs-sdk/src/platform/transition/validation.rs
  • packages/rs-sdk/src/platform/types/epoch.rs
  • packages/rs-sdk/src/platform/types/evonode.rs
  • packages/rs-sdk/src/platform/types/finalized_epoch.rs
  • packages/rs-sdk/src/sdk.rs
  • packages/rs-sdk/tests/fetch/common.rs
  • packages/rs-sdk/tests/fetch/document.rs
  • packages/rs-sdk/tests/fetch/document_query_v0_v1.rs
  • packages/rs-sdk/tests/fetch/mock_fetch.rs
  • packages/rs-sdk/tests/fetch/tokens/token_contract_info.rs
  • packages/wasm-sdk/src/error.rs
💤 Files with no reviewable changes (3)
  • packages/rs-sdk/src/platform/query_settings.rs
  • packages/rs-sdk/tests/fetch/common.rs
  • packages/rs-sdk/tests/fetch/tokens/token_contract_info.rs

Comment on lines +19 to +20
[`ContextProvider`], and verifies every response proof with
[`drive-proof-verifier`].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Define the Markdown reference links.

[ContextProvider] and [drive-proof-verifier] have no definitions in this README. The rendered document therefore does not provide links for these references. Add reference definitions or replace them with valid inline links.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dash-platform-queries/README.md` around lines 19 - 20, Define valid
Markdown reference links for ContextProvider and drive-proof-verifier in the
README, or replace both references with inline links, ensuring the rendered
documentation makes each referenced project or component clickable.

/// # The 5th-best group
///
/// ```rust,no_run
/// ```rust,ignore

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- targeted diff ---'
git diff -- packages/dash-platform-queries/src/documents/document_query.rs packages/dash-platform-queries/src/documents/document_ranked_entries.rs
printf '%s\n' '--- document_query outline ---'
ast-grep outline packages/dash-platform-queries/src/documents/document_query.rs
printf '%s\n' '--- document_ranked_entries outline ---'
ast-grep outline packages/dash-platform-queries/src/documents/document_ranked_entries.rs
printf '%s\n' '--- relevant source sections ---'
sed -n '270,330p' packages/dash-platform-queries/src/documents/document_query.rs
sed -n '55,145p' packages/dash-platform-queries/src/documents/document_ranked_entries.rs
printf '%s\n' '--- package and workspace manifests ---'
sed -n '1,220p' packages/dash-platform-queries/Cargo.toml
sed -n '1,180p' Cargo.toml
printf '%s\n' '--- referenced imports and example symbols ---'
rg -n 'DocumentQuery|DocumentRankedEntry|no_run|ignore|dash_sdk|Query' packages/dash-platform-queries/src/documents/document_query.rs packages/dash-platform-queries/src/documents/document_ranked_entries.rs packages/dash-platform-queries/Cargo.toml

Repository: dashpay/platform

Length of output: 25056


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- repository state ---'
git status --short
git diff --stat
printf '%s\n' '--- current and parent versions of the affected lines ---'
git show HEAD:packages/dash-platform-queries/src/documents/document_query.rs | sed -n '288,318p'
git show HEAD:packages/dash-platform-queries/src/documents/document_ranked_entries.rs | sed -n '75,142p'
printf '%s\n' '--- package module exports ---'
fd -t f . packages/dash-platform-queries | sort
rg -n 'pub mod|pub use|dash_sdk|dash-platform-queries|rustdoc|test.*doc|doc.*test' packages/dash-platform-queries packages/rs-sdk .github Cargo.toml
printf '%s\n' '--- SDK declarations and re-exports ---'
rg -n '^name\s*=\s*"dash-sdk"|dash-platform-queries|pub use .*DocumentQuery|pub use .*DocumentRankedEntries|pub mod documents' packages/rs-sdk packages/dash-platform-queries
printf '%s\n' '--- all matching documentation fences ---'
rg -n -C 3 'rust,(no_run|ignore)|dash_sdk::platform|dash_sdk::drive' packages/dash-platform-queries packages/rs-sdk

Repository: dashpay/platform

Length of output: 50375


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- extracted crate exports and error type ---'
sed -n '1,120p' packages/dash-platform-queries/src/lib.rs
sed -n '1,80p' packages/dash-platform-queries/src/documents/mod.rs
sed -n '1,120p' packages/dash-platform-queries/src/error.rs
printf '%s\n' '--- SDK document-query integration modules ---'
sed -n '1,180p' packages/rs-sdk/src/platform/documents/document_query_sdk.rs
sed -n '1,100p' packages/rs-sdk/src/platform/documents/mod.rs
sed -n '1,70p' packages/rs-sdk/src/platform.rs
printf '%s\n' '--- SDK manifest dependencies and package identity ---'
rg -n -C 3 '^\[package\]|^name\s*=|dash-platform-queries|drive-proof-verifier|futures' packages/rs-sdk/Cargo.toml
printf '%s\n' '--- doctest workflow commands ---'
sed -n '460,505p' .github/workflows/tests-rs-workspace.yml
sed -n '210,240p' .github/workflows/tests-rs-wallet.yml
sed -n '430,465p' .github/workflows/tests.yml
printf '%s\n' '--- focused documentation ownership references ---'
rg -n -C 4 'transport-free|SDK-dependent|document_query_sdk|DocumentRankedEntries|ranked entries' packages/dash-platform-queries/README.md packages/rs-sdk/README.md packages/rs-sdk/src/platform/documents packages/rs-sdk/src/platform

Repository: dashpay/platform

Length of output: 27859


🏁 Script executed:

#!/bin/bash
set -e
python3 - <<'PY'
from pathlib import Path
import re
import tomllib

root = Path("packages/dash-platform-queries")
manifest = tomllib.loads((root / "Cargo.toml").read_text())
declared = set(manifest.get("dependencies", {})) | set(manifest.get("dev-dependencies", {}))
declared_crates = {name.replace("-", "_") for name in declared}

files = [
    root / "src/documents/document_query.rs",
    root / "src/documents/document_ranked_entries.rs",
]

fence_re = re.compile(r"```rust,(no_run|ignore)\n(.*?)```", re.S)
use_re = re.compile(r"^\s*(?:#\s*)?use\s+([A-Za-z_][A-Za-z0-9_]*)", re.M)

found = []
for path in files:
    text = path.read_text()
    for match in fence_re.finditer(text):
        flag, body = match.groups()
        line = text[:match.start()].count("\n") + 1
        roots = sorted(set(use_re.findall(body)))
        missing = [name for name in roots if name not in declared_crates and name not in {"std", "core", "alloc"}]
        found.append((path.as_posix(), line, flag, roots, missing))

print("Declared crate roots:", ", ".join(sorted(declared_crates)))
print("Affected documentation fences:")
for path, line, flag, roots, missing in found:
    print(f"{path}:{line}: rust,{flag}; imports={roots}; undeclared={missing}")

assert len(found) == 3
assert all(flag == "ignore" for _, _, flag, _, _ in found)
assert all("dash_sdk" in missing for _, _, _, _, missing in found)
print("Conclusion: all three fences suppress doctest compilation, and all three import undeclared dash_sdk APIs.")
PY

Repository: dashpay/platform

Length of output: 274


🏁 Script executed:

#!/bin/bash
set -e
python3 - <<'PY'
from pathlib import Path
import re

root = Path("packages/dash-platform-queries")
manifest_text = (root / "Cargo.toml").read_text()

# Read dependency-table keys without requiring a TOML parser.
declared = set()
table = None
for line in manifest_text.splitlines():
    stripped = line.strip()
    if stripped.startswith("[") and stripped.endswith("]"):
        table = stripped
        continue
    if table in {"[dependencies]", "[dev-dependencies]"}:
        match = re.match(r"([A-Za-z0-9_-]+)\s*=", stripped)
        if match:
            declared.add(match.group(1).replace("-", "_"))

files = [
    root / "src/documents/document_query.rs",
    root / "src/documents/document_ranked_entries.rs",
]
fence_re = re.compile(r"```rust,(no_run|ignore)\n(.*?)```", re.S)
use_re = re.compile(r"^\s*(?:#\s*)?use\s+([A-Za-z_][A-Za-z0-9_]*)", re.M)

found = []
for path in files:
    text = path.read_text()
    for match in fence_re.finditer(text):
        flag, body = match.groups()
        line = text[:match.start()].count("\n") + 1
        roots = sorted(set(use_re.findall(body)))
        missing = [
            name for name in roots
            if name not in declared and name not in {"std", "core", "alloc"}
        ]
        found.append((path.as_posix(), line, flag, roots, missing))

print("Declared crate roots:", ", ".join(sorted(declared)))
print("Documentation fences:")
for path, line, flag, roots, missing in found:
    print(f"{path}:{line}: rust,{flag}; imports={roots}; undeclared={missing}")

assert len(found) == 3
assert all(flag == "ignore" for _, _, flag, _, _ in found)
assert all("dash_sdk" in missing for _, _, _, _, missing in found)
print("Conclusion: all three fences suppress doctest compilation, and all three import undeclared dash_sdk APIs.")
PY

Repository: dashpay/platform

Length of output: 758


🏁 Script executed:

#!/bin/bash
set -e
python3 - <<'PY'
from pathlib import Path
import re

root = Path("packages/dash-platform-queries")
manifest_text = (root / "Cargo.toml").read_text()

declared = set()
table = None
for line in manifest_text.splitlines():
    stripped = line.strip()
    if stripped.startswith("[") and stripped.endswith("]"):
        table = stripped
        continue
    if table in {"[dependencies]", "[dev-dependencies]"}:
        match = re.match(r"([A-Za-z0-9_-]+)\s*=", stripped)
        if match:
            declared.add(match.group(1).replace("-", "_"))

files = [
    root / "src/documents/document_query.rs",
    root / "src/documents/document_ranked_entries.rs",
]
fence_re = re.compile(r"```rust,(no_run|ignore)\n(.*?)```", re.S)
use_re = re.compile(r"^\s*(?:#\s*)?use\s+([A-Za-z_][A-Za-z0-9_]*)", re.M)

found = []
for path in files:
    text = path.read_text()
    for match in fence_re.finditer(text):
        flag, body = match.groups()
        line = text[:match.start()].count("\n") + 1
        normalized = "\n".join(
            re.sub(r"^\s*//!?\s?", "", line) for line in body.splitlines()
        )
        roots = sorted(set(use_re.findall(normalized)))
        missing = [
            name for name in roots
            if name not in declared and name not in {"std", "core", "alloc"}
        ]
        found.append((path.as_posix(), line, flag, roots, missing))

print("Declared crate roots:", ", ".join(sorted(declared)))
print("Documentation fences:")
for path, line, flag, roots, missing in found:
    print(f"{path}:{line}: rust,{flag}; imports={roots}; undeclared={missing}")

assert len(found) == 3
assert all(flag == "ignore" for _, _, flag, _, _ in found)
assert all("dash_sdk" in missing for _, _, _, _, missing in found)
print("Conclusion: all three fences suppress doctest compilation, and all three import undeclared dash_sdk APIs.")

Repository: dashpay/platform

Length of output: 931


🏁 Script executed:

#!/bin/bash
set -e
python3 - <<'PY'
from pathlib import Path
import re

root = Path("packages/dash-platform-queries")
manifest_text = (root / "Cargo.toml").read_text()

declared = set()
table = None
for line in manifest_text.splitlines():
    stripped = line.strip()
    if stripped.startswith("[") and stripped.endswith("]"):
        table = stripped
        continue
    if table in {"[dependencies]", "[dev-dependencies]"}:
        match = re.match(r"([A-Za-z0-9_-]+)\s*=", stripped)
        if match:
            declared.add(match.group(1).replace("-", "_"))

files = [
    root / "src/documents/document_query.rs",
    root / "src/documents/document_ranked_entries.rs",
]
fence_re = re.compile(r"```rust,(no_run|ignore)\n(.*?)```", re.S)
use_re = re.compile(r"^\s*(?:#\s*)?use\s+([A-Za-z_][A-Za-z0-9_]*)", re.M)

found = []
for path in files:
    text = path.read_text()
    for match in fence_re.finditer(text):
        flag, body = match.groups()
        line = text[:match.start()].count("\n") + 1
        normalized = "\n".join(
            re.sub(r"^\s*//[/!]?\s?", "", source_line)
            for source_line in body.splitlines()
        )
        roots = sorted(set(use_re.findall(normalized)))
        missing = [
            name for name in roots
            if name not in declared and name not in {"std", "core", "alloc"}
        ]
        found.append((path.as_posix(), line, flag, roots, missing))

print("Declared crate roots:", ", ".join(sorted(declared)))
print("Documentation fences:")
for path, line, flag, roots, missing in found:
    print(f"{path}:{line}: rust,{flag}; imports={roots}; undeclared={missing}")

assert len(found) == 3
assert all(flag == "ignore" for _, _, flag, _, _ in found)
assert all("dash_sdk" in missing for _, _, _, _, missing in found)
print("Conclusion: all three fences suppress doctest compilation, and all three import undeclared dash_sdk APIs.")
PY

Repository: dashpay/platform

Length of output: 881


Move SDK-dependent examples or restore rust,no_run.

These examples import undeclared dash_sdk APIs, and one also imports undeclared futures. Move them to packages/rs-sdk documentation or rewrite them with dash-platform-queries APIs. Then restore rust,no_run at all three fences.

📍 Affects 2 files
  • packages/dash-platform-queries/src/documents/document_query.rs#L300-L300 (this comment)
  • packages/dash-platform-queries/src/documents/document_ranked_entries.rs#L83-L83
  • packages/dash-platform-queries/src/documents/document_ranked_entries.rs#L130-L130
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dash-platform-queries/src/documents/document_query.rs` at line 300,
Update the examples at
packages/dash-platform-queries/src/documents/document_query.rs:300,
packages/dash-platform-queries/src/documents/document_ranked_entries.rs:83, and
packages/dash-platform-queries/src/documents/document_ranked_entries.rs:130 by
moving SDK-dependent examples to packages/rs-sdk documentation or rewriting them
to use dash-platform-queries APIs; after doing so, restore the rust,no_run
annotation on all three documentation fences.

Comment on lines +18 to +21
/// Kept as an extension trait because [`DocumentQuery`] is defined in the
/// transport-free `dash-platform-queries` crate, so its Sdk-dependent
/// constructor cannot be an inherent method there. Bring this trait into
/// scope to keep calling `DocumentQuery::new_with_data_contract_id(...)`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- candidate file outline ---'
ast-grep outline packages/rs-sdk/src/platform/documents/document_query_sdk.rs || true

printf '%s\n' '--- candidate source ---'
cat -n packages/rs-sdk/src/platform/documents/document_query_sdk.rs

printf '%s\n' '--- DocumentQuery declarations and constructor references ---'
rg -n -C 3 'struct DocumentQuery|impl DocumentQuery|new_with_data_contract_id|trait DocumentQuerySdk|DocumentQuerySdk' packages/rs-sdk packages -g '*.rs'

printf '%s\n' '--- relevant test imports and calls ---'
cat -n packages/rs-sdk/tests/fetch/mock_fetch.rs

printf '%s\n' '--- SDK checklist ---'
cat -n packages/rs-sdk/README.md

Repository: dashpay/platform

Length of output: 35498


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- targeted working-tree change ---'
git diff --stat -- packages/rs-sdk/src/platform/documents/document_query_sdk.rs packages/rs-sdk/src/platform/documents/mod.rs packages/rs-sdk/tests/fetch/mock_fetch.rs packages/rs-sdk/tests/fetch/document.rs
git diff -- packages/rs-sdk/src/platform/documents/document_query_sdk.rs packages/rs-sdk/src/platform/documents/mod.rs packages/rs-sdk/tests/fetch/mock_fetch.rs packages/rs-sdk/tests/fetch/document.rs

printf '%s\n' '--- public platform re-exports ---'
rg -n -C 4 'pub use.*DocumentQuery|pub mod documents|mod documents|DocumentQuerySdk' packages/rs-sdk/src -g '*.rs'

printf '%s\n' '--- original DocumentQuery implementation ---'
cat -n packages/dash-platform-queries/src/documents/document_query.rs | sed -n '45,190p'

printf '%s\n' '--- standalone Rust method-resolution verifier ---'
if command -v rustc >/dev/null 2>&1; then
    cat >/tmp/document_query_trait_resolution.rs <<'RS'
trait SdkBound {
    fn new_with_data_contract_id() -> Self;
}

struct DocumentQuery;

impl SdkBound for DocumentQuery {
    fn new_with_data_contract_id() -> Self {
        DocumentQuery
    }
}

fn with_trait_in_scope() {
    use crate::SdkBound;
    let _ = DocumentQuery::new_with_data_contract_id();
}

fn main() {
    with_trait_in_scope();
}
RS
    rustc --edition=2021 --crate-name document_query_trait_resolution \
        /tmp/document_query_trait_resolution.rs \
        -o /tmp/document_query_trait_resolution
    printf '%s\n' 'trait-in-scope case: compiles'

    sed '/fn with_trait_in_scope()/,/^}/d' \
        /tmp/document_query_trait_resolution.rs \
        | sed '/fn main()/,$d' >/tmp/document_query_trait_resolution_without_import.rs
    cat >>/tmp/document_query_trait_resolution_without_import.rs <<'RS'
fn main() {
    let _ = DocumentQuery::new_with_data_contract_id();
}
RS
    if rustc --edition=2021 --crate-name document_query_trait_resolution_without_import \
        /tmp/document_query_trait_resolution_without_import.rs \
        -o /tmp/document_query_trait_resolution_without_import \
        2>/tmp/document_query_trait_resolution_without_import.err; then
        printf '%s\n' 'trait-out-of-scope case: unexpectedly compiles'
    else
        printf '%s\n' 'trait-out-of-scope case: fails as expected'
        cat /tmp/document_query_trait_resolution_without_import.err
    fi
else
    printf '%s\n' 'rustc unavailable; source-level verification only'
fi

Repository: dashpay/platform

Length of output: 11925


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- repository revision context ---'
git status --short
git log --oneline -5 -- packages/rs-sdk/src/platform/documents/document_query_sdk.rs packages/rs-sdk/src/platform/documents/mod.rs packages/dash-platform-queries/src/documents/document_query.rs

printf '%s\n' '--- parent revision: SDK document query files ---'
parent="$(git rev-parse HEAD^)"
if git cat-file -e "$parent:packages/rs-sdk/src/platform/documents/document_query_sdk.rs" 2>/dev/null; then
    git show "$parent:packages/rs-sdk/src/platform/documents/document_query_sdk.rs" | cat -n
else
    printf '%s\n' 'document_query_sdk.rs did not exist in the parent revision'
fi

printf '%s\n' '--- parent revision: DocumentQuery constructor references ---'
git grep -n -C 3 'new_with_data_contract_id\|impl DocumentQuery' "$parent" -- \
    packages/rs-sdk packages/dash-platform-queries '*.rs' || true

printf '%s\n' '--- corrected standalone Rust method-resolution verifier ---'
if command -v rustc >/dev/null 2>&1; then
    cat >/tmp/document_query_trait_resolution_with_import.rs <<'RS'
struct DocumentQuery;

mod sdk_api {
    use super::DocumentQuery;

    pub trait DocumentQuerySdk: Sized {
        fn new_with_data_contract_id() -> Self;
    }

    impl DocumentQuerySdk for DocumentQuery {
        fn new_with_data_contract_id() -> Self {
            DocumentQuery
        }
    }
}

fn main() {
    use sdk_api::DocumentQuerySdk;
    let _ = DocumentQuery::new_with_data_contract_id();
}
RS

    cat >/tmp/document_query_trait_resolution_without_import.rs <<'RS'
struct DocumentQuery;

mod sdk_api {
    use super::DocumentQuery;

    pub trait DocumentQuerySdk: Sized {
        fn new_with_data_contract_id() -> Self;
    }

    impl DocumentQuerySdk for DocumentQuery {
        fn new_with_data_contract_id() -> Self {
            DocumentQuery
        }
    }
}

fn main() {
    let _ = DocumentQuery::new_with_data_contract_id();
}
RS

    rustc --edition=2021 \
        /tmp/document_query_trait_resolution_with_import.rs \
        -o /tmp/document_query_trait_resolution_with_import
    printf '%s\n' 'trait-in-scope case: compiles'

    if rustc --edition=2021 \
        /tmp/document_query_trait_resolution_without_import.rs \
        -o /tmp/document_query_trait_resolution_without_import \
        2>/tmp/document_query_trait_resolution_without_import.err; then
        printf '%s\n' 'trait-out-of-scope case: unexpectedly compiles'
    else
        printf '%s\n' 'trait-out-of-scope case: fails as expected'
        cat /tmp/document_query_trait_resolution_without_import.err
    fi
else
    printf '%s\n' 'rustc unavailable'
fi

Repository: dashpay/platform

Length of output: 12548


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- current revision ---'
git rev-parse HEAD
git show --stat --oneline HEAD

printf '%s\n' '--- commits that added or removed the constructor ---'
git log --all --oneline -S'new_with_data_contract_id' -- \
    packages/rs-sdk packages/dash-platform-queries

printf '%s\n' '--- commits that changed DocumentQuery ownership or re-exports ---'
git log --all --oneline -S'pub struct DocumentQuery' -- \
    packages/rs-sdk packages/dash-platform-queries
git log --all --oneline -S'pub use documents::document_query::DocumentQuery' -- \
    packages/rs-sdk

printf '%s\n' '--- refactor commit details ---'
git show --format=fuller --stat 2c3f1fda9
git show --format= --find-renames --find-copies 2c3f1fda9 -- \
    packages/rs-sdk/src/platform/documents \
    packages/rs-sdk/src/platform.rs \
    packages/dash-platform-queries/src/documents/document_query.rs \
    packages/rs-sdk/tests/fetch

printf '%s\n' '--- all public constructor-like APIs for DocumentQuery ---'
rg -n -C 3 'DocumentQuery::|impl DocumentQuery|new_with_' packages/rs-sdk packages/dash-platform-queries -g '*.rs'

Repository: dashpay/platform

Length of output: 853


🏁 Script executed:

#!/bin/bash
set -u

commit=2c3f1fda9
parent="$(git rev-parse "${commit}^" 2>/dev/null || true)"

printf '%s\n' '--- refactor commit and parent ---'
printf 'commit: %s\nparent: %s\n' "$commit" "$parent"

printf '%s\n' '--- refactor commit summary ---'
git show --format=fuller --stat "$commit" || true

printf '%s\n' '--- refactor commit targeted patch ---'
git show --format= --find-renames --find-copies "$commit" -- \
    packages/rs-sdk/src/platform/documents \
    packages/rs-sdk/src/platform.rs \
    packages/dash-platform-queries/src/documents/document_query.rs \
    packages/rs-sdk/tests/fetch || true

printf '%s\n' '--- parent constructor references ---'
if [ -n "$parent" ]; then
    git grep -n -C 4 'new_with_data_contract_id\|impl DocumentQuery' "$parent" -- \
        packages/rs-sdk packages/dash-platform-queries '*.rs' || true
fi

printf '%s\n' '--- refactor-commit constructor references ---'
git grep -n -C 4 'new_with_data_contract_id\|impl DocumentQuery' "$commit" -- \
    packages/rs-sdk packages/dash-platform-queries '*.rs' || true

printf '%s\n' '--- local history for the exact API symbol ---'
git log --all --oneline --no-renames -S'new_with_data_contract_id' -- \
    packages/rs-sdk packages/dash-platform-queries || true

Repository: dashpay/platform

Length of output: 50375


Preserve DocumentQuery::new_with_data_contract_id(...) compatibility.

The refactor removes the inherent constructor and replaces it with DocumentQuerySdk. Rust requires DocumentQuerySdk to be in scope for this associated call, so existing consumers that import only DocumentQuery no longer compile. Add a source-compatible facade, or document and version this as a breaking API change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/rs-sdk/src/platform/documents/document_query_sdk.rs` around lines 18
- 21, Preserve source compatibility for callers importing only DocumentQuery by
exposing new_with_data_contract_id through an API that does not require
DocumentQuerySdk to be explicitly in scope. Update the DocumentQuerySdk
extension-trait arrangement or add a compatible facade while retaining the
existing DocumentQuery::new_with_data_contract_id(...) call pattern; otherwise
explicitly treat the change as a versioned breaking API change.

Comment thread packages/rs-sdk/src/platform/documents/document_query_sdk.rs
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.45361% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.23%. Comparing base (806890c) to head (fb66886).

Files with missing lines Patch % Lines
...dash-platform-queries/src/transition/validation.rs 0.00% 19 Missing ⚠️
...dash-platform-queries/src/types/finalized_epoch.rs 0.00% 16 Missing ⚠️
packages/dash-platform-queries/src/error.rs 0.00% 15 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           v4.2-dev    #4388      +/-   ##
============================================
- Coverage     86.81%   86.23%   -0.58%     
============================================
  Files          2647     2664      +17     
  Lines        340850   343532    +2682     
============================================
+ Hits         295913   296250     +337     
- Misses        44937    47282    +2345     
Components Coverage Δ
dpp 86.65% <ø> (ø)
drive 85.78% <ø> (-0.02%) ⬇️
drive-abci 88.73% <ø> (ø)
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.92% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 39.69% <ø> (-8.34%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary review — Codex only

The extraction does not satisfy two of its explicit guarantees: the new crate's native dependency graph still includes Tokio, and several public dash-sdk APIs are source-incompatible despite the stated absence of breaking changes. The transport-free CI check also does not inspect the new crate, while two documentation issues leave examples untested and references unresolved.
Source: reviewer backend gpt-5.6-sol; final verifier backend gpt-5.6-sol.
Orchestration-only: openclaw-agent/cliproxy/gpt-5.6-sol (not reviewer evidence).

Validated blockers were found in the Codex precheck. Opus is deferred until a fresh Codex revalidation clears the blocker gate.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet: not run (deferred by blocker gate)

🔴 4 blocking | 🟡 2 suggestion(s) | 💬 1 nitpick(s)

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/rs-sdk/src/platform/documents/document_query_sdk.rs`:
- [BLOCKING] packages/rs-sdk/src/platform/documents/document_query_sdk.rs:16-31: Moving the constructor to an extension trait breaks existing SDK callers
  `DocumentQuery::new_with_data_contract_id` was an inherent public method at the merge base. It is now provided by `DocumentQuerySdk`, which Rust requires callers to import before the associated-function syntax resolves. The SDK's own tests had to add that import, demonstrating that existing code importing only `dash_sdk::platform::DocumentQuery` no longer compiles. This contradicts the PR's explicit guarantee that SDK consumers need no import changes; preserve an SDK-facing source-compatible facade or classify and version this as a breaking API change.

In `packages/dash-platform-queries/src/query_settings.rs`:
- [BLOCKING] packages/dash-platform-queries/src/query_settings.rs:21-28: Removing the public request_settings field is source-incompatible
  `dash_sdk::platform::QuerySettings` now re-exports this struct, but the merge-base type included `pub request_settings: &'a RequestSettings`. Existing callers that construct `QuerySettings` with a struct literal or read that field will fail to compile. The fact that current encoders do not use the field does not make removing a public field source-compatible. Keep a transport-free internal settings type if needed, but retain an SDK-facing compatibility layer under the historical public type.

In `packages/rs-sdk/src/platform/query.rs`:
- [BLOCKING] packages/rs-sdk/src/platform/query.rs:201-204: The new WireQuery bound narrows the public blanket implementation
  At the merge base, every type satisfying `TransportRequest` received the blanket `Query<T> for T` implementation. Adding `WireQuery` removes that implementation for downstream crates' custom transport request types unless those crates are changed to implement a newly introduced SDK trait. Listing all in-workspace request types keeps this repository compiling but does not preserve the public blanket implementation for external consumers. Use a coherence strategy that does not narrow the existing public implementation, or treat the change as a versioned breaking API change.

In `packages/dash-platform-queries/Cargo.toml`:
- [BLOCKING] packages/dash-platform-queries/Cargo.toml:20-24: The transport-free crate still pulls Tokio and native networking features
  The PR description explicitly promises no Tokio anywhere in this crate's dependency graph, but `dash-context-provider` is an unconditional normal dependency and itself unconditionally depends on `dash-async`. On native targets, `dash-async` enables Tokio's `rt`, `rt-multi-thread`, `time`, and `net` features, so the resulting normal graph includes Tokio plus its native networking support. The `dapi-grpc` code-generation path also retains Tokio-related support dependencies. The dependency cut therefore does not meet the stated no-Tokio embedder requirement; the context-provider/async boundary must be split or feature-gated so this crate's normal graph excludes Tokio.

In `.github/workflows/tests-rs-workspace.yml`:
- [SUGGESTION] .github/workflows/tests-rs-workspace.yml:205-211: CI does not inspect the new crate for banned transport dependencies
  The step compiles `dash-platform-queries`, but its inverse dependency-tree assertions inspect only `drive-proof-verifier`. A direct or transitive `hyper`, `rustls`, or `tower` dependency unique to the new crate would pass this check, despite both the PR description and README claiming the new crate's dependency graph is guarded. Include `dash-platform-queries` in the package loop.

In `packages/dash-platform-queries/src/documents/document_query.rs`:
- [SUGGESTION] packages/dash-platform-queries/src/documents/document_query.rs:300: Moved SDK examples are now excluded from doctest compilation
  This example and the two examples at `document_ranked_entries.rs:83` and `document_ranked_entries.rs:130` were `rust,no_run` doctests before the extraction. They now live in `dash-platform-queries`, still import undeclared `dash_sdk` APIs, and were changed to `rust,ignore`, so rustdoc no longer checks them. Move the SDK-specific examples back to SDK-owned documentation or rewrite them against dependencies exposed by `dash-platform-queries`, then restore `rust,no_run` so API drift is caught.

In `packages/dash-platform-queries/README.md`:
- [NITPICK] packages/dash-platform-queries/README.md:19-20: README reference links are undefined
  `[ContextProvider]` and `[drive-proof-verifier]` use shortcut reference-link syntax, but the README defines neither reference. They therefore do not render as clickable links. Use inline repository links or add reference definitions.

Comment on lines +16 to +31
/// Sdk-bound extension methods for [`DocumentQuery`].
///
/// Kept as an extension trait because [`DocumentQuery`] is defined in the
/// transport-free `dash-platform-queries` crate, so its Sdk-dependent
/// constructor cannot be an inherent method there. Bring this trait into
/// scope to keep calling `DocumentQuery::new_with_data_contract_id(...)`.
#[allow(async_fn_in_trait)]
pub trait DocumentQuerySdk: Sized {
/// Create new document query for provided document type name and data contract ID.
///
/// Note that this method will fetch data contract first.
async fn new_with_data_contract_id(
api: &Sdk,
data_contract_id: Identifier,
document_type_name: &str,
) -> Result<Self, Error>;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Moving the constructor to an extension trait breaks existing SDK callers

DocumentQuery::new_with_data_contract_id was an inherent public method at the merge base. It is now provided by DocumentQuerySdk, which Rust requires callers to import before the associated-function syntax resolves. The SDK's own tests had to add that import, demonstrating that existing code importing only dash_sdk::platform::DocumentQuery no longer compiles. This contradicts the PR's explicit guarantee that SDK consumers need no import changes; preserve an SDK-facing source-compatible facade or classify and version this as a breaking API change.

source: ['codex', 'coderabbit']

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in this update — Moving the constructor to an extension trait breaks existing SDK callers no longer present.

Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.

Comment on lines +21 to +28
#[derive(Debug, Clone, Copy)]
pub struct QuerySettings<'a> {
/// Platform protocol version, used to pick wire encoding (V0 vs V1, etc).
pub protocol_version: &'a PlatformVersion,

/// Whether to request and verify cryptographic proofs.
pub prove: bool,
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: Removing the public request_settings field is source-incompatible

dash_sdk::platform::QuerySettings now re-exports this struct, but the merge-base type included pub request_settings: &'a RequestSettings. Existing callers that construct QuerySettings with a struct literal or read that field will fail to compile. The fact that current encoders do not use the field does not make removing a public field source-compatible. Keep a transport-free internal settings type if needed, but retain an SDK-facing compatibility layer under the historical public type.

source: ['codex']

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in this update — Removing the public request_settings field is source-incompatible no longer present.

Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.

Comment on lines 201 to 204
impl<T> Query<T> for T
where
T: TransportRequest + Sized + Send + Sync + Clone + Debug,
T: TransportRequest + WireQuery + Sized + Send + Sync + Clone + Debug,
T::Response: Send + Sync + Debug,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: The new WireQuery bound narrows the public blanket implementation

At the merge base, every type satisfying TransportRequest received the blanket Query<T> for T implementation. Adding WireQuery removes that implementation for downstream crates' custom transport request types unless those crates are changed to implement a newly introduced SDK trait. Listing all in-workspace request types keeps this repository compiling but does not preserve the public blanket implementation for external consumers. Use a coherence strategy that does not narrow the existing public implementation, or treat the change as a versioned breaking API change.

source: ['codex']

Comment on lines +20 to +24
dapi-grpc = { path = "../dapi-grpc", default-features = false, features = [
"platform",
"client",
] }
dash-context-provider = { path = "../rs-context-provider", default-features = false }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking: The transport-free crate still pulls Tokio and native networking features

The PR description explicitly promises no Tokio anywhere in this crate's dependency graph, but dash-context-provider is an unconditional normal dependency and itself unconditionally depends on dash-async. On native targets, dash-async enables Tokio's rt, rt-multi-thread, time, and net features, so the resulting normal graph includes Tokio plus its native networking support. The dapi-grpc code-generation path also retains Tokio-related support dependencies. The dependency cut therefore does not meet the stated no-Tokio embedder requirement; the context-provider/async boundary must be split or feature-gated so this crate's normal graph excludes Tokio.

source: ['codex']

/// # The 5th-best group
///
/// ```rust,no_run
/// ```rust,ignore

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: Moved SDK examples are now excluded from doctest compilation

This example and the two examples at document_ranked_entries.rs:83 and document_ranked_entries.rs:130 were rust,no_run doctests before the extraction. They now live in dash-platform-queries, still import undeclared dash_sdk APIs, and were changed to rust,ignore, so rustdoc no longer checks them. Move the SDK-specific examples back to SDK-owned documentation or rewrite them against dependencies exposed by dash-platform-queries, then restore rust,no_run so API drift is caught.

source: ['coderabbit']

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in this update — Moved SDK examples are now excluded from doctest compilation no longer present.

Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.

Comment on lines +19 to +20
[`ContextProvider`], and verifies every response proof with
[`drive-proof-verifier`].

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 Nitpick: README reference links are undefined

[ContextProvider] and [drive-proof-verifier] use shortcut reference-link syntax, but the README defines neither reference. They therefore do not render as clickable links. Use inline repository links or add reference definitions.

Suggested change
[`ContextProvider`], and verifies every response proof with
[`drive-proof-verifier`].
[`ContextProvider`](../rs-context-provider), and verifies every response proof with
[`drive-proof-verifier`](../rs-drive-proof-verifier).

source: ['coderabbit']

The new workspace crate packages/dash-platform-queries was missing from the four COPY --parents package lists in the root Dockerfile, so cargo chef prepare failed with 'failed to load manifest for workspace member' when building the Drive, RS-DAPI, and Dashmate helper images.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary review — Codex only

The extraction still violates its central compatibility and dependency-graph guarantees: four existing SDK surfaces are source-incompatible, and the new crate transitively enables Tokio's native runtime and networking features. CI does not guard the new crate's dependency graph, and the moved documentation examples are no longer compiled.
Source: reviewer backend gpt-5.6-sol; final verifier backend gpt-5.6-sol.
Orchestration-only: openclaw-agent/cliproxy/gpt-5.6-sol (not reviewer evidence).

Validated blockers were found in the Codex precheck. Opus is deferred until a fresh Codex revalidation clears the blocker gate.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet: not run (deferred by blocker gate)

🔴 5 blocking | 🟡 1 suggestion(s)

2 additional finding(s) omitted (not in diff).

6 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/dash-platform-queries/src/documents/document_query.rs`:
- [BLOCKING] packages/dash-platform-queries/src/documents/document_query.rs:150-155: Re-exported DocumentQuery methods now expose a different error type
  Moving `DocumentQuery` into this crate changes the observable error type of its existing inherent APIs from `dash_sdk::Error` to `dash_platform_queries::Error`. This affects `DocumentQuery::new`, `try_into_request_for_version`, the `TryFromPlatformVersioned` associated error, and conversion from `&DocumentQuery` into `DriveDocumentQuery`. The SDK tests now explicitly convert these errors with `SdkError::from(...)`, demonstrating the incompatibility. Existing callers with explicit `Result<_, dash_sdk::Error>` signatures, direct error matching, or associated-error bounds will no longer compile despite importing the type from its historical path. Preserve an SDK-facing compatibility wrapper or classify and version this as a breaking API change.
- [SUGGESTION] packages/dash-platform-queries/src/documents/document_query.rs:298-304: Moved SDK examples are now excluded from doctest compilation
  (existing thread: https://github.com/dashpay/platform/pull/4388#discussion_r3771764878)
  This example and the examples at `document_ranked_entries.rs:83` and `document_ranked_entries.rs:130` were `rust,no_run` doctests before the extraction. They now remain SDK-specific, import `dash_sdk` APIs that are not declared dependencies of `dash-platform-queries`, and are marked `rust,ignore`, so rustdoc no longer type-checks them. Move the examples to SDK-owned documentation or rewrite them against the transport-free crate's declared dependencies, then restore `rust,no_run` so API drift is detected.

In `.github/workflows/tests-rs-workspace.yml`:
- [SUGGESTION] .github/workflows/tests-rs-workspace.yml:203-211: CI does not inspect the new crate for banned transport dependencies
  The workflow compiles `dash-platform-queries`, but the native inverse dependency-tree assertions still inspect only `drive-proof-verifier`. A direct or transitive banned dependency unique to the new crate would therefore pass this check, despite the README claiming that its dependency tree is guarded by this step. Include `dash-platform-queries` in the native package loop and cover Tokio as well as the listed transport dependencies.

In `packages/rs-sdk/src/platform/documents/document_query_sdk.rs`:
- [BLOCKING] packages/rs-sdk/src/platform/documents/document_query_sdk.rs:16-31: Moving the constructor to an extension trait breaks existing SDK callers
  (existing thread: https://github.com/dashpay/platform/pull/4388#discussion_r3771764868)
  `DocumentQuery::new_with_data_contract_id` was an inherent public method at the merge base. It is now provided by `DocumentQuerySdk`, which Rust requires callers to import before the associated-function syntax resolves. The SDK's own document tests were changed to import `DocumentQuerySdk`, confirming that callers importing only `dash_sdk::platform::DocumentQuery` no longer compile. This contradicts the PR's explicit guarantee that SDK consumers need no import changes; preserve an SDK-facing source-compatible facade or classify and version this as a breaking API change.

In `packages/dash-platform-queries/src/query_settings.rs`:
- [BLOCKING] packages/dash-platform-queries/src/query_settings.rs:21-28: Removing the public request_settings field is source-incompatible
  (existing thread: https://github.com/dashpay/platform/pull/4388#discussion_r3771764870)
  `dash_sdk::platform::QuerySettings` now re-exports this struct, but the merge-base type included `pub request_settings: &'a RequestSettings`. Existing callers that construct `QuerySettings` with a struct literal or access that field will no longer compile. The SDK tests were updated by deleting that field from their literals, confirming the source break. Keep a transport-free internal settings type if needed, but retain an SDK-facing compatibility layer under the historical public type or classify this as a breaking change.

In `packages/rs-sdk/src/platform/query.rs`:
- [BLOCKING] packages/rs-sdk/src/platform/query.rs:201-204: The new WireQuery bound narrows the public blanket implementation
  (existing thread: https://github.com/dashpay/platform/pull/4388#discussion_r3771764874)
  At the merge base, every downstream type satisfying `TransportRequest` received the blanket `Query<T> for T` implementation. Adding the `WireQuery` bound removes that implementation from existing external custom request types until their owners explicitly implement a newly introduced SDK trait. The trait is implementable downstream, but requiring a new implementation is still a source-breaking change. Preserve the previous blanket implementation through a compatible coherence strategy or classify and version this API change.

In `packages/dash-platform-queries/Cargo.toml`:
- [BLOCKING] packages/dash-platform-queries/Cargo.toml:20-24: The transport-free crate still pulls Tokio and native networking features
  (existing thread: https://github.com/dashpay/platform/pull/4388#discussion_r3771764875)
  The PR explicitly promises no Tokio anywhere in this crate's dependency graph, but `dash-context-provider` is an unconditional normal dependency and itself unconditionally depends on `dash-async`. On native targets, `dash-async` enables Tokio's `rt`, `rt-multi-thread`, `time`, and `net` features. Therefore `dash-platform-queries` still includes Tokio and native networking support in its normal graph. Split or feature-gate the context-provider/async boundary so the normal embedder graph satisfies the stated no-Tokio requirement.

In `packages/dash-platform-queries/README.md`:
- [NITPICK] packages/dash-platform-queries/README.md:17-20: README reference links are undefined
  (existing thread: https://github.com/dashpay/platform/pull/4388#discussion_r3771764881)
  `[ContextProvider]` and `[drive-proof-verifier]` use shortcut reference-link syntax, but the README defines neither reference. They therefore do not render as clickable links. Add reference definitions or use inline repository links.

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