Skip to content

feat(wallet): in-app diagnostic log export for beta feedback - #802

Merged
QuantumExplorer merged 1 commit into
swift-sdk-integrationfrom
feat/log-export
Jul 15, 2026
Merged

QuantumExplorer merged 1 commit into
swift-sdk-integrationfrom
feat/log-export

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

What

dashwallet port of platform #4131 (the SwiftDashSDK example app's in-app log export): make the SDK's Rust-side diagnostics persist on beta devices and give users a one-tap way to hand them to us.

Until now the SDK's tracing output (SDK.enableLogging) went to the console only — a TestFlight user reporting a sync or shielded-spend problem could attach the app's own CocoaLumberjack logs (Report an Issue email) but never the Rust traces where the actual SPV/DashPay/shielded story lives.

Changes

File logging on (SDK side already shipped in #4131 — this just adopts it)
SwiftDashSDKHost.ensureSDKInitialized now calls LoggingPreferences.configure() instead of bare SDK.enableLogging. Each launch writes one timestamped session directory of per-crate run.log files under Library/Logs/SwiftDashSDK/, on simulator and device, at .info. The SDK prunes to 20 sessions / 100 MB at startup; falls back to console logging when the log root isn't writable. Nothing leaves the device until the user exports.

DiagnosticLogExporter (new, both app targets) — stages and zips:

  • the current run's SDK session + up to two before it (15 MB raw cap; after a crash, the crashed run is usually the previous session). The current session is passed in from LoggingPreferences.currentSessionDirectory, never inferred from timestamp order (clock rollbacks / stale future-dated dirs can't displace it);
  • the newest DWLogger CocoaLumberjack files under app-logs/ (10 MB cap) — the dashwallet twist: one archive carries both log streams;
  • a summary.txt with app version, OS, hardware, network, and per-session roles.

Zip is dependency-free (NSFileCoordinator .forUploading). Selection policies are pure static functions; the SDK-session policy is byte-for-byte the example app's test-covered one.

UI

  • Tools → Export Logs: stages off the main actor, then presents a share sheet with the zip (AirDrop / Mail / Files); failure shows an alert. Mirrors the existing CSV-export presentation pattern.
  • Report an Issue (support email): now also attaches a DashWallet-logs-<stamp>.zip of the SDK sessions alongside the existing loose app-log attachments, counted against the same 25 MB budget. When no sessions exist yet (first launch after this update) the zip is silently omitted and the email behaves exactly as before. The no-Mail fallback share sheet includes the zip too.

Tests: compile-ready DiagnosticLogExporterTests mirror the upstream selection invariants (current-session authority, count cap, stop-at-first-over-budget, no-current fallback) plus the app-log newest-first/byte-cap policy. (Test bundle remains pre-existing broken.)

Verification

  • dashpay Debug arm64-sim build green; plutil -lint clean (pbxproj + en strings; string additions purely additive).
  • Registered in both app targets (its consumers — host, Tools menu, support email — are in both).

QA smoke (needs a driver)

  1. Launch → relaunch (two sessions exist) → Tools → Export Logs → share sheet appears; save to Files and confirm the zip contains two session dirs + app-logs/ + summary.txt.
  2. Report an Issue → mail composer shows the SDK zip attachment alongside the usual .log files.
  3. First-launch case: wipe app, install, immediately Report an Issue → email composes without the zip (no error).

🤖 Generated with Claude Code

Port of the SwiftDashSDK example app's log-export flow
(platform #4131) to dashwallet.

- SwiftDashSDKHost now installs SDK logging via
  LoggingPreferences.configure(): file logging at .info on simulator
  AND device — one timestamped session directory of per-crate run.log
  files per launch under Library/Logs/SwiftDashSDK/, pruned by the SDK
  to 20 sessions / 100 MB. Previously the Rust traces were
  console-only, so beta reports could never include them. Nothing
  leaves the device until the user exports.
- DiagnosticLogExporter bundles the current run's SDK session plus up
  to two before it (15 MB raw cap; after a crash the crashed run is
  usually the previous session) AND the newest DWLogger CocoaLumberjack
  files under app-logs/ (10 MB cap), with a summary.txt of
  build/device/network context, zipped dependency-free via
  NSFileCoordinator .forUploading. Session selection is the pure,
  test-covered policy from the example app; the app-log staging and
  two-stream summary are the dashwallet additions.
- Tools menu gains an "Export Logs" row (share sheet on success, alert
  on failure); the Report an Issue support email now also attaches an
  SDK-sessions zip alongside the existing loose app-log attachments
  (skipped silently when no sessions exist yet).
- Compile-ready DiagnosticLogExporterTests mirror the upstream
  selection invariants plus the app-log cap policy (test bundle is
  pre-existing broken).

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

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: adb80898-a941-4aa8-bbb0-e1b2d257080a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/log-export

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.

@QuantumExplorer
QuantumExplorer merged commit eaef839 into swift-sdk-integration Jul 15, 2026
1 check passed
QuantumExplorer added a commit that referenced this pull request Jul 16, 2026
… merge-dropped l10n (#808)

* fix(l10n): restore en source strings dropped by the release-8.7.0 merge

The merge commit 1ca07eb resolved DashWallet/en.lproj/Localizable.strings
mostly to master's side, silently dropping 203 integration-branch entries.
English UI kept rendering via the NSLocalizedString key fallback, but the
Transifex source lost the strings.

This restores the 34 dropped entries that are still referenced by an exact
NSLocalizedString key in the current tree (shielded-DashPay Usernames
strings from #801, Log export strings from #802, and DashPay registration
strings), inserted in the file's case-insensitive key order with their
original comment blocks. The file stays UTF-8.

Deliberately not restored:
- 160 dropped keys with no remaining NSLocalizedString reference (their
  call sites no longer exist on this branch)
- the SPV-diagnostics entries from #804: fix/birth-height-chain-resync
  restores/rewords that screen's strings, and re-adding the old wordings
  here would only orphan them when that PR lands

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(l10n): restore DashPay contacts/invitations source strings

Restores the 37 contacts- and invitations-flow entries that the
release-8.7.0 merge (1ca07eb) dropped from the en source file. Their
call sites were deleted when the contacts subsystem was rebuilt on
SwiftDashSDK (#787), but the flows are about to be redone now that
invitations live in the Dash SDK — keeping the entries preserves the
Transifex source (and existing translations) for that rework.

Selection rule: dropped keys whose last call site lived under
DashWallet/Sources/UI/DashPay/{Contacts,Notifications,Items,Profile}
or in a DWDP* contact view, as of the tree before the #787 rebuild.
Inserted in the file's case-insensitive key order with their original
comment blocks; file stays UTF-8.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(invitations): rebuild the DashPay invitation claim on SwiftDashSDK

Resolves teardown item T1's accept arm as PORT (INVITATIONS_REBUILD_PLAN.md
is the full plan; the create/history/reclaim side follows). Invitations are
DIP-13 vouchers, cross-platform-compatible with Android's shipping
implementation (dashpay://invite?du/assetlocktx/pk/islock).

Distribution is paste/scan-first with no third-party services: the invitee
installs the app, then redeems by QR scan or paste ("Have an invitation?"
in the Join DashPay dialog), or via a dashpay:// / applink deep link when
the app is already installed. No AppsFlyer, no hosted link infrastructure.

New:
- DWInvitationLinkNormalizer — canonicalizes dashpay://invite, legacy
  invitations.dashpay.io/applink, and Android OneLink long-URLs (af_dp
  unwrap; keys tried in Android's order) down to the URI the SDK parser
  accepts. Obj-C-visible for the AppDelegate routing gate.
- DWInvitationService — protocol-seamed facade: normalize, parse/preview,
  local-identity gate, post-claim contact request to the du inviter (DPNS
  resolve + SwiftDashSDKContactsService, which owns the PIN gate and the
  lazy DashPay-key upgrade).
- ClaimInvitationScreen (+ ClaimInvitationFlow push glue) — paste field,
  QR scan sheet (GenericQRScannerView), inviter preview, inline invalid /
  already-registered states.
- DWIdentityRegistrationCoordinator.startClaimInvitation — fourth funding
  path (.invitation): same PIN gate, key pre-persist, DPNS register, phase
  reporting and identity-resume semantics; the claim consumes the INVITER's
  asset lock via wallet.claimInvitation (no local PersistentAssetLock).
- CreateUsernameView(Model) invitation mode: voucher funds the registration,
  so the balance cost rule and funding-source picker don't apply; success
  offers the inviter contact request; failures surface the SDK's typed
  claim errors.

Rewired / deleted:
- AppDelegate: dead FIRDynamicLinks handling removed (service shut down in
  2025 — it silently swallowed universal links); invitation URLs route
  directly. dashpay:// added to CFBundleURLSchemes.
- DashSync accept arm deleted: DWDashPayModel verifyDeeplink /
  createUsername:invitation: invitation branch / inviter friend-request via
  DSIdentitiesManager / invitationSteps; DWHomeModel deeplink passthrough;
  protocol surface narrowed to createUsername:.
- DashUIKit package retargeted import/final → master @ 046f0875 (matches
  release-8.7.0; the stale pin's tip no longer resolves).

Verified: clean dashpay arm64-sim builds under Xcode 26.3/Swift 6.2.4 and
Xcode 26.6/Swift 6.3.3; fresh-wallet simulator smoke of the full invitee
flow — menu entry → paste → parse/preview ("Invitation from …") → username
form (zero balance, live DPNS availability) → PIN gate → SDK claim against
testnet DAPI → typed funding-tx-not-found failure surfaced. Companion
platform change (invitation cap 0.05 → 0.25 DASH for Android's contested
tier) rides separately in dashpay/platform.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs(dashpay): record the translation-reuse audit in the invitations plan

All 42 lproj files carry translations for the legacy claim-flow strings
(already-claimed / invalid-invitation / invited-by-share copy) — the
claim error mapping and the create-side share sheet must reuse those keys
instead of minting new copy. The 37 restored contacts/invitations keys
turn out to be English source only (no repo translations survive).

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
@QuantumExplorer
QuantumExplorer deleted the feat/log-export branch August 7, 2026 08:23
aliblik pushed a commit to aliblik/dashwallet-ios that referenced this pull request Nov 28, 2026
Brings the 4 new swift-sdk-integration commits (dashpay#799, dashpay#801, dashpay#802, dashpay#804:
shielded-spend resolver adaptation, Join DashPay from Shielded, in-app
diagnostic log export, imported-wallet genesis scan) onto the branch.

- 2 conflicts (project.pbxproj, en.lproj/Localizable.strings); the rest
  auto-merged. en.strings kept ours (release-8.7.0 strings); the 4 features'
  new keys are re-extracted by bartycrouch on build.
- Added the 3 new source files to targets: DiagnosticLogExporter (both),
  JoinDashPayReadinessScreen + ShieldedIdentityFundingReadiness (dashpay).
- Requires platform pinned at v4.1-dev tip dc1d645df4 (#4131 adds
  LoggingPreferences.logsRootDirectory); local ../platform bumped and the
  DashSDKFFI sim xcframework rebuilt.

Builds clean via the dashwallet-dashpay scheme (ARCHS=arm64).
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.

1 participant