Bug 641232: [Subcontracting] Offer to install missing apps instead of hard error when disabling Legacy Subcontracting#9191
Conversation
…641232-OfferInstallMissingSubcApps
…641232-OfferInstallMissingSubcApps
|
|
||
| if not IsSubcontractingAppInstalled() then | ||
| Error(SubcontractingAppNotInstalledErr); | ||
| if not IsSubcontractingAppInstalled() then begin |
There was a problem hiding this comment.
CheckCanDisableLegacySubcontracting() no longer raises an Error when a required app is missing; it now calls OfferToInstallApp() and does a plain exit; (lines 68-77 of LegacySubcFeatureHandler.Codeunit.al).
A bare exit from a procedure with no return value is not an error — it returns normally to the caller. SetLegacySubcontracting() (lines 131-148) has no way to observe that the precondition failed, so it falls straight through to if DatabaseHasLegacySubcontractingData() then MigrateData(); and then unconditionally sets ManufacturingSetup."Legacy Subcontracting" := false, saves, and restarts the session. This happens identically whether the user accepts or declines the install Confirm, and even when the install was just kicked off (marketplace installs are asynchronous, not complete by the time control returns). The net effect is that Legacy Subcontracting can be disabled - and migration attempted or skipped - without ever confirming the required companion app is actually installed, which is the exact precondition this codeunit exists to enforce. If treated as a real defect this would be major/blocker severity (silent bypass of a documented safety gate with data-migration risk); it is capped to minor here per the agent-finding contract because there is no BCQuality knowledge article backing it yet. Recommend either making CheckCanDisableLegacySubcontracting() return a Boolean (or keep raising Error) so SetLegacySubcontracting() can abort before flipping the flag, and consider authoring a BCQuality knowledge article for 'terminating a void procedure with a bare exit does not signal failure to the caller' so this class of bug is knowledge-backed going forward.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
Copilot PR ReviewIteration 1 · Outcome: completed Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630 Findings by domainFindings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).
Totals: 0 knowledge-backed · 1 agent findings. Orchestrator pre-filter (13 file(s) excluded)
Findings produced by the Copilot CLI agent against BCQuality at |
Fixes AB#641232
Summary
On Manufacturing Setup (IT localization), disabling Legacy Subcontracting hard-errored when the Subcontracting App or IT Subcontracting Migration app was not installed, telling the user to "install the app first" with no inline path. This offers to install the missing app instead, following the same
ExtensionManagement.InstallMarketplaceExtensionpattern used by Quality Management's Contoso Demo Data.Change
File:
src/Layers/IT/BaseApp/Local/Manufacturing/Document/LegacySubcFeatureHandler.Codeunit.alIn
CheckCanDisableLegacySubcontracting(kept void - no signature/contract change), when a required app is missing it now offers to install it inline and stops:InstallMarketplaceExtensionandexit.The install schedules a session reload, so the user re-runs Disable Legacy Subcontracting: one app is installed per run until both are present, after which migration proceeds. The Pre-Check action now offers the install too, instead of dead-ending on a hard error.
Removed the now-unused
SubcontractingAppNotInstalledErr/ITMigrationAppNotInstalledErrlabels.Notes
CheckCanDisableLegacySubcontractingsignature is unchanged (void), so the cross-app call from the shipped IT Subc. Migration app (CU 149951) still binds - no breaking change.