Skip to content

feat: read the entries of any private document type in the Swift example app - #6052

Merged
QuantumExplorer merged 14 commits into
v5.1-devfrom
feat/swift-example-private-documents
Nov 22, 2026
Merged

QuantumExplorer merged 14 commits into
v5.1-devfrom
feat/swift-example-private-documents

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

Protocol version 15 added private document types: a type declared private stores fixed-size encrypted entries that name nobody, appended by an anonymous transition paid from the shielded pool. Until now the wallet, the FFI and the Swift SDK could only read one such type, DashPay's privateContactRequest. This PR adds a wallet read for any private type and uses it in SwiftExampleApp: a private type is shown as private, and a new screen lists the entries a chosen wallet can open.

Only the read side is here. Creating an entry of an arbitrary private type is left for a follow-up (see "What is left").

Issue being fixed or feature implemented

SwiftExampleApp showed a private type like any other document type: it offered New Document and listed the type in the document query pickers, though a private type takes no ordinary document and refuses document queries. It had no way to read the type's entries.

Before, on the detail screen of a private type:

Document Type: secret
  [New Document]           <- the network refuses it
  Document Settings ...

After:

Document Type: secret   [Private]
  Private
    Entry size: 400 bytes
    Each entry is a fixed-size encrypted blob ... a reader finds its own by trying to open each one.
    > Read Entries         -> PrivateDocumentEntriesView
  Document Settings ...

The entries screen lists, per entry the wallet's identities opened or sealed: received or sent, position, block time, the wallet identity and key, the recipient, the authentication mode, the sender the entry claims (marked "not verified"), and the payload's properties, or why the payload was refused.

What was done?

rs-sdk (private_document_scan)

  • read_private_document_payload and validate_private_document_properties: decode an opened entry's payload and check it against the type's schema, for any private type. The DashPay private contact request reader now calls the same check; its behaviour does not change.

