Skip to content

Bug 641232: [Subcontracting] Offer to install missing apps instead of hard error when disabling Legacy Subcontracting#9191

Open
alexei-dobriansky wants to merge 4 commits into
mainfrom
bugs/641232-OfferInstallMissingSubcApps
Open

Bug 641232: [Subcontracting] Offer to install missing apps instead of hard error when disabling Legacy Subcontracting#9191
alexei-dobriansky wants to merge 4 commits into
mainfrom
bugs/641232-OfferInstallMissingSubcApps

Conversation

@alexei-dobriansky

@alexei-dobriansky alexei-dobriansky commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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.InstallMarketplaceExtension pattern used by Quality Management's Contoso Demo Data.

Change

File: src/Layers/IT/BaseApp/Local/Manufacturing/Document/LegacySubcFeatureHandler.Codeunit.al

In CheckCanDisableLegacySubcontracting (kept void - no signature/contract change), when a required app is missing it now offers to install it inline and stops:

  • If the Subcontracting app is missing -> Confirm "The Subcontracting app is required... Install it now?" -> on Yes, InstallMarketplaceExtension and exit.
  • If legacy data exists and the IT Subcontracting Migration app is missing -> same pattern.

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 / ITMigrationAppNotInstalledErr labels.

Notes

  • CheckCanDisableLegacySubcontracting signature is unchanged (void), so the cross-app call from the shipped IT Subc. Migration app (CU 149951) still binds - no breaking change.
  • IT-layer only; no W1 change, so no miapp propagation.

@alexei-dobriansky alexei-dobriansky added the SCM GitHub request for SCM area label Jul 7, 2026
@alexei-dobriansky alexei-dobriansky self-assigned this Jul 7, 2026
@alexei-dobriansky alexei-dobriansky added the Subcontracting Subcontracting related activities label Jul 7, 2026
@alexei-dobriansky alexei-dobriansky marked this pull request as ready for review July 7, 2026 15:12
@alexei-dobriansky alexei-dobriansky requested a review from a team July 7, 2026 15:12
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 7, 2026

if not IsSubcontractingAppInstalled() then
Error(SubcontractingAppNotInstalledErr);
if not IsSubcontractingAppInstalled() then begin

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\ —\ Agent} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

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

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: completed

Knowledge source: https://github.com/microsoft/BCQuality@822cae1b2771ac25f665f73369f69093bd4fd630

Findings by domain

Findings split into Knowledge-backed (cite a BCQuality article) and Agent (the agent's own judgement, no matching BCQuality rule).

Domain Findings Knowledge-backed Agent Inline Fallback
Agent 1 0 1 1 0

Totals: 0 knowledge-backed · 1 agent findings.

Orchestrator pre-filter (13 file(s) excluded)

  • layer-disabled (knowledge) : 13 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 822cae1b2771ac25f665f73369f69093bd4fd630. Reply 👎 on any inline comment to flag false positives.

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 Subcontracting Subcontracting related activities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant