Repository navigation
[Bug Fix] #531: Seed BEANS purchase inspection generation rule - #12267
business-central-bug-fix-bot[bot] wants to merge 9 commits into
Conversation
Fixes AB#650223 Promoted from microsoft/BCAppsBugFix#580 (https://github.com/microsoft/BCAppsBugFix/pull/580)
Good Sense Reviewer - Round 1Recommendation: Request ChangesWhat this PR doesThis change seeds a category-filtered BEANS Purchase Line rule at sort order 30, ahead of the generic RECEIVE rule at 40, and adds regression coverage. For normal item lines, the filter and ascending rule order correctly select BEANS for BEANS items and retain RECEIVE for other categories. However, the new rule can win when no item is resolved, and the added test dependency creates a third build stage without the required workflow update. Problem-solution fitFit: Strong The change targets the missing seeded rule and preserves the intended fallback for ordinary item lines. The two issues below must be corrected before the change is safe and buildable. SuggestionsS1 (🔴 High): Skip BEANS when no item is resolved S2 (🔴 High): Regenerate workflows for the deeper build graph Risk assessment and necessityRisk: The runtime change is limited to demo configuration, but sort order 30 affects every Purchase Line rule search and can select BEANS when no item is resolved. Public APIs and event contracts are unchanged, and there is no BaseApp event dependency or country-layer impact. The new test dependency currently prevents the pull-request build from reaching compilation. Necessity: The rule is required so demo bean receipts select the intended inspection template instead of the generic fallback. The scope is appropriate, but the unresolved-item behavior and generated build workflow must be corrected.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83f7893f-a0aa-4f98-99e6-7d8176e8f906
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83f7893f-a0aa-4f98-99e6-7d8176e8f906
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83f7893f-a0aa-4f98-99e6-7d8176e8f906
|
Addressed the remaining findings: |
Good Sense Reviewer - Round 2Recommendation: Accept with SuggestionsWhat this PR doesThe new commits make filtered generation rules skip unresolved items, add a regression test for the generic RECEIVE fallback, and update the generated workflows for a three-stage build graph. These changes address both previous blockers, and the BEANS-specific rule now applies only when the item matches its category filter. The remaining issues are analyzer warnings in the new demo and test code that currently keep the pull-request build red. Status of previous suggestions
New observations (commits since round 1)S3 (🟠 Moderate): Use bounded text for item filters S4 (🟠 Moderate): Avoid the LibraryInventory name collision Risk assessment and necessityRisk: The matcher change affects every item-filtered generation rule, but the new condition preserves generic rules and explicitly covers the unresolved-item fallback. Public APIs and event contracts are unchanged. The current W1 build fails only on the four new analyzer warnings described above, so these should be cleared before merge. Necessity: The BEANS rule is required so category-specific coffee purchases select BEANS before the generic RECEIVE rule. The matcher guard and workflow regeneration are also necessary to make that configuration safe and buildable; the scope remains focused on the reported demo-data defect and its validation.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83f7893f-a0aa-4f98-99e6-7d8176e8f906
|
Addressed the remaining analyzer and review findings in |
Good Sense Reviewer - Round 3Recommendation: Request ChangesWhat this PR doesThe new commit bounds the item-filter text, removes the test variable name collision, and allows the demo seeder tests to commit. The focused generation-rule tests now pass, and the earlier runtime and workflow findings are addressed. However, the test app now depends on a W1-only demo package while it is still compiled in regional app jobs, so the PR does not build in RU. Status of previous suggestions
New observations (commits since round 2)S5 (🔴 High): Keep demo-only tests out of regional builds Risk assessment and necessityRisk: The runtime rule change is narrow and the focused tests pass in W1. The new test-app dependency still breaks the regional build graph, so this branch cannot pass the required app compilation until the tests are placed in a W1-only project or the dependency is removed from regional builds. Necessity: The BEANS rule and its regression coverage are needed to preserve the category-specific demo behavior and the generic RECEIVE fallback. The test placement must change without weakening that coverage.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83f7893f-a0aa-4f98-99e6-7d8176e8f906
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83f7893f-a0aa-4f98-99e6-7d8176e8f906
| end; | ||
|
|
||
| procedure InsertQualityInspectionGenRule(EntryNo: Integer; SortOrder: Integer; Intent: Enum "Qlty. Gen. Rule Intent"; TemplateCode: Code[20]; SourceTableNo: Integer; ConditionFilter: Text[400]; Description: Text[100]; ActivationTrigger: Enum "Qlty. Gen. Rule Act. Trigger") | ||
| begin |
There was a problem hiding this comment.
The changed public overloads of the demo library procedure InsertQualityInspectionGenRule do not have XML documentation. Add a summary, one param tag for each parameter, and a return tag when applicable so callers can understand the public helper contract.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.49.6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83f7893f-a0aa-4f98-99e6-7d8176e8f906
|
The post-YAML-revert Initialization failure was related to this PR: the Quality Management test app dependency on the Demo Dataset required build depth 3. Fixed in |
Good Sense Reviewer - Round 4Recommendation: Accept with SuggestionsWhat this PR doesThe new commits remove unrelated workflow changes and the W1-only test-app dependency, restoring regional compilation. The product change still seeds a BEANS purchase rule at sort order 30 with a category filter, preserves RECEIVE at sort order 40, and prevents item-filtered rules from matching when no item is resolved. The runtime logic and helper overload are coherent, but the replacement regression tests now recreate the demo setup locally instead of executing the production seeder. Status of previous suggestions
New observations (commits since round 3)S6 (🟠 Moderate): Tests bypass the production demo seeder Risk assessment and necessityRisk: The production behavior is narrow, the original helper signature remains compatible, and regional compilation is restored. The remaining risk is that the tests will not detect a regression in the actual demo seeder. Necessity: The BEANS rule is needed because tracked BEANS items otherwise select the generic RECEIVE rule. The production scope is appropriate, but direct coverage of the seeded configuration should be retained.
|
Predrag Maricic (PredragMaricic)
left a comment
There was a problem hiding this comment.
S1 - Restore direct regression coverage for the production demo seeder (High confidence)
The latest test change removed the Demo Data dependency and now recreates templates and generation rules through local test helpers. None of the eight tests executes Create QM Generation Rule or the new Contoso Quality Management.InsertQualityInspectionGenRule(..., ItemFilter) overload. The suite therefore remains green if the production seeder omits BEANS, passes the wrong category filter or priority, or the overload drops Item Filter - precisely the root defect and both production surfaces changed by this PR.
Please move the seed-specific assertions to a W1-only test project that can run the real seeder, or extract a production seam that the regional test app can invoke without taking a W1-only package dependency. Keep the local matcher tests for BEANS, non-BEANS, and non-item resolution. Please also update the PR description because it currently says the tests exercise the actual demo configuration and still lists a removed test dependency.
The rule-matching correction itself is coherent and covers the unresolved-item fallback. All 170 checks completed: 168 successful and 2 skipped. The unresolved XML-documentation thread is nonblocking.
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83f7893f-a0aa-4f98-99e6-7d8176e8f906
| InsertQualityInspectionGenRule(EntryNo, SortOrder, Intent, TemplateCode, SourceTableNo, ConditionFilter, Description, ActivationTrigger, ''); | ||
| end; | ||
|
|
||
| procedure InsertQualityInspectionGenRule(EntryNo: Integer; SortOrder: Integer; Intent: Enum "Qlty. Gen. Rule Intent"; TemplateCode: Code[20]; SourceTableNo: Integer; ConditionFilter: Text[400]; Description: Text[100]; ActivationTrigger: Enum "Qlty. Gen. Rule Act. Trigger"; ItemFilter: Text[2048]) |
There was a problem hiding this comment.
The new public InsertQualityInspectionGenRule overload on the Contoso library codeunit has no XML documentation. Add a meaningful
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.50.6
| InsertDemoGenerationRule(4, 40, ReceiveTemplateCodeTok, ReceiveTemplateDescTok, ''); | ||
| end; | ||
|
|
||
| local procedure InsertDemoTemplate(TemplateCode: Code[20]; TemplateDescription: Text[100]) |
There was a problem hiding this comment.
The new demo tests build their own templates and generation rules in InsertDemoTemplate and InsertDemoGenerationRule instead of invoking the changed demo-data codeunits. This hand-rolled fixture duplicates the production defaults, so the tests can pass while the actual demo seeding is broken or diverges from the fixture. Seed the fixture through CreateQMInspTemplateHdr/CreateQMGenerationRule (or a maintained test-library wrapper) and assert the records produced by that code.
Knowledge:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.50.6
| QltyInspectionGenRule.DeleteAll(); | ||
| end; | ||
|
|
||
| local procedure SeedDemoGenerationRules() |
There was a problem hiding this comment.
The tests labeled as demo-generation tests recreate the BEANS and RECEIVE rules in the local SeedDemoGenerationRules fixture instead of invoking the changed Create QM Generation Rule demo codeunit. They can therefore pass while the production demo seeder is broken; invoke the production seeder and assert its resulting records, keeping only minimal test-only data setup that the seeder does not provide.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.50.6
|
What & why
Seed the missing BEANS purchase inspection generation rule in the Quality Management Contoso Coffee demo dataset. BEANS-category purchases, including tracked WRB-1002, now select BEANS ahead of the generic RECEIVE template. Other item categories continue to use RECEIVE.
Root Cause
Create QM Generation Rulecreated only RECEIVE at sort order 40, although the BEANS template and coffee items already existed. Rule resolution correctly supports item filters and ascending priority; the missing demo configuration was the defect.Changes Made
CreateQMGenerationRule.Codeunit.al: add Purchase/Purchase Line rule 3 at sort order 30, enabled for manual and automatic creation, with an item-category BEANS filter.ContosoQualityManagement.Codeunit.al: add an Item Filter overload while preserving the original helper signature and overwrite protection.CreateQMInspTemplateHdr.Codeunit.al: expose the existing localized BEANS description.QltyTestsGenerationRule.Codeunit.al: add seven regression tests to existing codeunit 139955, using the real demo seeders.app.json: reference the demo dataset so the tests exercise its actual configuration.The issue fix is commit
b0549c777e452d82218188e370c61567ef13b0a3. The supplied branch also contains earlier infrastructure commits; see Risk & compatibility.Linked work
Fixes microsoft/BCAppsBugFix#531
AB#650223
How I validated this
What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)
The five-file issue-fix diff was inspected and independently accepted. The full PR also includes inherited infrastructure changes that this run did not author, so the first checklist item is intentionally unchecked. All four projects built successfully; saved build responses report no warnings, but the error-filtered diagnostic evidence is not a complete analyzer-warning comparison, so the second combined checklist assertion is intentionally unchecked.
Implementation Process
334E15A2CC6D17B7B43462583BFFF53AB58CD28EAE3FE557F7D37B12F4334786; installed PackageId:29ea1b6b-8f87-4a15-b8a0-38f71bec481c.Validation Evidence
The repository's bug-fix build/publish/test commands were used against the provisioned container; no environment was provisioned by this run.
Result: passed, four projects compiled. Final build evidence:
build-ae4c40f8c7954177b6a1d737ac8cfc72.json.Result: deployed and exactly attested all four packages in dependency order.
Result: ready, schema version 2, all three proof flags true, including exact reachable local-artifact reattestation.
AL MCP test invocation:
al_run_tests, codeunitId139955, projectPathC:\vss-agent\2.337.0\_work\BCAppsBugFix\BCAppsBugFix\src\Apps\W1\Quality Management\test, serverUrlhttp://bcapps-36690750368-1, serverInstanceBC, port7049, tenantdefault, authenticationUserPassword, withtestMethodsequal to the ten names below. Result: 10 passed, 0 failed, 0 skipped. The full module suite and manual UI scenarios were not run.Automated Test Evidence
ActivationTriggerFindGenerationRule_ManualAndAuto_AutoRuleSearchActivationTriggerFindGenerationRule_ManualAndAuto_ManualRuleSearchFindGenerationRule_ItemFilterDemoBeansTrackedPurchase_ManualSelectsBeansDemoBeansTrackedPurchase_AutomaticSelectsBeansDemoBeansPurchase_OtherItemSelectsBeansDemoPurchase_NonBeansItemSelectsReceiveDemoBeansRule_HasPurchaseScopeAndPriorityDemoBeansRule_RepeatedSeedingIsIdempotentDemoBeansRule_RepeatedSeedingPreservesCustomizationThe first three failing BEANS selection tests each reported:
The three failing BEANS seed/scope/repeat tests each reported:
Total Tests Run: 10 in the final run. All Tests Passing: Yes.
Exact responses are retained in
bc-test-baseline-output-531-iteration-1.txtandbc-swe-test-output-531-iteration-1.txtin the run's per-bug state.Validation Coverage
Risk & compatibility
The change is limited to seeded demo configuration. The original helper signature, generic RECEIVE rule, and existing-record overwrite protection remain intact. No table schema, resolver algorithm, posting behavior, permissions, or transaction boundaries change.
The supplied working branch already contained seven infrastructure commits after
origin/mainbefore this task began, starting at8a5adba63and ending at1e4fc454c. They affect 11 workflow/skill/support-script files and remain in the PR because this run was required to preserve the supplied branch without resetting or switching it. This run's only authored commit changes the five Quality Management files listed above. Infrastructure verification suites for those inherited changes were not rerun here.Miapp Propagation
Invoke-BugFixMiapp.ps1Propagate and Verify both succeeded. Verify checked 16 files and reported no missing files.AL Review
Status: Skipped - empty engine result. One round and one invocation. The vendored engine failed during pinned BCQuality skill-index construction because
al-code-review.mdreferenced missing action skillmicrosoft/skills/review/al-performance-review.md; it produced no report.Saved skip reason:
Review report is absent or empty: C:\Users\CLOUDT~1\AppData\Local\Temp\bc-fix-bug\BUG-531\al-review\round-1\_review-report.json.The approved
Test-LocalReviewEvidence.ps1 -AllowEmptyReportclassifier was independently rerun before PR creation and returnedskipped-empty. Every available invocation artifact was archived; there were no earlier reports or known blocking findings. This is the skill's explicit V5 exception, not a clean review. No AL review verdict is available; findings and coverage are unknown. Engine metrics were not produced. No findings were applied and the independently accepted, green change set is unchanged.Review Notes
Please review the category-specific demo rule and retained generic fallback, and account for the explicitly unavailable AL quality review and inherited infrastructure commits above.
Generated by the bc-fixbug skill.
Promoted from microsoft/BCAppsBugFix#580: https://github.com/microsoft/BCAppsBugFix/pull/580
Fixes AB#650223