rs-platform-wallet (new wallet/identity/network/private_documents.rs)

  • IdentityWallet::read_private_document_entries(crypto, data_contract_id, document_type_name, from: Option<PrivateDocumentCursor>, max_pages) -> PrivateDocumentRead: reads at most max_pages proved pages from the cursor the caller keeps (the store's start when None). Entries sealed to the wallet's identities are opened, entries they sealed are recovered with their outgoing viewing keys, and each payload is read against the type's schema. Keys are derived inside the ContactCryptoProvider and stay there. A provider of another seed is refused with SeedMismatch before any page is read. The read stores nothing.
  • PrivateDocumentCursor carries the position, the largest store size any page proved (so a page from a node behind does not end the reading early; None until a page is proved) a fingerprint of the keys read with (when the wallet's keys change, the next read starts over from the store's start and reports restarted), and a fingerprint of its store (contract id and type name): a cursor of another store is refused with InvalidParameter.
  • Every read that reads a page fetches the contract once and reads every payload under the newer of it and the one held: a type can gain optional properties, and DPP refuses a newer payload under the older type for the reader to fetch the contract again. The fetch happens on every such read, whatever opens, so the requests a node sees do not show whether an entry opened.
  • A read that reads no page (no identity can open entries, or a page budget of 0) returns before the seed and protocol version checks and asks the network nothing.
  • Each key an entry can be sealed to is scanned with only once the public key its identity key slot derives inside the signer is the registered one; every key is derived in one call (ContactCryptoProvider::extended_public_keys, one mnemonic resolution on iOS). A key registered from another path, such as a DashPay Connect application key, or whose id names no hardened slot (2^31 or above), is listed in unscanned_keys rather than scanned with a key that opens nothing sealed to it. DashPay's private sync is not changed by this: it selects its scan keys exactly as before this PR.
  • The generic read builds its key paths from the identities the wallet owns (wallet_managed_identities) in PrivateDocumentKeyPaths::add_identity, on its own eligibility rule (an ECDSA_SECP256K1 ENCRYPTION or DECRYPTION key), independent of DashPay's policy for the requests it seals. DashPay's private sync keeps its own key selection unchanged; only the PrivateDocumentKeyPaths type it shares moved to the new module.

rs-platform-wallet-ffi (new private_documents.rs)

  • platform_wallet_read_private_document_entries (taking a nullable PrivateDocumentCursorFFI) and platform_wallet_private_document_read_free. They resolve the handle, call the wallet, and marshal the result. Properties cross as JSON in the encoding document queries already use (bytes base64, identifiers base58). No new error codes: a seed mismatch maps as the private contact request sync maps it, and below protocol version 15 the read fails with ErrorProtocolVersionNotActive. A refusal holding a NUL byte crosses escaped as \0 rather than failing the read.

swift-sdk

  • ManagedPlatformWallet.readPrivateDocumentEntries(contractId:documentTypeName:from:maxPages:), with PrivateDocumentReadCursor, PrivateDocumentEntry and PrivateDocumentEntriesRead. maxPages has no default, and a type name holding a NUL is refused before the FFI call.
  • PersistentDocumentType.isPrivate and privateEntrySize read the keyword off the stored schema. They are derived, not stored, so the SwiftData schema does not change.

SwiftExampleApp

  • A Private badge on the type row; on the type's detail screen, a Private section with the entry size and a Read Entries link, and no New Document.
  • Private types are left out of CreateDocumentView's type picker, the Count and Sum / Average pickers, and the Settings builder's document create.
  • AppState preloads into a new SDK only the saved contracts of the network that SDK is for (the base branch preloaded every network's), so a contract saved on mainnet or testnet cannot shadow the other's under the same id. Two devnet configurations still share .devnet; that, and a document resolver that fetches on a cache miss, are tracked in Saved contracts on devnet/regtest are not tied to a chain, and document FFIs resolve contracts from the cache only #6078.
  • New PrivateDocumentEntriesView (identities labelled with their ownership-aware displayName, an outgoing entry labelled as recovered with the wallet's key rather than sent by it, entries covered while the app is inactive): pick a wallet, Read (at most 8 pages per tap), Read more from the returned cursor (a restarted read replaces the list), a status footer, and the empty states (no identity that can open entries, nothing for this wallet, a network before protocol version 15, other errors verbatim).

Docs

  • TEST_PLAN.md: DC-02 extended, DOC-17 added, getPrivateDocumentEntries added to Appendix A.
  • docs/sdk/sdk-parity-manifest.json: new capability documents.private_document_entries_read (Swift partial, Kotlin not ported); PARITY_SUMMARY.md regenerated.

Public interface changes

  • rs-sdk, new: platform::private_document_scan::{read_private_document_payload, validate_private_document_properties}.
  • platform-wallet, new: IdentityWallet::read_private_document_entries, PrivateDocumentCursor, PrivateDocumentRead, OpenedPrivateDocument, PrivateDocumentDirection, all re-exported from the crate root; PrivateDocumentKeyPaths::fingerprint.
  • platform-wallet, moved: PrivateDocumentKeyPaths moved from private_contact_requests to private_documents. It is re-exported at the same public paths (platform_wallet::PrivateDocumentKeyPaths and the network module), so no caller changes.
  • FFI, new: platform_wallet_read_private_document_entries, platform_wallet_private_document_read_free, PrivateDocumentCursorFFI (88 bytes), PrivateDocumentReadFFI (128 bytes) and PrivateDocumentEntryFFI (184 bytes), with their layouts checked at compile time. platform-wallet-ffi gains a path dependency on platform-encryption for PrivateDocumentAuthMode; the wallet closure check is unaffected.
  • platform-wallet, new trait method: ContactCryptoProvider::extended_public_keys (defaulted, so existing providers compile unchanged). rs-sdk-ffi, new: MnemonicResolverCoreSigner::extended_public_keys (Rust only, no header change); should_resolve_the_mnemonic_once_per_batch_of_public_keys checks one resolver callback for three paths.
  • Swift, new: the wrapper and types above, and the two PersistentDocumentType accessors. SwiftExampleApp's AppState gains a read-only deviceModelContext, so the entries screen reads the device's wallets when opened from a contract-search preview.

How Has This Been Tested?

Targeted runs only:

  • cargo test -p platform-wallet --lib private_documents: 16 new tests pass. They cover received, sent and refused entries, reading on from a bounded read's cursor, a page from a node behind below a size proved earlier, a restart once the keys change, a payload written under a newer version of the type, the contract fetched on a read whose pages open nothing, a read with no contract held yet, a key its identity key slot does not derive listed as unscanned, a key id with no slot listed as unscanned while the read goes on (one batched derivation), and also when nothing is read (no signer call), a cursor of another store refused, a replayed entry, another seed refused, a wallet with no key that opens entries, a public type refused, and the key paths. The size-floor, newer-schema and unscanned-key tests fail with their fix removed.
  • cargo test -p platform-wallet --lib private_contact_requests: 88 pass. These are DashPay's private sync tests; should_refuse_to_sync_an_identity_holding_a_key_with_no_slot is new and pins its existing refusal of a key id with no slot.
  • cargo test -p dash-sdk --lib --features mocks private_document: 40 pass. private_contact_request: 36 pass. One new test reads a payload against its schema.
  • cargo test -p platform-wallet-ffi --lib private_document: 8 new tests pass (a worker panic returned as a wallet operation error, marshal and free, an empty read, a NUL in a refusal, properties that cannot become JSON, the cursor round trip, each null pointer, an unknown wallet with and without a cursor).
  • cargo clippy -D warnings is clean for platform-wallet --all-targets --features shielded, platform-wallet-ffi --all-targets and dash-sdk --lib --tests --features mocks. cargo check -p platform-wallet-ffi --all-targets passes with and without shielded, and cargo fmt --all --check is clean.
  • python3 scripts/check_sdk_parity_manifest.py passes.
  • Swift: the SwiftDashSDK package with its tests, and SwiftExampleApp for the simulator, were compiled against the regenerated FFI headers swapped into an existing xcframework. They compile; linking fails only on the two new symbols, which the older static library lacks. So no Swift test has run and the screen has not been run. A run needs an xcframework built from this branch and a protocol version 15 network with a private type holding an entry for the wallet (DashPay's privateContactRequest works once a private contact request was exchanged).

Breaking Changes

None. No consensus, protocol or storage change. The DashPay private sync scans with the same keys as before.

What is left

Checklist:

  • I have performed a self-review of my own code
  • My Rust, FFI, WASM, Swift or Kotlin changes follow the coding conventions
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request
  • If I added or changed a system contract's document schemas, I checked the contract viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 8740c26

  • Bots — thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed
  • Reviewer requests paused — your 5 review slots are occupied; this PR is excluded from reviewers' queues. Required approvals still count without a slot.
  • Build running
  • Approvals
    • files with no dedicated owner — you own it
    • sdk-parity — you own it
    • kotlin-sdk (packages/kotlin-sdk/PARITY_SUMMARY.md) — HashEngineering
    • rs-platform-wallet-ffi (packages/rs-platform-wallet-ffi/Cargo.toml, packages/rs-platform-wallet-ffi/src/dashpay.rs, packages/rs-platform-wallet-ffi/src/lib.rs and 2 more) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • rs-platform-wallet (packages/rs-platform-wallet/src/lib.rs, packages/rs-platform-wallet/src/wallet/identity/network/contact_requests.rs, packages/rs-platform-wallet/src/wallet/identity/network/mod.rs and 2 more) — HashEngineering or ZocoLini or llbartekll or romchornyi
    • rust-sdk-ffi (packages/rs-sdk-ffi/src/mnemonic_resolver_core_signer.rs) — lklimek or shumkov
    • rust-sdk (packages/rs-sdk/src/platform/dashpay/private_contact_request.rs, packages/rs-sdk/src/platform/private_document_envelope_tests.rs, packages/rs-sdk/src/platform/private_document_scan.rs) — lklimek or shumkov
    • swift-sdk (packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentDocumentType.swift, packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PrivateDocuments.swift, packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift and 10 more) — llbartekll or romchornyi

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

QuantumExplorer and others added 4 commits November 22, 2026 17:49
…ema for any private type

The payload check DashPay's private contact request reader ran
(decode, then dpp's document property validation) is now
`read_private_document_payload` and `validate_private_document_properties`
in `private_document_scan`, for any private type. The DashPay reader calls
the same check, so its behaviour does not change.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…a wallet can open

`IdentityWallet::read_private_document_entries` reads a private type's
store from a caller-kept position, a bounded number of proved pages:
entries sealed to the wallet's identities are opened, entries they sealed
are recovered with their outgoing viewing keys, and each payload is read
against the type's schema. Keys are derived inside the
`ContactCryptoProvider`; a provider of another seed is refused before any
page is read. The read keeps nothing, and reports the sender an entry
names as an unchecked claim.

Which keys an identity scans with is decided once,
`PrivateDocumentKeyPaths::add_identity`, and DashPay's private contact
request sync now uses it instead of its own copy of the rule.

FFI: `platform_wallet_read_private_document_entries` and
`platform_wallet_private_document_read_free`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ivate type apart

`ManagedPlatformWallet.readPrivateDocumentEntries` wraps the wallet's read
of a private type's store. `PersistentDocumentType.isPrivate` and
`privateEntrySize` read the `private` keyword off the stored schema,
derived rather than stored, so the SwiftData schema does not change.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ntries

A private type shows a Private badge and section, offers no New Document,
and is left out of the document create and query pickers, as it takes no
ordinary document and refuses document queries. Its detail screen links
to a screen that reads the entries a chosen wallet can open, one bounded
read per tap.

TEST_PLAN: DC-02 extended, DOC-17 added. Parity manifest:
`documents.private_document_entries_read`.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 301accd and 8740c26.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 29

  • docs/sdk/sdk-parity-manifest.json
  • packages/kotlin-sdk/PARITY_SUMMARY.md
  • packages/rs-platform-wallet-ffi/Cargo.toml
  • packages/rs-platform-wallet-ffi/src/dashpay.rs
  • packages/rs-platform-wallet-ffi/src/lib.rs
  • packages/rs-platform-wallet-ffi/src/private_contact_request.rs
  • packages/rs-platform-wallet-ffi/src/private_documents.rs
  • packages/rs-platform-wallet/src/lib.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/contact_requests.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/mod.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/private_contact_requests.rs
  • packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs
  • packages/rs-sdk-ffi/src/mnemonic_resolver_core_signer.rs
  • packages/rs-sdk/src/platform/dashpay/private_contact_request.rs
  • packages/rs-sdk/src/platform/private_document_envelope_tests.rs
  • packages/rs-sdk/src/platform/private_document_scan.rs
  • packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentDocumentType.swift
  • packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PrivateDocuments.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CountDocumentsView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DataContractDetailsView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DocumentTypeDetailsView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/DocumentsView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PrivateDocumentEntriesView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/SumAverageDocumentsView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/TransitionInputView.swift
  • packages/swift-sdk/SwiftExampleApp/TEST_PLAN.md
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/DocumentTypePrivateTests.swift
  • packages/swift-sdk/SwiftTests/SwiftDashSDKTests/PrivateDocumentReadCursorTests.swift
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added this to the v5.1.0 milestone Nov 22, 2026
@thepastaclaw

thepastaclaw commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress (commit 8740c26) · live progress

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 22, 2026

@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.

Final validation — Phase 1 + Phase 2

The private-document reader reuses existing proof verification, but it can refuse valid entries after a schema update, stop before a previously proved store end, and fail to find wallets from the contract-search preview. The review also found FFI and memory-handling blockers; three lower-priority comments are omitted under the 10-comment limit. This was a static review of 4e977e4: Rust workspace tests passed in CI, no code check had failed, and the Swift SDK build and tests were still pending.

🔴 7 blocking | 🟡 3 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The new wallet implementation in private_documents.rs adds an intricate key-handling path that checks the provider seed, selects identity key paths, and uses those keys to decrypt received entries and recover sent entries.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:302-308: Refresh a stale private-type schema before refusing a payload
  `fetch_private_document_contract` returns the cached contract as soon as it contains the named private type. That suffices for the page proof, which checks the committed entry size, not the schema revision. DPP allows compatible updates that append optional properties and explicitly rejects a newer payload under the older schema. The wallet turns that error into a per-entry refusal and advances the cursor; reading from the start can hit the same cache. Preserve the distinction between decode and validation errors in Rust, then refresh the proved contract once per read when a decode failure indicates a possible schema mismatch. Test that an entry using an optional field added in revision 2 opens with revision 1 cached, while an invalid payload is still refused.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:348-352: Keep the largest proved store count across continuations
  The maximum count survives only within one call. If a read proves five entries and stops at position 2, a continuation can receive a valid older snapshot with four entries and report `next_position = 4` and `complete = true`. Swift replaces `lastRead` and hides Read more even though position 4 is already known to exist. Carry the proved count floor in the caller-held Rust continuation and keep the read incomplete or retryable below it. DashPay's `should_carry_the_largest_proved_store_size_across_bounded_passes` covers this exact sequence.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:353-367: Bound decoded result memory independently of the page limit
  The wallet retains every decoded `Value` tree until the read returns. DPP's typed-array reader can expand a compact encoded count into up to 1,024 separate values for a property with zero-width elements. Neither the fixed entry size nor the app's eight-page limit bounds that expansion to a safe mobile allocation, and the public Swift API defaults to reading to the end. Enforce a decoded-memory budget in Rust, including temporary decoding and validation work, and return a continuation at the first unconsumed position. If one entry cannot fit in a fresh read, report a per-entry limit refusal so the caller can still advance.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:314-321: Apply the page budget before scheduling chunk requests
  The wallet's `.take(max_pages)` limits what the scanner receives, not what the SDK requests. Once a proof establishes chunk geometry, `whole_chunk_pages` buffers up to 16 chunk futures. On a long store, polling for the second page of a two-page read can start requests for chunks this call will discard and the next call will request again. Limit the planned chunk starts before buffering, separately from retries needed to finish an in-budget chunk. Test the requested start positions; the current one-page continuation test never polls the buffered portion.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:292-296: Bind continuation progress to the scan key set
  Each call snapshots the wallet's current scan keys, but a continuation supplies only a position. If an identity is restored between taps, Read more skips positions that the restored keys could now open, then can present the combined result as complete. Include a key-set fingerprint in the caller-held continuation and have Rust signal that the scan needs to restart when it changes. DashPay already uses a fingerprint and rewind for this case.

In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PrivateDocumentEntriesView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PrivateDocumentEntriesView.swift:21-24: Read wallets from the device store in contract-search previews
  `ContractsTabView` injects `.modelContainer(preview.container)` for search results. `ContractDownloader` creates that in-memory store with the previewed contract and its children, not the device's wallets or identities. Following Private → Read Entries therefore runs these queries against the preview store, shows “No wallets on this network,” and disables Read even with a loaded wallet. Pass the device wallet context or wallet choices separately from the preview document type, and verify both the preview and saved-contract routes.
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PrivateDocumentEntriesView.swift:193-200: Distinguish an unread store from a proved empty store
  When no identity has a scanning key, Rust returns before fetching a page and leaves `total_count` at its default zero. A zero-page budget likewise yields no observation. That zero crosses FFI unchanged, so the screen shows “Store size: 0” even while saying nothing was read. Preserve an unknown count across Rust, C, and Swift and render zero only when a proof establishes it. Also document the no-progress outcome for callers: `complete == false` alone is not a reason to retry immediately when no identity can scan or the budget is zero.

In `packages/rs-platform-wallet-ffi/src/private_documents.rs`:
- [BLOCKING] packages/rs-platform-wallet-ffi/src/private_documents.rs:258: Keep a refusal containing NUL local to its entry
  DPP's native string validator includes rejected string values verbatim in some diagnostics, so a refusal can contain a literal NUL. `CString::new(refusal)?` then fails the entire FFI read rather than returning a refusal for that entry. Swift loses the valid entries and the continuation position, and retrying the same page does not advance. Escape NUL at the marshalling boundary and update the existing interior-NUL test to assert that the refusal, neighboring entries, and cursor all survive.

In `packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentDocumentType.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentDocumentType.swift:151-166: Use DPP's parsed storage classification to gate document operations
  These accessors decide whether the app offers ordinary document operations or a private-store read. The Swift SDK treats any `private` key as private and missing schema as public; DPP instead uses the parsed `PrivateDocumentConfig` and ignores the keyword on the pre-v15 stored-contract path. The Count, Sum/Average, and Create fallbacks also treat names with no type metadata as public. Marshal DPP's parsed classification and entry size through `rs-sdk-ffi`, and leave operations unavailable when the type cannot be resolved. That keeps the protocol decision in Rust, as required by the book's FFI and mobile SDK ownership rule.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PrivateDocuments.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PrivateDocuments.swift:169-171: Reject document type names that cannot cross the C-string boundary
  Swift strings can contain U+0000. `withCString` followed by `CStr::from_ptr` reads only the prefix before that byte. If the prefix names a private type, the call returns a different type's entries instead of rejecting the input. Check for this representation error before FFI; DPP still owns document-name validation.

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
… schema

Review fixes for the private document read:

- The read takes and returns a `PrivateDocumentCursor`: the position, the
  largest store size any page proved (a page from a node behind no longer
  ends the reading early), and a fingerprint of the keys read with (when
  the wallet's keys change, the next read starts over and reports
  `restarted`). An unproved store size is `None`, not 0.
- A payload that does not read under the contract held is read again,
  once a read, under the contract the network proves now when that is
  newer: a type can gain optional properties.
- No more pages are fetched at once than the read's budget.
- FFI: the cursor crosses as `PrivateDocumentCursorFFI`; a refusal
  holding a NUL crosses escaped rather than failing the whole read.
- Swift: the cursor replaces the start position, `maxPages` has no
  default, and a type name holding a NUL is refused before the FFI call.
- App: the entries screen reads the device's wallets and identities
  when opened from a contract-search preview, replaces its list on a
  restarted read, and shows an unproved store size as unknown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 2026

@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.

Re-review — Final validation — Phase 1 + Phase 2

The new reader misses entries addressed to wallet-derived application keys, and the new schema refresh exposes a local decryption outcome through DAPI traffic. The Settings pickers and continuation API also have gaps. Kotlin CI passed; review and PR Hygiene are pending, and no linked Swift test or simulator run was reported.

🔴 5 blocking | 🟡 4 suggestion(s)

Still open from earlier rounds (4)

  • 🔴 Blocking: Refresh a stale private-type schema before refusing a payload — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:330-337 (thread)
  • 🔴 Blocking: Bound decoded result memory independently of the page limit — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:487-511 (thread)
  • 🔴 Blocking: Use DPP's parsed storage classification to gate document operations — packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentDocumentType.swift:151-159 (thread)
  • 🟡 Suggestion: Apply the page budget before scheduling chunk requests — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:422-429 (thread)
Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Exclude private types from the Settings Replace and Delete pickers
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/TransitionInputView.swift:430-436

DPP accepts private types that inherit immutability and non-deletability from their contract defaults; its private-type tests cover both flags being omitted from the type. PersistentDocumentType initializes both flags to true, and DataContractParser only overrides them when the type dictionary declares them. The Settings builder now hides these types for Create but still offers them for Replace and Delete. Use the resolved storage classification in both the contract and type filters, and test a private type that inherits both flags.

source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, platform-versioning, rust-quality, security-auditor)

Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The new IdentityWallet::read_private_document_entries path in packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs is intricate and directly changes wallet key handling by selecting identity keys for decryption and outgoing recovery, checking seed binding, and tying scan resumption to the key set.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Code unchanged since the last final review (4e977e4a): 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs`:
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:88-101: Resolve the derivation path of the registered encryption key
  `add_identity` derives every eligible key from the ordinary identity-authentication slot at `(identity_index, key_id)`. This wallet also derives DIP-13 application encryption and decryption keys using the identity ID, contract ID, purpose, and rotation, and supports recognizing keys registered under the legacy path. A registered application key passes `scanning_key`, but the scanner derives an unrelated secret and can report a completed read that missed the entry. Resolve the wallet-owned key in Rust and verify that the derived public key matches the registered one. Cover a registered application key in the scan tests, not just ordinary identity slots.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:496-505: Keep schema refresh traffic independent of which entries open
  With the same cached contract and public pages, only a reader that opens or recovers an entry with a refused payload sends the extra `GetDataContract` request. This happens even when the cached schema is current. An observer who correlates the page and contract requests can therefore distinguish some readers with a matching key from readers without one. Schedule schema lookups from public scan inputs and proof heights, not from a decrypted payload. Test that readers with and without a matching key issue the same lookups for the same pages.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:388-399: Bind the continuation to its private document store
  A cursor from one type passes the key-fingerprint check for another type in the same wallet. The second type then inherits both the first type's position and its proved count floor. That can skip entries or leave the second store incomplete against a count it never proved. Bind the cursor to the network, contract ID, and type name. Reject a store mismatch or reset both position and count; preserve the size floor only when restarting for new keys on the same store.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:330-337: Refresh a stale private-type schema before refusing a payload
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4657974927)
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:487-511: Bound decoded result memory independently of the page limit
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4657974946)
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:422-429: Apply the page budget before scheduling chunk requests
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4657974957)

In `packages/rs-platform-wallet-ffi/src/private_documents.rs`:
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/private_documents.rs:443-445: Specify how C callers can reuse a read result for pagination
  The pagination docs say to pass the result's cursor back, but the pointer requirements do not rule out passing `&read.cursor` as `from` while reusing `&read` as `out_read`. The function clears the output before it copies the cursor, losing both the cursor and the pointer needed to free the prior entries. Document the sequence Swift already follows: keep a separate cursor value and pass an output that does not own a previous result.

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PrivateDocuments.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PrivateDocuments.swift:204-208: Document when the read checks activation and seed binding
  The Rust read returns a successful no-progress result when `max_pages` is zero or the scan-key set is empty, before it checks the seed or protocol activation. This is a reasonable local no-op, but the Rust, C, and Swift error contracts do not qualify those guarantees. State that a no-op success does not establish network support or verify that the resolver belongs to the wallet.

In `packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentDocumentType.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentDocumentType.swift:151-159: Use DPP's parsed storage classification to gate document operations
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4657974951)
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Add a per-payload allocation budget to DPP's shared document reader — The existing reader caps each typed array separately, so callers other than this wallet can also incur substantial temporary allocations while materializing a single payload. A wallet result budget does not cover that work.
    • Follow-up: Track a separate DPP change for an allocation budget on client decoding paths, with compatibility coverage and no change to shipped consensus behavior.

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
…ursor to its store

- The contract is fetched once on every read that reads a page, rather
  than only once a payload is refused: a fetch that depends on what
  opened would tell the node that the reader opened an entry.
- `PrivateDocumentCursor` carries a fingerprint of its store (contract id
  and type name); a cursor of another store is refused with
  `InvalidParameter` instead of lending that store's position and size.
- Docs: a read that reads no page returns before the seed and protocol
  version checks, and the C pointer rules say how to read on from a
  previous result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@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.

Re-review — Final validation — Phase 1 + Phase 2

This head makes schema refresh independent of decryption and rejects cursors from a different contract or document type, but blocking findings remain. A cold-cache read also performs a redundant contract fetch. The Kotlin SDK build and tests passed, PR Hygiene remains pending, and the Swift SDK and example app have not been linked and run against this head.

🔴 3 blocking | 🟡 5 suggestion(s)

Still open from earlier rounds (5)

  • 🔴 Blocking: Resolve the derivation path of the registered encryption key — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:88-101 (thread)
  • 🔴 Blocking: Refresh a stale private-type schema before refusing a payload — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:451-459 (thread)
  • 🔴 Blocking: Bound decoded result memory independently of the page limit — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:531-538 (thread)
  • 🟡 Suggestion: Bind the continuation to its private document store — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:416-435 (thread)
  • 🟡 Suggestion: Apply the page budget before scheduling chunk requests — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:466-473 (thread)

Disputed — left to maintainers (1)

  • 🔴 Blocking: Use DPP's parsed storage classification to gate document operations — packages/swift-sdk/Sources/SwiftDashSDK/Persistence/Models/PersistentDocumentType.swift:151-166 (thread)
Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Label the refusal count as envelope refusals
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/PrivateDocumentEntriesView.swift:210

rejectedCount counts scan.rejected. An opened envelope with an invalid payload stays in entries and is not included, so the status can say “Refused entries: 0” while a row says “Payload refused.” Label the counter for the refusals it measures.

                InfoRow(label: "Refused envelopes:", value: "\(rejectedTotal)")

source: gpt-6.2-astra (phase2-reviewer: general)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The change is intricate and directly changes wallet key handling: IdentityWallet::read_private_document_entries selects identity key paths and uses signer-derived recipient and outgoing viewing keys to decrypt entries from arbitrary private document stores.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Code unchanged since the last final review (d2f7d11e): 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:447-455: Avoid fetching the contract twice on a cold cache
  When the provider lacks the named private type, `fetch_private_document_contract` already fetches and registers the proved contract. `newer_private_document_contract` then issues the same query before the first page. This adds a round trip and can fail a read that just obtained the contract. Let the SDK resolver return the fresh observation and its metadata so the cold-cache result can also satisfy the initial refresh. The current traffic test starts with a held contract; add a cold-cache request-count assertion.
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:88-101: Resolve the derivation path of the registered encryption key
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4658117197)
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:451-459: Refresh a stale private-type schema before refusing a payload
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4657974927)
- [BLOCKING] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:531-538: Bound decoded result memory independently of the page limit
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4657974946)
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:416-435: Bind the continuation to its private document store
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4658117205)
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:466-473: Apply the page budget before scheduling chunk requests
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4657974957)

In `packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PrivateDocuments.swift`:
- [SUGGESTION] packages/swift-sdk/Sources/SwiftDashSDK/PlatformWallet/PrivateDocuments.swift:243: Pin the wallet owner along with the resolver during the detached call
  The detached closure owns the resolver but only copies the wallet's numeric handle. If the last Swift owner is released before the registry lookup, `ManagedPlatformWallet.deinit` removes that handle and the pending read fails. Rust clones the wallet view after lookup, so this is a missing-handle window, not a dangling-pointer read. Pin the wallet for the synchronous FFI call as `refreshIdentityBalance` does.

In `packages/rs-platform-wallet-ffi/src/private_documents.rs`:
- [SUGGESTION] packages/rs-platform-wallet-ffi/src/private_documents.rs:503-513: Contain worker panics inside the C read export on unwind builds
  On unwind builds, a worker panic becomes a Tokio join error, and `block_on_worker` turns that error back into a panic with `.expect("tokio worker panicked")`. In this `extern "C"` export that aborts the host before Swift can check a result. Use the crate's `catch_panic_to_code` around the worker call after initializing `out_read`. A read can return an operation error without implying anything about an ambiguous write. This does not catch panics on iOS profiles built with `panic = "abort"`.
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Account for temporary memory in DPP property decoding — DPP's existing per-array limit does not account for cumulative temporary allocations across one payload's properties. That codec is shared with public document reads; it is separate from the wallet's new retention of multiple decoded entries.
    • Follow-up: Track a DPP follow-up for per-payload allocation accounting in the shared decoder and validation path.

… and report the rest

- Each key an entry can be sealed to is scanned with only once the public
  key its identity key slot derives inside the signer is the registered
  one. A key registered from another path, such as a DashPay Connect
  application key, is listed in `unscanned_keys` instead of being scanned
  with a key that opens nothing sealed to it. DashPay's private sync is
  unchanged.
- The cursor's store fingerprint names the network: DashPay has the same
  contract id on every network.
- With no contract held, the read no longer fetches it twice.
- FFI: `unscanned_key_count`; a worker panic in the read export returns
  `ErrorWalletOperation` on unwind builds.
- Swift: the wallet is kept alive with the resolver during the call; the
  app labels the envelope refusal count and shows keys not scanned.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 2026
@github-actions github-actions Bot removed the waiting-self-review Waiting for the author to post /self-reviewed label Nov 22, 2026

@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.

Re-review — Final validation — Phase 1 + Phase 2

This head scopes scan keys to the selected wallet, separates outgoing recovery from append authorship, and filters contract preload by the SDK’s network kind. The wallet-isolation change still needs a regression test with two ownership buckets in one manager. Kotlin build/tests and the SwiftData coverage check passed; review and PR Hygiene remain pending, and there is no linked Swift app run.

🔴 1 blocking | 🟡 3 suggestion(s)

Still open from earlier rounds (2)

  • 🟡 Suggestion: Bind the continuation to its private document store — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:276-285 (thread)
  • 🟡 Suggestion: Bind cursor progress to the keys actually used to scan each batch — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:672-691 (thread)
Review provenance

Source: reviewer 1: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The substantial implementation in rs-platform-wallet/src/wallet/identity/network/private_documents.rs changes which wallet identity keys are derived and verified for incoming decryption and outgoing recovery, making the diff itself an intricate key-handling change.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift:382-385: Keep foreign cached contracts out of private reads
  The new predicate separates mainnet from testnet, but it compares only `networkRaw`. When the user changes the devnet quorum URL, Options rebuilds for `.devnet`, and `SDK.init` discovers DAPI addresses from the new URL. Saved contracts from the old devnet still pass the predicate and enter the new SDK’s contract-ID cache. For a shared ID such as DashPay’s, a higher revision from the old chain can make `fetch_private_document_contract` reject the new chain’s proved private type before the refresh runs. If the cached revision already parses as private, it can instead survive the refresh and supply the wrong payload schema. Skip trusted preload for configurable chains until saved rows can be tied to the chain the SDK actually uses. Cover a switch between two devnet configurations with the same contract ID, not just two different `Network` cases.

In `packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:386-389: Test private reads with two wallet ownership buckets
  `wallet_with` registers its only owned identity under `wallet.wallet_id()`, so reverting to `all_identities()` would not change the fixture’s results. Add an eligible identity derived from another seed at the same registration index under a second wallet ID in that same `IdentityManager`. Assert that the selected wallet still opens its entry and the foreign identity contributes neither candidate paths nor `unscanned_keys`. Checking only the opened entries would miss the regression: public-key verification can reject the foreign key after it has already been collected for the wrong wallet.
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:276-285: Bind the continuation to its private document store
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4658117205)
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:672-691: Bind cursor progress to the keys actually used to scan each batch
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4658944256)

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
…a second wallet's identity

- SwiftExampleApp preloads saved contracts only on mainnet and testnet.
  A devnet or regtest chain is configured by the user (quorum URL, local
  setup), and a saved row records only the network value, so a contract
  saved on one devnet could shadow another's under the same id. Those
  SDKs fetch and prove contracts as they need them.
- `should_read_only_for_the_identities_of_the_wallet_read` puts an
  identity of another wallet id in the same identity manager and checks
  it contributes no key, scanned or unscanned (it fails when every
  identity the manager holds is collected).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 2026

@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.

Re-review — Final validation — Phase 1 + Phase 2

The new two-wallet fixture checks the ownership boundary, and the preload guard keeps saved devnet and regtest contracts out of a new SDK’s trusted cache. The guard also introduces a blocking regression: existing document creation and history operations cannot resolve saved custom contracts after a cold restart on the same chain. On the reviewed head, the Kotlin emulator tests and SwiftData model check passed; CI does not establish a linked Swift app test run.

A pattern across this PR's review rounds

This is review round 9, and the PR has drawn 18 blocking findings so far. 11 of them share 2 underlying causes. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.

1. No single source for the connected chain’s schema (1 new in this round, 6 earlier finding(s))

fetch_private_document_contract and newer_private_document_contract separately choose between cached and proved revisions, even though a higher cached revision does not establish which chain supplied it. Fetching before decryption removed the payload-dependent traffic, but AppState.makeSdk(for:) still relied on the same preload both to supply saved custom contracts and to decide which saved bytes the SDK could trust. Disabling preload on devnet and regtest keeps foreign schemas out at startup, but leaves document creation and history looking for custom contracts through SDKWrapper::data_contract, which cannot fetch on a cache miss.

