Skip to content

feat: raise an identity key's budget or expiry from KotlinExampleApp - #6148

Merged
QuantumExplorer merged 10 commits into
v5.1-devfrom
feat/kotlin-example-key-limits
Nov 23, 2026
Merged

QuantumExplorer merged 10 commits into
v5.1-devfrom
feat/kotlin-example-key-limits

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: Since protocol version 14 an identity key can have a spending budget and an expiry date. SwiftExampleApp can show these limits and raise them (#6054). KotlinExampleApp could not show them at all. This PR adds both to the Android app: the key screens now show a key's budget, what is left of it and its expiry, and a new Update Limits screen tops up the budget or moves the expiry later. As on iOS, the screen first asks the Rust wallet whether the key can be raised, which key would sign, and what the new limits would be. It then signs exactly what it showed, so every rule stays in Rust.

Value: An Android user whose app key has run out of budget, or is about to expire, can extend it in place instead of disabling it and adding a new one. Changes that Platform would refuse and still charge for (a disabled key, a zero top-up, an expiry that is not later) are refused for free before anything is signed. This closes the Kotlin gap that #6054 left open.

Risks: Low. No consensus, wallet or FFI changes. The JNI crate gets three new exports, and the Kotlin SDK and app get additions only. Nothing has been run on an emulator yet (see "Not yet verified").

Issue being fixed or feature implemented

This mirrors Swift test plan ID-17 as Kotlin ID-21 (Kotlin's ID-17 is already a different test). The Kotlin SDK already had the old write, IdentityUpdates.updateKeyLimits. It could not read a key's current limits from the wallet the way Swift does: there was no bridge for the preview, the reviewed update or the proved identity refresh. This PR adds those three bridges.

I searched open PRs and issues on 2026-11-23 ("key limits", "kotlin limits"). None adds this screen. #6063 (keep an unconfirmed update pending) is related; see "Recovery after process death" below.

What was done?

rs-unified-sdk-jni: new identity_key_limits.rs with three exports on IdentityKeyLimitsNative. Each one marshals a single C function:

  • previewKeyLimitsUpdate -> platform_wallet_preview_identity_key_limits_update. The preview crosses JNI as six long slots: [signingKeyId, flags, currentTotalBudget, currentExpiresAt, newTotalBudget, newExpiresAt].
  • updateKeyLimitsAsReviewed -> platform_wallet_update_identity_key_limits_as_reviewed_with_signer. It takes the same six slots back.
  • refreshIdentity -> platform_wallet_refresh_identity.

Key ids, credits and milliseconds cross as their unsigned bit patterns, the same way the persister already writes key ids. A value the C type cannot carry is refused with code 1 before any C call.

Kotlin SDK: IdentityUpdates.previewKeyLimitsUpdate, updateKeyLimitsAsReviewed and refreshIdentity, each run through the manager's teardown gate. The preview and the update sign with the manager's own signer, read inside that gate, rather than a handle the caller passes (another owner could close a passed handle mid-call). The identity id is copied once before the call. The update runs under opReturningCompletedResult, so a completed update is returned even to a cancelled caller. IdentityKeyLimitsUpdatePreview holds credits and milliseconds as ULong, so no value is narrowed. Identities.fetchKeysRemainingBudgets (and its JNI export) now accept a key id past Int.MAX_VALUE as its u32 bit pattern instead of refusing it.

KotlinExampleApp

  • KeyDetailScreen gets a Limits section (KeyLimitsSection), shown for a key that has a budget or an expiry. It shows the total budget, the remaining budget read from Platform for that total, and the expiry. Its Update Limits button (keyLimits.update.open) is enabled only when Rust's no-change preview succeeds. Otherwise the button is disabled and Rust's reason is shown (keyLimits.update.unavailableReason).
  • KeysListScreen rows show the budget and expiry. A Limits action (keyLimits.update.swipe.<keyId>) stands in for Swift's leading-edge swipe.
  • UpdateKeyLimitsScreen + UpdateKeyLimitsViewModel port UpdateKeyLimitsView.swift:
    • opens with a proved refresh, then the no-change preview;
    • previews again 300 ms after each edit;
    • offers submit only while the latest preview matches the form exactly, and sends that preview unchanged;
    • refuses every call once the wallet has been reloaded.
  • It reuses Swift's keyLimits.update.* identifiers as test tags. The date and time buttons add .date and .time suffixes under keyLimits.update.expiryPicker.
  • System Back is held while an update is being sent. A confirmed update is recorded before the screen closes, so a restored state closes again instead of offering the applied increment. A restored lock is shown whatever the opening refresh answers.
  • The total, labelled Last-synced budget, and the remaining budget, a separate Platform read labelled on Platform, are shown apart, since they can come from different blocks until rs-sdk: return a key's total and remaining budget from one proof #6064.
  • The expiry date picker covers years 1970 to 9999. A key whose expiry is later shows it in milliseconds and offers only a budget change; a restored expiry edit the screen no longer offers is dropped, with a note.
  • KeyLimitsFormatting ports only the display and input-parsing parts of Swift's helper. DASH text is parsed exactly, up to u64 credits, and zero is accepted so that Rust gives the refusal. The app's existing parseDashToCredits refuses zero (a rule) and stops at Long.MAX_VALUE, so it is not reused here.

Rules that stay in Rust: this PR adds no rule in Kotlin. Which keys can be raised, which amounts and expiries are valid, and which key signs all come from the Rust preview. Swift's KeyLimitsRetryGate is a decision taken in the Swift view: after a consensus refusal, it offers the same preview again if the wallet still shows the reviewed limits. I did not copy it. In Kotlin, any failed submission locks the screen, and reopening it starts again from a proved refresh. That is never less safe than Swift. Moving this decision to Rust for both apps is #6063.

Recovery after process death

  • Covered here: the form, the lock and an "in flight" flag are kept in SavedStateHandle. Suppose the system kills the process while an update is being sent and the user then returns through Recents. The screen comes back locked and says the update may have landed. It still re-reads the key from Platform, but it does not offer another submission (unit-tested). Reopening the screen also always starts from a proved refresh. A repeated update signs the same absolute limits, so if the first one did land, the repeat is refused as not a raise (40221) and nothing is added twice.
  • Left to Keep an unconfirmed key limits update pending across sheet re-entry #6063: a pending update recorded by the wallet itself, per identity and key, that survives leaving the screen, removing the task or relaunching the app, and that blocks a new update until a proved refresh settles it. That record belongs in Rust for both apps. So the manifest marks restart as required for both hosts.

Parity: adds the identity.key_limits_update capability to docs/sdk/sdk-parity-manifest.json. Both hosts are SDK supported, example app partial and restart required. PARITY_SUMMARY.md was regenerated with the script.

Before / after

// Before: the only call was a blind write; nothing could ask first.
manager.identityUpdates.updateKeyLimits(walletHandle, id, keyId = 2, addBudget = 500L, signerHandle = signer)

// After:
manager.identityUpdates.refreshIdentity(walletHandle, id)
val now = manager.identityUpdates.previewKeyLimitsUpdate(walletHandle, id, keyId = 2)
// now.signingKeyId == 0, now.currentTotalBudget == 1_000uL, now.newTotalBudget == null
val raise = manager.identityUpdates.previewKeyLimitsUpdate(walletHandle, id, keyId = 2, addBudget = 500uL)
// raise.newTotalBudget == 1_500uL
manager.identityUpdates.updateKeyLimitsAsReviewed(walletHandle, raise)

App before: the key detail screen showed no limits and no action. App after: a Limits section with Total budget, Remaining and Expires, plus an Update Limits button. When Rust says the key cannot be raised, the button is disabled and Rust's reason is shown instead.

Public interface changes

All additive. No shipped signature changes.

Kotlin SDK (org.dashfoundation.dashsdk.identity)

class IdentityKeyLimitsUpdatePreview(
    identityId: ByteArray, val keyId: Int, val signingKeyId: Int,
    val currentTotalBudget: ULong?, val currentExpiresAt: ULong?,
    val newTotalBudget: ULong?, val newExpiresAt: ULong?,
)  // identityId getter returns a copy

class IdentityUpdates {
    // Signed by the owning PlatformWalletManager's signer, borrowed inside its teardown gate.
    suspend fun previewKeyLimitsUpdate(walletHandle: Long, identityId: ByteArray, keyId: Int,
        addBudget: ULong? = null, expiresAt: ULong? = null): IdentityKeyLimitsUpdatePreview
    suspend fun updateKeyLimitsAsReviewed(walletHandle: Long, reviewed: IdentityKeyLimitsUpdatePreview)
    suspend fun refreshIdentity(walletHandle: Long, identityId: ByteArray)
}

Identities.fetchKeysRemainingBudgets(identityId, keyIds): same signature. A negative Int is now read as the u32 key id it stores (before: IllegalArgumentException, and code 1 from JNI).

JNI (internal object IdentityKeyLimitsNative, descriptors pinned by a Rust test against the Kotlin declarations)

external fun previewKeyLimitsUpdate(walletHandle: Long, identityId: ByteArray, keyId: Int,
    hasAddBudget: Boolean, addBudget: Long, hasExpiresAt: Boolean, expiresAt: Long, signerHandle: Long): LongArray
external fun updateKeyLimitsAsReviewed(walletHandle: Long, identityId: ByteArray, keyId: Int, reviewed: LongArray, signerHandle: Long)
external fun refreshIdentity(walletHandle: Long, identityId: ByteArray)

How Has This Been Tested?

  • cargo test -p rs-unified-sdk-jni --lib identity_key_limits: 4 passed. They cover the slot round trip with values past the signed range, zero for a cleared flag, refusal of malformed slots, and the Kotlin declarations matching the exports.
  • After the review fixes (98d7331) the same Rust test, clippy and fmt were run again: clean.
  • cargo clippy -p rs-unified-sdk-jni --all-targets --all-features --locked -- --no-deps -D warnings: clean. cargo fmt --all -- --check: clean.
  • ./gradlew :sdk:testDebugUnitTest --tests '*IdentityKeyLimitsUpdatePreviewTest*': 5 passed.
  • ./gradlew :app:testDebugUnitTest --tests '*KeyLimitsFormattingTest*' --tests '*UpdateKeyLimitsViewModelTest*': 15 + 11 passed (after the review fixes).
    • KeyLimitsFormattingTest ports Swift's KeyLimitsFormattingTests and adds date/time-picker and remaining-budget parsing cases.
    • UpdateKeyLimitsViewModelTest covers: the refresh before the gate, refusals, a preview bound to the exact form contents, the reviewed preview sent once and unchanged, a lock after any failure, coming back locked after process death, coming back finished (not as the applied increment) when saved after success, no date picker for an expiry past its range, and a reloaded wallet being refused.
  • ./gradlew :sdk:compileDebugAndroidTestKotlin: compiles. FfiSmokeTest.identityKeyLimitsSymbolsBindAndRejectInvalidInput is new.
  • python3 scripts/check_sdk_parity_manifest.py --write-summary: OK, 45 capabilities.

Not yet verified

  • Native build and instrumented tests: ./build_android.sh has not been run, so FfiSmokeTest (including the new case) has not been run on a device. This PR changes Rust, so jniLibs copied from another worktree would lack the new symbols.
  • Emulator run of ID-21: not done. The shared emulator is busy with other Kotlin threads, and the app cannot itself register a key with limits (AddIdentityKeyScreen takes none). Running it needs a limited key registered from another client before the identity is loaded on the device.

Left to #6064

Not ported from Swift

  • The Settings -> Platform State Transitions -> Update Key Limits entry (KeyLimitsKeysListView).
  • The "Bound to" contract-bounds row in the Limits section.

Breaking Changes

None. Every change is an addition. No consensus, wallet or C FFI change.

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 · 943b4e8

  • Bots — thepastaclaw ✓
  • 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
    • sdk-parity — you own it
    • kotlin-sdk (packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md, packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/navigation/AppNavHost.kt, packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/navigation/Routes.kt and 18 more) — HashEngineering

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.

Port SwiftExampleApp's Update Limits sheet (Swift test plan ID-17) to
KotlinExampleApp as test plan ID-21.

- rs-unified-sdk-jni: IdentityKeyLimitsNative exports for
  platform_wallet_preview_identity_key_limits_update,
  platform_wallet_update_identity_key_limits_as_reviewed_with_signer and
  platform_wallet_refresh_identity, one C call each. The preview crosses
  as six long slots; Rust tests pin the round trip and the Kotlin
  declarations.
- Kotlin SDK: IdentityUpdates.previewKeyLimitsUpdate,
  updateKeyLimitsAsReviewed and refreshIdentity, and
  IdentityKeyLimitsUpdatePreview with u64 values as ULong.
- KotlinExampleApp: a Limits section on KeyDetailScreen (budget, remaining
  budget, expiry, Update Limits gated by Rust's no-change preview), limits
  and a Limits action on KeysListScreen rows, and UpdateKeyLimitsScreen
  with Swift's keyLimits.update.* identifiers as test tags. Every rule is
  Rust's; Swift's KeyLimitsRetryGate is not copied, so any failed
  submission locks the screen. Form and lock live in SavedStateHandle, so
  a process killed during a submission comes back locked (#6063 covers a
  wallet-wide pending record).
- Parity manifest: new identity.key_limits_update capability.

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

coderabbitai Bot commented Nov 23, 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 21 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 9e1ba58 and 943b4e8.

Files selected for processing: 22

  • docs/sdk/sdk-parity-manifest.json
  • packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/navigation/AppNavHost.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/navigation/Routes.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeyDetailScreen.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeyLimitsSection.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeysListScreen.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/util/KeyLimitsFormatting.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsViewModelTest.kt
  • packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/util/KeyLimitsFormattingTest.kt
  • packages/kotlin-sdk/PARITY_SUMMARY.md
  • packages/kotlin-sdk/sdk/src/androidTest/kotlin/org/dashfoundation/dashsdk/FfiSmokeTest.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/ffi/IdentityKeyLimitsNative.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/identity/IdentityKeyLimitsUpdatePreview.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/identity/IdentityUpdates.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/queries/PlatformQueries.kt
  • packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt
  • packages/kotlin-sdk/sdk/src/test/kotlin/org/dashfoundation/dashsdk/identity/IdentityKeyLimitsUpdatePreviewTest.kt
  • packages/rs-unified-sdk-jni/src/identity_key_limits.rs
  • packages/rs-unified-sdk-jni/src/lib.rs
  • packages/rs-unified-sdk-jni/src/queries.rs
  • 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

@QuantumExplorer QuantumExplorer added this to the v5.1.0 milestone Nov 23, 2026
@QuantumExplorer
QuantumExplorer marked this pull request as ready for review November 23, 2026 12:53
@thepastaclaw

thepastaclaw commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 943b4e8) · triage: normal

@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 the waiting-bots Waiting for the review bots to report on this head label Nov 23, 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 2 only (queue backlog)

Changes requested: 6 blockers

  • Closing an independently owned signer can crash an in-flight key-limit call — packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/identity/IdentityUpdates.kt:342-354 (new)
    Impact: A Kotlin SDK caller using a signer owned outside the wallet manager can lose the wallet process if that owner closes the signer during a preview or submission.
  • Reusing the input buffer during preview can bind a raise to the wrong identity — packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/identity/IdentityUpdates.kt:316-328 (new)
    Impact: A Kotlin SDK caller that reuses an identity ID buffer while previewing can end up raising limits and paying a fee on a different identity the wallet also controls.
  • Android Back can discard the outcome of a key-limit update still being sent — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:466-478 (new)
    Impact: A user who backs out of a slow top-up can miss its success and pay to add the same increment again after reopening the form.
  • A confirmed top-up can restore as an unsent draft — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:375-383 (new)
    Impact: A user whose form is saved after confirmation but before navigation closes it can return to the prefilled increment and approve it a second time.
  • A raise from another client can make Android show more budget remaining than the total — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeysListScreen.kt:83-89 (new)
    Impact: A user opening the key screens with an older Room row can see an impossible balance such as 0.02 DASH remaining out of a total of 0.01 DASH.
  • Opening the date picker can crash for a valid long-lived key — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:589-593 (new)
    Impact: An Android user extending a key whose expiry was set near the end of 2100 or later can crash the app by tapping the date button.

This PR adds proof-backed identity refresh, key-limit previews, and reviewed submission to the Kotlin SDK, and exposes budget and expiry management in KotlinExampleApp. The Rust workspace tests and Kotlin x86_64 emulator checks passed; PR Hygiene is pending, and the funded ID-21 flow was not verified end to end. One lower-priority suggestion was omitted under the comment limit.

🔴 6 blocking | 🟡 4 suggestion(s)

Review provenance

Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 8: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 9: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 10: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The change is substantial across the Android UI, Kotlin SDK, and JNI, but it wraps existing wallet operations without changing signing, key handling, or consensus rules.
  • Phase 1 reviewers: not run (skipped for throughput: 34 PRs queued, above the 10 limit)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — 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/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/identity/IdentityUpdates.kt`:
- [BLOCKING] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/identity/IdentityUpdates.kt:342-354: Closing an independently owned signer can crash an in-flight key-limit call
  Impact: A Kotlin SDK caller using a signer owned outside the wallet manager can lose the wallet process if that owner closes the signer during a preview or submission.
  An in-flight call can borrow freed native memory, even during a preview that signs nothing. Both methods accept a raw signer handle, but `gate.op` only delays teardown of the manager that created the facade. JNI checks the handle only for zero, and the C worker borrows it as a `VTableSigner`. An independent owner's `KeystoreSigner.close()` frees that allocation without waiting for this gate. Borrow the facade's own signer inside its gate, or take a scoped signer reference that keeps the actual owner from closing it until JNI returns.
- [BLOCKING] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/identity/IdentityUpdates.kt:316-328: Reusing the input buffer during preview can bind a raise to the wrong identity
  Impact: A Kotlin SDK caller that reuses an identity ID buffer while previewing can end up raising limits and paying a fee on a different identity the wallet also controls.
  The identity in the returned preview can differ from the one Rust evaluated. JNI copies the requested ID before calling Rust but returns only the six signer and limit slots. After JNI returns, `fromSlots` copies the original caller-owned buffer again. If that buffer now contains a different ID, Rust's submit-time check recomputes the preview for the second identity; matching target key IDs, signing key IDs, and limits let the mismatch pass. Marshal the target from the Rust preview as Swift does, or take one private snapshot before dispatch and use it for both the native call and the returned preview. Test that reusing the caller's buffer after JNI reads it cannot retarget the result.

In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt`:
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:466-478: Android Back can discard the outcome of a key-limit update still being sent
  Impact: A user who backs out of a slow top-up can miss its success and pay to add the same increment again after reopening the form.
  System Back can pop the destination while the native write is still running. The toolbar arrow is disabled, but there is no system Back handler. Popping clears the destination's ViewModel and in-flight state; cancellation does not stop JNI once entered, and `gate.op` can discard the completed result when it switches back to the caller. If the first raise lands before the next proved refresh, typing the same increment again produces a higher absolute total, not a replay that Rust would reject. Guard system Back while submitting, as `UpdateContractScreen` does, and preserve completed native results at the SDK boundary with `opReturningCompletedResult`.
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:375-383: A confirmed top-up can restore as an unsent draft
  Impact: A user whose form is saved after confirmation but before navigation closes it can return to the prefilled increment and approve it a second time.
  The restored form can offer an increment that Platform already applied. Success clears the saved in-flight flag but leaves the amount in `SavedStateHandle`; `finished` exists only in memory, and a separate Compose effect pops the route. A snapshot taken in that gap restores an unlocked form and previews the saved increment against the raised total. The uncertain case also loses information: a saved in-flight flag restores the lock and warning, but `SubmitSection` renders the warning only under `Gate.Ready`, so a failed refresh or an unloaded wallet hides it. Persist a terminal success outcome before navigation, make restored success non-submittable, and show any restored uncertainty warning independently of the refresh gate. Test both restore paths.
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:589-593: Opening the date picker can crash for a valid long-lived key
  Impact: An Android user extending a key whose expiry was set near the end of 2100 or later can crash the app by tapping the date button.
  The picker can throw before the user selects a date. The form seeds it with the current expiry plus 30 days, so even an expiry in late December 2100 can put the initial month in 2101. Material3 1.3.2 requires the initial month and date to be inside its default 1900–2100 range, which Platform does not impose. At the unsigned boundary, the seed calculation can also wrap and `KeyLimitsFormatting.kt:145–159` can show a valid future expiry as a date in the past. Check the timestamp and picker range before initializing the control, display unsupported dates explicitly, and leave budget-only edits available.
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:87-95: A closed wallet snapshot can throw before the Limits screen handles errors
  Impact: If wallet teardown overlaps a key screen's setup, Android can crash instead of showing that the wallet is unavailable.
  A non-null wallet from Compose is not necessarily live. `PlatformWalletManager.removeWallet` closes the wrapper before removing it from the published map, and a collector can still hold the old value. The adapter reads `wallet.handle`, which throws after close. The detail screen invokes the adapter outside its `try`, and the editor invokes it from `rebind` through a `Result.success(...)` expression that does not catch the exception. Resolve the handle in a wallet-bound SDK operation and convert a closed-wallet failure into the screen's unavailable state.

In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeysListScreen.kt`:
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeysListScreen.kt:83-89: A raise from another client can make Android show more budget remaining than the total
  Impact: A user opening the key screens with an older Room row can see an impossible balance such as 0.02 DASH remaining out of a total of 0.01 DASH.
  The remaining amount and total can describe different Platform states. The proved query returns only the remaining amount; the list pairs it with the Room total captured when the request started. The render-time equality check proves only that the local row has not changed. `KeyLimitsSection.kt:78–88` makes the same pairing while its identity refresh runs separately. Until #6064 provides a coherent proved pair, show the live remaining amount and the last-synced total as separately labeled readings. Filtering out only `remaining > total` would still leave plausible-looking mismatches after some of the raised budget is spent.
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeysListScreen.kt:77-94: One high-numbered key hides remaining budgets for every key in the list
  Impact: A user with a budgeted key above `Int.MAX_VALUE` sees no remaining-budget figures in the list, including for keys with smaller IDs.
  A single valid `u32` ID aborts the entire request. Room preserves the ID as an `Int` bit pattern, but both `PlatformQueries.kt:60–69` and `queries.rs:164–176` reject negative `Int` values before querying Platform. The list silently falls back to totals, and the detail screen cannot read that key's remaining budget either. Make the shared query bridge preserve all 32 bits on input and test a request with both a low and a high ID. The new high-ID parser test covers only the response.
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeysListScreen.kt:83-94: The key list drops all remaining budgets when more than 100 keys have budgets
  Impact: Users with 101 or more budgeted keys see only totals in the list even though individual remaining-budget reads can succeed.
  The list sends every budgeted key ID in one request and falls back to totals on error. The server rejects any request above `drive_abci.query.max_returned_elements`, which is 100 in the applicable tables. That is a per-query limit, not a lifetime limit on how many keys an identity can register through updates. Add bounded proof-backed batches in the shared Rust SDK query helper so the app does not need to hard-code the protocol limit.

In `packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md:147: ID-21's manual identity-load path does not import the limited key or its signer
  Impact: A tester who registers a limited key externally and follows ID-02's manual Load Identity flow can end up with no usable Update Limits action.
  The documented setup can leave the tester with a tracked identity but no key rows or signing wallet. `LoadIdentityScreen` saves identity fields and optionally a masternode voting key; it does not link a newly loaded identity to an owning wallet or persist its public keys. Specify that the tester must import the owning wallet on the same network and use Search Wallets for Identities or wallet sync. Before continuing with ID-21, confirm that the limited key is visible and that Rust finds an eligible local signer.
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.

  • Unconfirmed key-limit updates are not tracked across fresh launches — A screen-local lock cannot reconcile an unknown broadcast outcome once the destination or task is gone. That shared wallet gap predates the Android screen and is distinct from losing an active or confirmed submission in this flow.
    • Follow-up: Continue #6063 to record pending updates per identity and key in the Rust wallet and expose proof-backed reconciliation to both hosts.

@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 23, 2026
- The key limits calls borrow the manager's own signer inside its
  teardown gate instead of taking a raw handle, snapshot the identity id
  once, and the reviewed update keeps a completed result if its caller
  was cancelled.
- The screen holds system Back while an update is being sent, records a
  confirmed update before it closes (a restored state closes instead of
  offering the applied increment), and shows a restored lock whatever the
  opening refresh answers.
- The expiry picker is bounded to years 1970..9999; a later expiry is
  shown in milliseconds and only the budget can be changed.
- A closed wallet shows as unavailable instead of throwing.
- The synced total and the remaining budget read from Platform are
  labelled apart (#6064).
- The remaining-budgets bridge carries all 32 bits of a key id.
- TEST_PLAN ID-21 imports the owning wallet instead of Load Identity.

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

github-actions Bot commented Nov 23, 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 23, 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 2 only (queue backlog)

Changes requested: 2 blockers

  • Android Back can discard the outcome of a key-limit update still being sent — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:506-515 (thread, carried)
    Impact: A user who presses Back immediately after submitting a budget raise can miss its confirmation and pay a second fee to apply the same increment again.
  • Opening the date picker can crash for a valid long-lived key — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:646-651 (thread, carried)
    Impact: A user east of UTC can crash the Android app by tapping the date button for an eligible key that expires in late December 9999.

New on this head: This follow-up binds reviewed Android key-limit updates to the wallet manager’s signer and a private copy of the identity ID, and updates the editor’s submission recovery and limit display. The Kotlin SDK build and x86_64 emulator tests passed; Rust workspace tests and some build jobs were still pending, with no failed code checks reported.

🔴 2 blocking | 🟡 2 suggestion(s)

Still open from earlier rounds (2)

  • 🔴 Blocking: Android Back can discard the outcome of a key-limit update still being sent — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:506-515 (thread)
  • 🔴 Blocking: Opening the date picker can crash for a valid long-lived key — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:646-651 (thread)
Review provenance

Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The PR adds a substantial Android workflow and JNI bridge, but delegates key-limit validation, signer selection, and signing to existing Rust APIs rather than changing those mechanisms.
  • Phase 1 reviewers: not run (skipped for throughput: 28 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — 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/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeyLimitsSection.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/KeyLimitsSection.kt:134-145: A raise from another client can make Android show more budget remaining than the total
  Impact: After a raise on another client, a user can see 0.02 DASH remaining beside a total of 0.01 DASH without knowing the total is from an older sync.
  The two figures can still look contradictory even though the UI no longer presents them as a ratio. The detail screen labels the Room value `Total budget` and the proved read `Remaining on Platform`. The list uses `Budget` and `left on Platform` in `KeyLimitsFormatting.kt:139–144`. In both places, checking that the Room total has not changed since the request started does not tie it to the block that proved the remaining amount. Label the total `Last-synced budget` in both views until #6064 can provide a coherent pair.

In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:602-618: A restored expiry draft can block a budget top-up after the expiry control disappears
  Impact: A user restoring a draft after another client raises the key’s expiry beyond the picker range cannot submit a budget-only top-up without reopening the editor.
  The editor says the budget can still be changed, but the user cannot clear the expiry that makes every preview fail. If Android saved a draft with `extendExpiry` enabled, a proved opening refresh can now hide the switch under the new `expiryPickable` guard. The restored flag and timestamp still feed `inputs` at lines 244–255, so Rust refuses the old expiry as not a raise even after the user edits only the budget. Use the same availability check for the control and the preview inputs, tell the user when a restored expiry edit was dropped, and test that restoring against an out-of-range expiry sends a budget-only preview.
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:506-515: Android Back can discard the outcome of a key-limit update still being sent
  (carried; thread: https://github.com/dashpay/platform/pull/6148#discussion_r4669546025)
- [BLOCKING] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:646-651: Opening the date picker can crash for a valid long-lived key
  (carried; thread: https://github.com/dashpay/platform/pull/6148#discussion_r4669546058)
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.

  • A fresh editor does not remember an unconfirmed raise — After an ambiguous submission, the lock belongs to the old screen. If the raise landed, a fresh editor can preview the same typed increment against the higher total. This affects both mobile hosts and needs wallet-owned pending state.
    • Follow-up: Resolve this in #6063 by keeping the pending update per identity and key until a proved refresh settles its outcome.

@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 23, 2026
@github-actions

github-actions Bot commented Nov 23, 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 23, 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 2 only (queue backlog)

New on this head: This revision labels the last-synced key budget separately from the amount remaining on Platform, and drops a restored expiry edit when the Android editor can no longer offer it. The Kotlin SDK emulator build and tests passed on this head; Rust workspace tests, the JS build, and the Dashmate helper image build were still running when checked.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Still open from earlier rounds (1)

  • 🟡 Suggestion: Opening the date picker can crash for a valid long-lived key — packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:665-669 (thread)
Review provenance

Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The change is substantial across the Android UI, Kotlin SDK, and JNI, but it marshals requests to existing Rust wallet APIs without changing signing rules, key management, or consensus.
  • Phase 1 reviewers: not run (skipped for throughput: 21 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — 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/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:665-669: Opening the date picker can crash for a valid long-lived key
  (carried; thread: https://github.com/dashpay/platform/pull/6148#discussion_r4669546058)

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
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 23, 2026
@github-actions

github-actions Bot commented Nov 23, 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.

…ed pick past the device's range

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

github-actions Bot commented Nov 23, 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 23, 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 2 only (queue backlog)

New on this head: This revision uses Gregorian calendars for Android expiry-picker calculations and replaces a restored expiry draft that falls beyond the device’s local picker range before requesting a Rust preview. The Drive and RS-DAPI image builds passed; the Kotlin emulator job, Rust workspace tests, JS build, and Dashmate helper image build were still pending, with no failed code checks reported.

🟡 2 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The PR adds a substantial Android review-and-submit flow and JNI marshalling, but delegates key eligibility, limit validation, and signing to existing Rust wallet functions without changing those rules or implementations.
  • Phase 1 reviewers: not run (skipped for throughput: 13 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — 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/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/util/KeyLimitsFormattingTest.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/test/java/org/dashfoundation/example/util/KeyLimitsFormattingTest.kt:132-135: Expiry cutoff tests fail with a Thai (Thailand) JVM locale
  Impact: Contributors running the app’s JVM unit tests with Thai (Thailand) as the OpenJDK formatting locale get a failing picker-range assertion even though the helper returns a valid date.
  `shouldOpenThePickerOnADayInsideItsYearsInEveryTimeZone` still rejects a valid Gregorian December 31, 9999 under `th-TH`. The new helper and locale regression test fix and verify the production conversion, but the older range assertion decodes the resulting UTC midnight with `Calendar.getInstance(UTC)`. UTC sets the time zone, not the calendar: OpenJDK uses the default formatting locale and reports Buddhist year 10542, which the assertion rejects against `1970..9999`. Use an explicit Gregorian calendar in this assertion too.

In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:317-325: A second restore hides that Android replaced the selected expiry
  Impact: A user who restores a year-end expiry draft after moving to a time zone with an earlier cutoff can later reopen the saved form and see the replacement preview without being told their original choice changed.
  On the second restore, the replacement looks like a date the user picked. The new reset branch calls `setPickedExpiry`, which writes the replacement to `SavedStateHandle` and leaves Extend expiry on, but `restoredExpiryReset` is only held in the ViewModel. If Android saves and recreates the screen again before the user acts, the replacement is already in range, so the warning stays off and `schedulePreview` sends the replacement to Rust. The user still has to submit explicitly; what is lost is the notice that the draft changed. Save the reset notice with the draft until the user picks or acknowledges the replacement, or require a new selection before previewing an expiry change.

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
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 23, 2026
@github-actions

github-actions Bot commented Nov 23, 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 23, 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 2 only (queue backlog)

New on this head: This revision saves the Android expiry-draft notices across restores and makes the picker-range test use a Gregorian calendar regardless of the JVM locale. GitHub reported no failed code checks; the Kotlin emulator build and tests, Rust workspace tests, JS build, and Dashmate helper image build were still pending. The manual ID-21 flow remains unverified.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

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: The restored draft hides the dropped-expiry warning when the picker becomes available again
Impact: A user who restores a combined budget and expiry draft after changing time zones can see a budget-only preview without being told that Android dropped the expiry extension.
packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:647-655

The restored form can offer a budget-only update without explaining what happened to the expiry edit. For example, in UTC, start a draft for a key expiring at 20:00 on December 31, 9999 and choose 22:00 that day. Restoring in UTC+14 puts the key's current expiry on January 1, 10000 locally, so load saves extendExpiry = false and this commit now also saves restoredExpiryDropped = true. On a second restore back in UTC, the picker is available and the saved warning is loaded, but the switch stays off and ChangeSection only renders that warning when !state.expiryPickable. Show the saved notice independently of picker availability until the user acts on the expiry control, and cover the drop-then-restore sequence in a UI regression test. Rust should continue to validate any newly selected expiry.

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

Review provenance

Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The diff is substantial, but IdentityUpdates.updateKeyLimitsAsReviewed and its JNI bridge forward reviewed values and the existing signer to the wallet without changing signing logic, key-management rules, or consensus.
  • Phase 1 reviewers: not run (skipped for throughput: 11 PRs queued, above the 10 limit)
  • New since the last final review (d0140913): 1 suggestion(s) on unchanged code listed as follow-up candidates
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.
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.

  • An unconfirmed raise is not tracked across screen re-entry — The saved lock protects a restored screen, not a newly opened one. If the first raise landed, a fresh preview can apply the same increment to the already raised total; that is a new update, not a replay of the original absolute limits.
    • Follow-up: Track pending updates across screen re-entry and app relaunch in the shared Rust wallet under #6063.

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
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 23, 2026
@github-actions

github-actions Bot commented Nov 23, 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 23, 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 2 only (queue backlog)

New on this head: This revision keeps the dropped-expiry notice visible when the Android date picker becomes available again, without re-enabling the saved edit. The Kotlin emulator build and tests, Rust workspace tests, JavaScript build, and Dashmate helper image build are still pending; no code checks have failed.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The PR adds a substantial Android workflow and JNI bridge for previewing and submitting key-limit updates, but leaves signing, key handling, and consensus rules in the existing Rust wallet implementation.
  • Phase 1 reviewers: not run (skipped for throughput: 12 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — 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/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/identity/UpdateKeyLimitsScreen.kt:656-663: A restored expiry draft can ask the user to check a date the form does not show
  Impact: A user restoring a year-end draft across time zones can be told both to start the expiry edit again and to check a replacement date while Extend expiry is off.
  The new dropped notice can appear alongside the reset notice even though there is no replacement date to check. For a key expiring at 10:00 UTC on December 31, 9999, a draft opened in UTC−08:00 is seeded to the end of that local day, which is January 1 in UTC. Restoring in UTC+14:00 puts the key's current expiry outside the picker range, so `load` saves Extend expiry as off but keeps the picked timestamp. On a later restore in UTC, the current expiry fits but the saved pick does not. `load` reseeds the pick and sets the reset flag without clearing the dropped flag, so both notices render. Show only the dropped notice while the edit is off, and show the reset notice only when the replacement date is visible. Rust can continue to validate the chosen expiry.

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions

github-actions Bot commented Nov 23, 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.

@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

New on this head: The latest commit keeps the dropped-expiry notice visible but asks users to check a replacement date only while Extend expiry is on. The Kotlin emulator job passed, including the app unit tests; Rust workspace tests, the JS build, and the Dashmate helper image build were still pending, with no failed code checks reported.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

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

  • Triage: normal by gpt-6.2-sol (effort low) — The change is substantial and crosses the Android UI, Kotlin SDK, and JNI layers, but it exposes existing Rust wallet operations without changing signing rules, key management, or consensus behavior.
  • 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 below 15% reserve: models 0% left), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — ffi-engineer (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
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 23, 2026
@QuantumExplorer
QuantumExplorer merged commit 551cf07 into v5.1-dev Nov 23, 2026
32 of 33 checks passed
@QuantumExplorer
QuantumExplorer deleted the feat/kotlin-example-key-limits branch November 23, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants