[QM] Fixed overflow runtime error#8924
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an overflow runtime error in Quality Management when calculating Sample Size from Percent of Quantity for very large Source Quantity (Base) values, and adds a regression test to ensure the value is clamped rather than crashing.
Changes:
- Clamp the percent-based sample size calculation to the maximum
Integervalue before validating into the"Sample Size"field. - Add a test that reproduces the overflow scenario using a source quantity greater than
Integermax. - Add a test-library helper to create an inspection + template configured for percent-based sampling and return the resulting sample size.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Apps/W1/Quality Management/test/src/QltyTestsMisc.Codeunit.al | Adds a regression test verifying sample size clamping for very large source quantities. |
| src/Apps/W1/Quality Management/Test Library/src/QltyInspectionUtility.Codeunit.al | Adds a test helper to set up percent-of-quantity sampling and return the computed sample size. |
| src/Apps/W1/Quality Management/app/src/Document/QltyInspectionHeader.Table.al | Prevents overflow by clamping the percent-based calculated sample size before validating into an Integer field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot PR ReviewIteration 1 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630 Orchestrator pre-filter (13 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
Fixes AB#620337
Also test added