Skip to content

πŸ› (device-management-kit) [DSDK-1153]: Fix out of memory prediction#1503

Merged
paoun-ledger merged 1 commit into
developfrom
fix/DSDK-1153-out-of-memory
May 22, 2026
Merged

πŸ› (device-management-kit) [DSDK-1153]: Fix out of memory prediction#1503
paoun-ledger merged 1 commit into
developfrom
fix/DSDK-1153-out-of-memory

Conversation

@paoun-ledger

Copy link
Copy Markdown
Contributor

πŸ“ Description

PredictOutOfMemoryTask does not reliably detect when the device is full.
Description in ticket: https://ledgerhq.atlassian.net/browse/DSDK-1153

❓ Context

  • JIRA or GitHub link:
  • Feature:

βœ… Checklist

Pull Requests must pass CI checks and undergo code review. Set the PR as Draft if it is not yet ready for review.

  • Covered by automatic tests
  • Changeset is provided
  • Documentation is up-to-date
  • Impact of the changes:
    • list of the changes

🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.

Copilot AI review requested due to automatic review settings May 22, 2026 09:13
@paoun-ledger paoun-ledger requested a review from a team as a code owner May 22, 2026 09:13
@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
device-sdk-ts-sample Ready Ready Preview, Comment May 22, 2026 11:46am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
doc-device-management-kit Ignored Ignored May 22, 2026 11:46am

Request Review

@github-actions

github-actions Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

Danger Check Results

Messages

βœ…

Danger: All checks passed successfully! πŸŽ‰

Generated by 🚫 dangerJS against d26b6c4

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.

Pull request overview

This PR targets more reliable β€œout of memory” prediction in @ledgerhq/device-management-kit, by aligning per-device memory block sizing and tightening the threshold used by PredictOutOfMemoryTask when deciding whether an install plan will overflow available device memory.

Changes:

  • Update static device-model definitions to use a 512-byte block size for NANO_S_PLUS (NANO_SP), STAX, FLEX, and APEX.
  • Adjust PredictOutOfMemoryTask’s out-of-memory threshold logic and update its unit tests to cover β€œno remaining block” / boundary scenarios.
  • Add a changeset to publish the fix as a patch.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/device-management-kit/src/api/device-model/data/StaticDeviceModelDataSource.ts Change block size for several device models from 32 to 512 to match expected memory accounting.
packages/device-management-kit/src/api/device-model/data/StaticDeviceModelDataSource.test.ts Update block-size expectations for the affected device models.
packages/device-management-kit/src/api/device-action/task/PredictOutOfMemoryTask.ts Tighten the out-of-memory condition used for install plan prediction.
packages/device-management-kit/src/api/device-action/task/PredictOutOfMemoryTask.test.ts Update boundary-condition tests for the new out-of-memory behavior.
.changeset/pink-jokes-wonder.md Publish a patch changeset for the out-of-memory prediction fix.
Comments suppressed due to low confidence (1)

packages/device-management-kit/src/api/device-action/task/PredictOutOfMemoryTask.test.ts:81

  • This test case relies on a very specific boundary (the install plan leaving exactly 1 memory block free) but the setup encodes it via magic byte counts rather than expressing it in terms of blocks. Refactoring the setup to derive bytes from blockSize and the targeted remaining-block count would make the test clearer and less fragile.

    // WHEN
    const result = new PredictOutOfMemoryTask(apiMock, {
      installPlan: [
        { bytes: 1324 },
        { bytes: 6497 },
      ] as unknown as Application[],
    }).run();

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@paoun-ledger paoun-ledger force-pushed the fix/DSDK-1153-out-of-memory branch from 6f609e7 to d26b6c4 Compare May 22, 2026 11:42
@sonarqubecloud

Copy link
Copy Markdown

@paoun-ledger paoun-ledger added this pull request to the merge queue May 22, 2026
Merged via the queue into develop with commit 93a5bf4 May 22, 2026
25 checks passed
@paoun-ledger paoun-ledger deleted the fix/DSDK-1153-out-of-memory branch May 22, 2026 15:54
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.

3 participants