In this round: Keep saved custom contracts usable after a devnet or regtest restart

2. Checked paths are not checked scan coverage (6 earlier finding(s))

PrivateDocumentKeyPaths records where to derive a key, not whether that path yields the registered key or which key actually scanned a page. The generic reader now checks the registered key and reports unsupported slots, but MnemonicResolverCoreSigner::scan_private_document_pages resolves the seed again for each batch. The cursor fingerprints the paths, so it can still advance after a batch that did not use the keys the reader checked.

Already tracked: #6075

Suggested decision (redesign the component): Make the SDK’s contract resolver, not the app’s startup preload, responsible for supplying a schema from the connected chain even when the cache is empty. Use that rule before opening any private entries, and require it to preserve saved-contract creation and history after a same-chain devnet or regtest restart without trusting saved bytes whose chain is unknown.

🔴 1 blocking | 🟡 1 suggestion(s)

Still open from earlier rounds (1)

  • 🟡 Suggestion: Bind the continuation to its private document store — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:283-288 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The new wallet read in packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs adds intricate key-handling logic that checks seed and identity-key correspondence, selects keys for opening and recovering entries, and binds scan resumption to the key set.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): No single source for the connected chain’s schema; Checked paths are not checked scan coverage. When you fix the findings below, fix the cause, not only the reported case. The review suggests (redesign the component): Make the SDK’s contract resolver, not the app’s startup preload, responsible for supplying a schema from the connected chain even when the cache is empty. Use that rule before opening any private entries, and require it to preserve saved-contract creation and history after a same-chain devnet or regtest restart without trusting saved bytes whose chain is unknown. If that decision is not yours to make, say so to the PR's author or maintainer.

These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift:402-405: Keep saved custom contracts usable after a devnet or regtest restart
  The guard correctly keeps bytes from a different chain out of the trusted cache, but it also removes the only contract-loading step for some existing operations. After restarting on the same devnet or regtest with a saved custom contract, Settings → Document Create still reads the type from SwiftData, then calls `dash_sdk_document_create`. That function calls `SDKWrapper::data_contract`, which only asks the context provider; the adaptive provider’s local resolver serves registered and system contracts, not a network fallback. Creation therefore fails with “Contract … not found in the SDK's context provider” before signing. `dash_sdk_document_fetch_history` makes the same cache-only check before issuing its query. Keep the preload guard and have those operations use a shared Rust SDK resolver that fetches and registers the active chain’s proved contract on a miss. Test a cold SDK with a saved non-system contract and no intervening download; the preload predicate tests do not exercise either operation.

In `packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:283-288: Bind the continuation to its private document store
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4658117205)

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
… to the SDK's network

Skipping the preload there left saved custom contracts unusable after a
restart on the same chain: the document FFIs resolve contracts from the
SDK's cache only (`SDKWrapper::data_contract`). The preload keeps this
branch's per-network filter, already narrower than the base branch's
all-network preload. Tying saved rows to a chain on configurable
networks, and a document resolver that fetches on a miss, are tracked in
#6078.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 2026

@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.

Re-review — Final validation — Phase 1 + Phase 2

The revert restores same-chain saved-contract lookup on devnet and regtest without undoing the mainnet/testnet filter. It also restores a blocker for the new private reader: after a devnet switch, a saved contract from the previous chain can still override the schema proved by the active chain. The Kotlin SDK build and tests and the SwiftData model inventory check passed; PR Hygiene remains pending, and no linked Swift test or screen run was evidenced.

🔴 1 blocking | 🟡 1 suggestion(s)

Still open from earlier rounds (2)

  • 🔴 Blocking: Keep foreign cached contracts out of private reads — packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift:380-385 (thread)
  • 🟡 Suggestion: Bind the continuation to its private document store — packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:283-288 (thread)
Follow-up candidates (optional) (3)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Decode with the contract the SDK retained after refresh
packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:502-509

If the read starts with revision 1 and another operation registers revision 3 while the refresh fetches revision 2, LocalContextResolver retains revision 3. This helper still returns revision 2, so the page verifier uses revision 3 while the wallet can refuse a valid revision-3 payload under revision 2. The existing rs-sdk resolver already handles cache promotion during its own fetch by consulting the provider again. Keep refresh-and-selection alongside that resolver and return the usable contract the provider retained, without making an extra network request. Test a provider that promotes the contract while the refresh is outstanding.

source: gpt-6.2-astra (phase2-reviewer: architecture-layering)

🟡 Suggestion: Document that C callers must not modify the returned strings in place
packages/rs-platform-wallet-ffi/src/private_documents.rs:36-38

The strings are exposed as writable char *, but cleanup uses CString::from_raw, which requires the original C-string length. A C caller using an in-place parser that inserts an earlier NUL can violate that requirement even if it correctly leaves freeing to Rust. Swift already copies the strings; document the read-only contract for C callers.

/// Exactly one of `properties_json` and `properties_refusal` is non-null.
/// Both are borrowed, read-only strings owned by the enclosing
/// [`PrivateDocumentReadFFI`]. Do not modify or free them; copy the string
/// first if an API needs a writable buffer.

source: gpt-6.2-astra (phase2-reviewer: general, architecture-layering, ffi-engineer, platform-versioning, rust-quality, security-auditor)

🟡 Suggestion: Exercise a key-change restart with a cursor returned by the wallet
packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:1415-1422

The restart test supplies a synthetic [9; 32] fingerprint, and the separate fingerprint assertion compares a nonempty set with an empty one. Both tests would pass if two different nonempty sets produced the same fingerprint. Read a page with one verified key, add a second wallet-derived key that opens an entry on that page, and continue with the cursor from the first read. Assert that the reader reports a restart and recovers the previously missed entry.

source: gpt-6.2-astra (phase2-reviewer: rust-quality)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 7: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 8: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The new wallet read path in rs-platform-wallet/src/wallet/identity/network/private_documents.rs adds intricate key handling: it binds the signer to the wallet seed, matches derived keys to registered identity keys, uses outgoing viewing keys to recover sent entries, and restarts scans when the key set changes.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Code unchanged since the last final review (b3a7b987): 3 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/AppState.swift:380-385: Keep foreign cached contracts out of private reads
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4659078040)

In `packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/private_documents.rs:283-288: Bind the continuation to its private document store
  (carried; thread: https://github.com/dashpay/platform/pull/6052#discussion_r4658117205)

@github-actions

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 22, 2026
…r a refresh

- After the read's refresh registers the fetched contract, the read uses
  the contract the context provider then holds when it is at least as
  new and declares the type, so pages and payloads are read under the
  same contract when another operation promoted a newer one meanwhile.
- Tests: a provider promoting a newer contract during the refresh, and a
  key-change restart driven by a cursor the wallet returned (an entry
  sealed to a key the identity registers between reads is found).
- FFI docs: the returned strings are read-only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 22, 2026
@QuantumExplorer
QuantumExplorer merged commit 131b23a into v5.1-dev Nov 22, 2026
19 of 21 checks passed
@QuantumExplorer
QuantumExplorer deleted the feat/swift-example-private-documents branch November 22, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants