π (device-management-kit) [DSDK-1153]: Fix out of memory prediction#1503
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
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
bytesfromblockSizeand 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.
6f609e7 to
d26b6c4
Compare
|



π Description
PredictOutOfMemoryTask does not reliably detect when the device is full.
Description in ticket: https://ledgerhq.atlassian.net/browse/DSDK-1153
β Context
β Checklist
Pull Requests must pass CI checks and undergo code review. Set the PR as Draft if it is not yet ready for review.
π§ Checklist for the PR Reviewers