Skip to content

[LWDM] feat(device-intent): send secure channel error types (LIVE-42639) - #25752

Open
OlivierFreyssinet wants to merge 3 commits into
developfrom
feat/device-intent-LIVE-42639-secure-channel-types
Open

OlivierFreyssinet wants to merge 3 commits into
developfrom
feat/device-intent-LIVE-42639-secure-channel-types

Conversation

@OlivierFreyssinet

@OlivierFreyssinet OlivierFreyssinet commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

📝 Description

Problem: #25748 (subError cause) sends subErrorCause for SecureChannelError. With DMK 1.13.0, a WebSocket error, an ERROR message from the HSM, an unexpected close and invalid server data carry only free text, so they all send the same value: ServerOrNetwork. We cannot tell a network failure from a server error, and SecureChannelError is the most common device flow failure (1,177 events from 848 users on LWM 4.29.0, 19–30 Nov 2026).

Solution: DMK now gives each cause its own string errorType, in the exported SecureChannelErrorType enum (LedgerHQ/device-sdk-ts#2262). subErrorCause reads it:

Cause subErrorCause
The exchange with the device failed (BLE drop, busy transport…) the wrapped DMK error, as before: DeviceDisconnectedWhileSendingError, AlreadySendingApduError…
WebSocket error, usually a network failure WebSocketError
The WebSocket closed before the end of the exchange WebSocketClosed
The HSM sent an ERROR message ServerError
The server sent an invalid message, or invalid APDU or bulk data InvalidServerMessage, InvalidServerData
The WebSocket could not be created InvalidConnection
The device returned a status word with no specific type UnknownStatusWord
A cause DMK does not type Unknown

ServerOrNetwork is gone. If this PR and #25748 ship in the same release, that value never reaches production. The cause still comes from typed fields only (the DMK _tag, the nested error's _tag and errorType, checked against the enum), never from a message or a URL.

DMK errors are now matched by _tag and fields, not instanceof, for every cause: SecureChannelError, UnknownDeviceExchangeError, and exchange errors (identified by their errorCode, since each subclass sets its own _tag). instanceof fails when the app loads a second DMK copy, for example the ESM and the CJS builds of the same version, and the cause would then disappear from the event.

{
  "failureType": "ConnectAppError",
  "subError": "SecureChannelError",
  "subErrorCause": "ServerError",
  "modelId": "nanoX",
  "transport": "ble"
}

DMK: develop already pins @ledgerhq/device-management-kit 1.14.0 (#25761), the release of LedgerHQ/device-sdk-ts#2262, so this PR does not change dependencies.

🔗 Context

Copilot AI balanced review requested due to automatic review settings November 30, 2026 15:15
@live-github-bot live-github-bot Bot added the shared-lib Label added for automated tagging of PRs label Nov 30, 2026
@live-github-bot live-github-bot Bot changed the title feat(device-intent): send secure channel error types (LIVE-42639) [LWDM] feat(device-intent): send secure channel error types (LIVE-42639) Nov 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Both wallet apps rely on an unreleased DMK snapshot, requiring maintainer confirmation of its released replacement and validation of device-flow compatibility before merge.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

This PR refines device-flow failure analytics for Ledger Wallet, building on #25748 to distinguish secure-channel network and server failures while preserving wrapped device-error causes.

Changes:

  • Replaces ServerOrNetwork with DMK’s typed secure-channel causes and updates regression tests.
  • Aligns workspace dependencies on the DMK snapshot and explicitly declares DMK for desktop end-to-end tests.
  • Adds release notes for the shared library and both apps.

The PR description identifies the DMK snapshot as temporary and requires a released version before merging.

File Description
pnpm-workspace.yaml Pins DMK to the snapshot providing secure-channel error types.
pnpm-lock.yaml Updates DMK resolutions and dependent peer references.
libs/​live-dmk-shared/​src/​deviceIntentTracking/​deviceFlowFailure.ts Reports typed secure-channel causes while preserving wrapped error tags.
libs/​live-dmk-shared/​src/​deviceIntentTracking/​deviceFlowFailure.test.ts Tests typed causes, the unknown fallback, and analytics properties.
e2e/​desktop/​package.json Declares DMK to align the mockserver client’s peer dependency.
.changeset/​brave-sockets-split.md Records minor releases for the shared library and both apps.

Review effort: Balanced

Base automatically changed from feat/device-intent-LIVE-40294-subError-cause to develop November 30, 2026 16:15
# Conflicts:
#	libs/live-dmk-shared/src/deviceIntentTracking/deviceFlowFailure.test.ts
#	libs/live-dmk-shared/src/deviceIntentTracking/deviceFlowFailure.ts
@OlivierFreyssinet
OlivierFreyssinet force-pushed the feat/device-intent-LIVE-42639-secure-channel-types branch from d67151f to d76d8e2 Compare November 30, 2026 16:49
Copilot AI balanced review requested due to automatic review settings November 30, 2026 16:49
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Architecture score: 100%

+0 lines in the new layers (shared/, domain/, features/) against a net growth of +0 in legacy areas (libs/, app feature folders). Counts production .ts/.tsx lines.

Kind Area Added Deleted
🗂️ allowlisted libs/live-dmk-shared/ (LIVE-40918) +24 −11

Generated by 🚫 dangerJS against 8bada89

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the secure-channel failure analytics update.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

@OlivierFreyssinet
OlivierFreyssinet marked this pull request as ready for review November 30, 2026 16:52
@OlivierFreyssinet
OlivierFreyssinet requested a review from a team as a code owner November 30, 2026 16:52
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Web Tools Build Status

Build Status Deployment
Web Tools Build ✅ Deployed https://web-tools-n7c3lc3du-ledger-hq-prd.vercel.app

@github-actions

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 7 projects in monorepo, 3 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
desktop-main 3.9 MB 1.2 MB +263.0 B (0.0%) +40.0 B (0.0%)
desktop-preloader 8.8 KB 2.8 KB 0 0
desktop-webviewDappPreloader 36.3 KB 9.7 KB 0 0
desktop-webviewPreloader 219.0 B 183.0 B 0 0
desktop-renderer 83.7 MB 16.5 MB +727.0 B (0.0%) +108.0 B (0.0%)
desktop-workers 41.6 KB 15.7 KB 0 0
mobile 140.2 MB 21.4 MB +2.5 KB (0.0%) +245.0 B (0.0%)
📋 Detailed Reports (Click to expand)

📁 desktop-main

Path: rsdoctor/desktop-main/rsdoctor-data.json

📌 Baseline Commit: dac35e1177a77be250ec6fc2e04fc2734835b580 | PR: #25756

Metric Current Baseline Change
📊 Total Size 3.9 MB 3.9 MB +263.0 B (0.0%)
🗜️ Gzip Size 1.2 MB 1.2 MB +40.0 B (0.0%)
📄 JavaScript 3.7 MB 3.7 MB +263.0 B (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 135.3 KB 135.3 KB 0

📦 Download Diff Report: desktop-main Bundle Diff

📁 desktop-renderer

Path: rsdoctor/desktop-renderer/rsdoctor-data.json

📌 Baseline Commit: dac35e1177a77be250ec6fc2e04fc2734835b580 | PR: #25756

Metric Current Baseline Change
📊 Total Size 83.7 MB 83.7 MB +727.0 B (0.0%)
🗜️ Gzip Size 16.5 MB 16.5 MB +108.0 B (0.0%)
📄 JavaScript 41.2 MB 41.2 MB +727.0 B (0.0%)
🎨 CSS 302.0 KB 302.0 KB 0
🌐 HTML 1.8 KB 1.8 KB 0
📁 Other Assets 42.2 MB 42.2 MB 0

📦 Download Diff Report: desktop-renderer Bundle Diff

📁 mobile

Path: rsdoctor/mobile/rsdoctor-data.json

📌 Baseline Commit: dac35e1177a77be250ec6fc2e04fc2734835b580 | PR: #25756

Metric Current Baseline Change
📊 Total Size 140.2 MB 140.2 MB +2.5 KB (0.0%)
🗜️ Gzip Size 21.4 MB 21.4 MB +245.0 B (0.0%)
📄 JavaScript 123.3 MB 123.3 MB +2.5 KB (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 16.9 MB 16.9 MB 0

📦 Download Diff Report: mobile Bundle Diff

Generated by Rsdoctor GitHub Action

Copilot AI balanced review requested due to automatic review settings November 30, 2026 16:58
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ E2E tests are required

Changes detected require e2e testing before merge (even before asking for any review).

🖥️ Desktop

-> Run Desktop E2E

  • Select "Run workflow"
  • Branch: feat/device-intent-LIVE-42639-secure-channel-types
  • Device: nanoSP or stax
  • Filter by team: pick your team in the team dropdown to run only its specs

📱 Mobile

-> Run Mobile E2E

  • Select "Run workflow"
  • Branch: feat/device-intent-LIVE-42639-secure-channel-types
  • Device: nanoX
  • Filter by team: pick your team in the team dropdown to run only its specs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the device-flow failure analytics update.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

This branch has not been deployed

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

Labels

shared-lib Label added for automated tagging of PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants