Skip to content

fix(swift-example-app): gate identity resumes by funding type#4015

Open
thepastaclaw wants to merge 2 commits into
dashpay:v4.1-devfrom
thepastaclaw:tracker-1809-identity-lock-filter
Open

fix(swift-example-app): gate identity resumes by funding type#4015
thepastaclaw wants to merge 2 commits into
dashpay:v4.1-devfrom
thepastaclaw:tracker-1809-identity-lock-filter

Conversation

@thepastaclaw

@thepastaclaw thepastaclaw commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #4010. That PR was merged before the automated review landed; the review found that the Resumable Registrations list could expose address-funding asset locks to the identity registration resume path.

What changed

  • Add fundingTypeRaw to the resumable-lock filter contract.
  • Reject non-identity funding types before a lock can reach CreateIdentityView(preselectedAssetLock:).
  • Keep identity funding types 0...3 resumable and add focused regression coverage for 4/5 and unknown discriminators.
  • Refresh stale Broadcast/Consumed docs now that every resumable row renders Resume.

Validation

  • swiftc -parse packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/IdentitiesContentView.swift packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/CreateIdentityResumableTests.swift
  • git diff --check upstream/v4.1-dev..HEAD
  • git show --check --stat HEAD

Created from tracker issue thepastaclaw/tracker#1809.

Summary by CodeRabbit

  • New Features

    • Resumable registration entries now consistently show a Resume action for eligible locks, including Broadcast-status locks.
    • Resume now re-enters the finality-wait stage when applicable.
  • Bug Fixes

    • Improved filtering to show only supported funding types and valid statuses.
    • Invalid, invitation, address-specific, and consumed entries are now handled safely without presenting unusable resume flows.
  • Documentation

    • Clarified funding-type meanings and resumable registration eligibility in the Swift example app.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d0f4376-6520-4a63-a15b-f0daaf57ea26

📥 Commits

Reviewing files that changed from the base of the PR and between a843592 and 9894f56.

📒 Files selected for processing (3)
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/IdentitiesContentView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift
  • packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/CreateIdentityResumableTests.swift

📝 Walkthrough

Walkthrough

The Swift example app now limits generic resumable registrations to funding types 0...2 and statuses 1...3, documents Resume behavior for Broadcast and Consumed locks, and adds table-driven coverage for accepted and rejected funding discriminators.

Changes

Resumable registration gates

Layer / File(s) Summary
Funding and status gating
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/CreateIdentityView.swift, packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/IdentitiesContentView.swift
Documentation and crossWalletResumableLocks selection now define generic identity resume funding types as 0...2, accepted statuses as 1...3, and fail-closed handling for other discriminators.
Funding-type coverage tests
packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/CreateIdentityResumableTests.swift
Tests now use a table-driven whitelist covering generic types, invitation and address variants, negative values, unknown values, Broadcast, and Consumed behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: llbartekll, shumkov, zocolini

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: gating identity resume behavior by funding type.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

thepastaclaw and others added 2 commits July 15, 2026 01:25
…ing types

The Identities-tab Resumable Registrations surface filtered
`PersistentAssetLock` rows on `statusRaw` and the per-slot
anti-join alone. Every asset lock on the active network was in
scope — including `fundingTypeRaw == 4` (AssetLockAddressTopUp)
and `5` (AssetLockShieldedAddressTopUp), whose scripts commit to
an address-flow recipient. Tapping Resume on one of those rows
routed the lock into `CreateIdentityView(preselectedAssetLock:)`
and would fire an IdentityCreate the user never intended.

Add `fundingTypeRaw` to `AssetLockResumeRow` and require
`0...2` (IdentityRegistration / IdentityTopUp /
IdentityTopUpNotBound) in `crossWalletResumableLocks` before the
status and anti-join gates. Invitation vouchers (3) remain
reserved for the explicit reclaim flow, while address-flow locks
(4 and 5) stay on their proper surfaces.

Also refresh stale docs/comments that still described Broadcast
rows as spinner-only and Consumed as perpetual-spinner — PR dashpay#4010
made every resumable row a Resume button.

Regression coverage in `CreateIdentityResumableTests` accepts
funding types 0...2 and rejects invitation, address, shielded-
address, negative, and unknown discriminators fail-closed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…able filter

The `allAssetLocks` @query comment predates the current
`crossWalletResumableLocks` shape and still described the filter
as "status >= InstantSendLocked". The floor is actually `>= 1`
(Broadcast), and the filter now admits only generic identity-
resume funding types 0...2 and excludes in-flight controller
slots. Bring the docstring in line so future readers don't work
off the old contract.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thepastaclaw
thepastaclaw force-pushed the tracker-1809-identity-lock-filter branch from a81cae4 to 9894f56 Compare July 15, 2026 06:25
@thepastaclaw

thepastaclaw commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

✅ Final review complete — no blockers (commit 9894f56)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Final validation — Codex + Sonnet

This PR is a documentation-only follow-up syncing the allAssetLocks @query docstring with the fail-closed fundingTypeRaw in 0...2 whitelist introduced in the immediately preceding commit (638826f). I verified the parent fix directly: it correctly replaces the prior blacklist (fundingTypeRaw != 3) with an explicit whitelist, closing the gap where address (4) and shielded-address (5) top-up locks could reach CreateIdentityView(preselectedAssetLock:), and traced the sole call site confirming no bypass exists. Both Claude and Codex (general + security-auditor) independently found zero in-scope issues; the PR is clean and well-tested.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed), gpt-5.6-sol — security-auditor (completed)
  • Verifier: claude-sonnet-5 — final-verifier
  • Sonnet reviewers: claude-sonnet-5 — general (completed), claude-sonnet-5 — security-auditor (completed)

Note: GitHub does not allow PastaClaw to submit an approval or request changes on their own PR, so the canonical verifier result is transported as a COMMENT review.

@QuantumExplorer
QuantumExplorer marked this pull request as ready for review July 23, 2026 15:55

@QuantumExplorer QuantumExplorer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed and verified independently:

  • Gap is real: base only blacklisted IdentityInvitation (3). Address (4) / shielded (5) top-up locks persist through the same Broadcast→IS/CL lifecycle with pool-index identityIndexRaw, so an interrupted address-funding flow surfaced as a resumable registration whenever the matching identity slot was free. The Rust resolver (resolve_funding_with_is_timeout_fallback) only refuses type 3 — a resumed type-4/5 lock would be consumed into IdentityCreate, misdirecting the funds.
  • Whitelist is the sole gate: .unusedAssetLock funding is only enterable via CreateIdentityView(preselectedAssetLock:), whose single call site is the resumable-rows sheet; no in-view lock picker bypass.
  • Discriminators in the docstrings match the Rust serde mapping (0–5) exactly; executed the filter logic standalone against all new test cases plus the status-floor / per-wallet anti-join / UInt32(bitPattern:) invariants — all pass.
  • The earlier Swift SDK CI failure was the known runner keychain flake (keychainError(-61) in IdentityResolverSignIntegrationTests, untouched by this PR); green on rerun.

Follow-up (separate PR): mirror this gate in the Rust resolver for types 4/5 as defense-in-depth, like the existing invitation-voucher refusal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants