Skip to content

[Main] Item tracking validation when lot numbers are assigned concerns the warehouse pick level rather than at the sales order levelInitial Commit - #9982

Open
Shikhverma wants to merge 12 commits into
mainfrom
bugs/Bug-638344-Master-ItemTrackingValidationWhenLotNumbersAreAssigned
Open

[Main] Item tracking validation when lot numbers are assigned concerns the warehouse pick level rather than at the sales order levelInitial Commit#9982
Shikhverma wants to merge 12 commits into
mainfrom
bugs/Bug-638344-Master-ItemTrackingValidationWhenLotNumbersAreAssigned

Conversation

@Shikhverma

@Shikhverma Shikhverma commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Bug 646429: [master] [REPAIR] [ALL-E] Item tracking validation when lot numbers are assigned concerns the warehouse pick level rather than at the sales order level

Fixes AB#646429

@github-actions github-actions Bot added the SCM GitHub request for SCM area label Aug 5, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 5, 2026
Co-authored-by: Shikhverma <241284522+Shikhverma@users.noreply.github.com>
@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Aug 6, 2026
@Shikhverma Shikhverma removed the needs-approval Workflow runs require maintainer approval to start label Aug 6, 2026
@Shikhverma Shikhverma closed this Aug 7, 2026
@Shikhverma Shikhverma reopened this Aug 7, 2026
@Shikhverma

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

…r-ItemTrackingValidationWhenLotNumbersAreAssigned

Co-authored-by: Shikhverma <241284522+Shikhverma@users.noreply.github.com>

Copilot AI commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved by merging main into this branch (534f0c7). The merge completed cleanly with no manual conflict resolution needed — git's rename detection handled the upstream reorganization of the SCM test directories, and both files added in this PR are preserved with unchanged content in their new SCM-Reservation locations.

@Shikhverma Shikhverma closed this Aug 9, 2026
@Shikhverma Shikhverma reopened this Aug 9, 2026
@Shikhverma
Shikhverma marked this pull request as ready for review August 9, 2026 07:07
@Shikhverma
Shikhverma requested a review from a team August 9, 2026 07:07
Comment thread src/Layers/W1/BaseApp/Inventory/Tracking/ItemTrackingDataCollection.Codeunit.al Outdated
…gisteredWhsePickAllocation test

Co-authored-by: Shikhverma <241284522+Shikhverma@users.noreply.github.com>
Comment thread src/Layers/W1/BaseApp/Inventory/Tracking/ItemTrackingDataCollection.Codeunit.al Outdated
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 4

Recommendation: Accept

What this PR does

This PR fixes a bug where available lot quantity did not account for quantities already committed to unregistered warehouse picks. The commit since round 3 removes the unused MessageHandler from the RU test's HandlerFunctions attribute, so the RU copy now matches the W1 test and the handler-consumption issue from round 3 is resolved.

Status of previous suggestions
ID Title Status Author response
S1 RU test still declares unused MessageHandler Addressed MessageHandler was removed from the RU test handler list in commit 177243c.
New observations (commits since round 3)

None - the new commit only addresses the round-3 suggestion.

Risk assessment and necessity

Risk: The latest commit changes only a test attribute and has no runtime impact. The PR's runtime change still affects item tracking availability for lot/serial/package lookup and warehouse pick allocations, so the important regression surface is inventory availability and double allocation of tracked lots; the added W1 and RU tests cover the reported path.

Necessity: The change is still justified by the bug scenario: a lot fully allocated to an unregistered pick should not appear available to another demand source. The scope remains targeted to the lookup data used by GetAvailableLotQty and to regression coverage for that path.


[AI-PR-REVIEW] version=1 promptVersion=2 system=github pr=9982 round=4 by=alexei-dobriansky at=2026-08-12T08:09:19.3585437Z lastSha=177243cdb83011b3d38e5a8dda87916c79a83b18 reviewKey=73633e5bc4f6d3160a478313decff299774ec029d5a1ba84990b0e9a00c97fea suggestions=S1@52bf8ee3:addressed parentRound=3

@Shikhverma Shikhverma closed this Aug 12, 2026
auto-merge was automatically disabled August 12, 2026 12:59

Pull request was closed

@Shikhverma Shikhverma reopened this Aug 12, 2026
@Shikhverma Shikhverma closed this Aug 13, 2026
@Shikhverma Shikhverma reopened this Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟠\ High\ Severity\ —\ Testing}$

Same hand-rolled Warehouse Activity Header/Line fixture pattern (Init/Insert(false), hard-coded line number, GUID-based document number) duplicated in the W1 layer copy of CreateUnregisteredWhsePickTakeLine, bypassing library-encoded setup/validation for warehouse pick lines.

Knowledge:

The same issue exists in these regional copies — apply the equivalent fix in each:

  • src/Layers/RU/Tests/SCM-Reservation/SCMItemTracking.Codeunit.al:0 (RU)
    Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4

Comment thread src/Layers/W1/BaseApp/Inventory/Tracking/ItemTrackingDataCollection.Codeunit.al Outdated
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 5

Recommendation: Request Changes

What this PR does

This PR fixes a bug where available lot quantity did not account for quantities already committed to unregistered warehouse picks. The latest commit adds an explicit Warehouse Activity Line key and moves the synthetic reservation-entry insert into a helper, but the activity-type filter still excludes inventory picks even though the code comment says they are covered.

Status of previous suggestions
ID Title Status Notes
S1 RU test still declares unused MessageHandler Addressed The RU handler list remains fixed, and the latest commit does not change that test attribute.
New observations (commits since round 4)

S1 - Inventory picks still look available
The code comment says blank Action Type covers Inventory Pick lines, but the filter still keeps Activity Type = Pick only. Inventory Pick lines use Activity Type = Invt. Pick, so they are not deducted and the same lot can still look available. Include Invt. Pick in the activity-type filter and cover that path in the test.

S2 - Limit loaded warehouse activity fields
The loop reads only item, location, source, tracking, and quantity fields from Warehouse Activity Line. Add SetLoadFields(...) before FindSet() so this hot availability lookup does not load the full wide record.

Risk assessment and necessity

Risk: The changed code runs inside codeunit 6501 "Item Tracking Data Collection", which feeds item tracking availability across document flows. Missing the Invt. Pick activity type leaves the same double-promising risk for inventory-pick locations. The key change is safe and improves query selection, but the loop still over-reads Warehouse Activity Line rows.

Necessity: The bug scenario is valid and important because unregistered picks should reduce available tracked quantity before posting. The scope is mostly right, but the fix must cover both standard warehouse picks and inventory picks when the code explicitly supports blank action-type pick lines.

[AI-PR-REVIEW] version=1 promptVersion=2 system=github pr=9982 round=5 by=alexei-dobriansky at=2026-08-13T11:04:59Z lastSha=ed30724998eb26c67d51bca28ad3aaf1182bb8d6 reviewKey=7bd34c8afc958c66818e1708c3f5bf0153e5d928d4473c3eb8e835ab70716218 suggestions=S1@7e12c54f:open,S2@e5f33065:open parentRound=4

InventoryPostingSetup: Record "Inventory Posting Setup";
ItemTrackingCodeCode: Code[10];
begin
LibraryWarehouse.CreateLocation(Location);

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.

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

The RU copy of CreateLotTrackedItemAtLocation calls LibraryWarehouse.CreateLocation directly even though this suite already uses CreateLocationWithInventoryPostingSetup for the equivalent fixture, and the matching W1 addition should be checked for the same fixture. Using the shared library fixture keeps the two layer copies from drifting and avoids failures caused by fixture-setup gaps rather than the availability behavior the test is meant to verify.

Suggested fix (apply manually — could not be anchored as a one-click suggestion):

LibraryWarehouse.CreateLocationWithInventoryPostingSetup(Location);

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Agentic PR Review - Round 6

Recommendation: Accept

What this PR does

This PR makes lot availability include quantities already committed on unregistered warehouse picks. The latest commit addresses the open items from round 5: inventory pick lines are now included in the activity-type filter, and the warehouse activity lookup limits loaded fields before FindSet().

The fix now covers both regular warehouse pick Take lines and inventory pick lines with blank Action Type. The inserted synthetic reservation entries are created before the entry summary is used, and the source check avoids subtracting the current demand from itself. The added W1 and RU tests cover both pick types for the same lot scenario.

Status of previous suggestions
ID Title Status Author response
S1 Inventory picks still look available Addressed The latest commit adds Invt. Pick to the activity-type filter and adds inventory-pick regression tests.
S2 Limit loaded warehouse activity fields Addressed The latest commit adds SetLoadFields(...) before the warehouse activity FindSet().
New observations (commits since round 5)

None - the new commit addresses the previous suggestions and I did not find a new blocking issue in the changed spans.

Risk assessment and necessity

Risk: The changed code is in codeunit 6501 "Item Tracking Data Collection", so it affects item tracking availability for document and warehouse flows. The risk is acceptable because the filters are limited to the same item, variant, location, tracked pick lines, positive outstanding quantity, and a different source. The new integration events are additive and do not break existing subscribers.

Necessity: The bug is valid and important. Without this change, a lot already allocated on an unregistered pick can still look available for another sales demand, which can double-promise the same tracked inventory. The scope is now aligned with the scenario and the added tests cover the important warehouse pick and inventory pick paths.


[AI-PR-REVIEW] version=1 promptVersion=2 system=github pr=9982 round=6 by=alexei-dobriansky at=2026-08-14T08:58:19Z lastSha=e8d5e26714fa32dc0fe069a37c1b2041a52145e3 reviewKey=na suggestions=S1@7e12c54f:addressed,S2@e5f33065:addressed parentRound=5

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

Labels

SCM GitHub request for SCM area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants