AI and X++6 min read

Quality gates for AI-generated D365 F&O code

The checks to chain before merging AI-generated X++ code: build, BP check, tests, pull request, branch policies, then testing on a sandbox environment.

The short answer

AI-generated code must pass the same gates as hand-written code, in this order: build and best practices (BP check), unit tests, pull request review protected by Azure DevOps branch policies (minimum reviewers, build validation, linked work item, resolved comments), then package build and testing on a test environment. Each gate stops what the previous one cannot see.

Gate 1: build and BP check

The X++ compiler runs the best practice rules; the xppbp.exe tool can produce a model's Customization Analysis Report. This gate catches nested loops, inserts in a loop, try mishandled inside a transaction, uncached display methods… See BP check warnings and fixes.

Gate 2: unit tests

SysTest tests check the requested behaviour. Note: they need the runtime. Builds on Microsoft-hosted agents do not run them; you need an environment (UDE, build environment) where the test code is deployed. See first SysTest unit test and UDE.

Gate 3: pull request and branch policies

In Azure Repos, branch policies make review mandatory: minimum number of reviewers, linked work items, comment resolution, allowed merge types, build validation (a pipeline must succeed before merging) and external status checks. For generated code this is the decisive gate: someone who knows your system reviews with a checklist. See the 10-point checklist.

Gate 4: package and testing

The pipeline builds the merged branch and produces the deployable package (see Azure DevOps build pipeline). The package is first installed on a test environment, where the business validates real behaviour with its own data, before any production release.

And at Skalp AI?

At Skalp AI, the agent generates the X++ code and its unit tests, compiles with a best-practice check, then pushes a pull request to the customer's Azure DevOps project with screenshots of the tests. Nothing reaches the working branch without the customer's technical architect reviewing and approving the pull request. Gates 1 and 2 are therefore passed before delivery; gates 3 and 4 stay with you. See Azure DevOps integration, building X++ without a consultant in 2026 and the Basic, Pro and Max plans (1 credit, ≈ €400 on Basic, €200 on Pro, consumed only when the code is generated).

See also: AI ticket creation in D365 F&O.

Sources

Frequently asked questions

Which branch policy should you enable first?

A minimum number of reviewers and build validation: human review and automatic compilation before every merge.

Can SysTest tests run in the hosted pipeline?

No. The hosted build only compiles and packages; tests need an environment with the runtime.

Does AI-generated code need extra gates?

The same gates, applied without exception. The pull-request review simply deserves an explicit checklist, because AI does not know your context as your developers do.

Ready to transform your D365?

Join the CIOs who develop their D365 tickets in 2–4 h for 1 credit (≈ €400 on Basic, €200 on Pro).