Skip to content

Use BCPlatform version from Packages.json in NewDevEnv - #9032

Open
Maria Zhelezova (mazhelez) wants to merge 10 commits into
mainfrom
mazhelez-fix-newdevenv-bcplatform-version
Open

Maria Zhelezova (mazhelez) wants to merge 10 commits into
mainfrom
mazhelez-fix-newdevenv-bcplatform-version

Conversation

@mazhelez

@mazhelez Maria Zhelezova (mazhelez) commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

What & why

NewDevEnv was not honoring the BCPlatform version pinned in build/Packages.json. The reason is that build/scripts/DevEnv/NewDevEnv.psm1 creates the dev container (New-BcContainer) and the compiler folder (New-BcCompilerFolder) directly, which bypasses the AL-Go override scripts (NewBcContainer.ps1 / PreNewBcCompilerFolder.ps1) that inject the platformArtifactUrl derived from the configured BCPlatform version. As a result a NewDevEnv container/compiler always used the platform shipped with the artifact instead of the pinned platform.

This change makes NewDevEnv apply the same platform version that the CI/AL-Go path already uses. The compiler-folder cache records the resolved platform artifact URL and is recreated when that URL changes, including when the platform pin is added or removed.

Linked work

Fixes AB#658052

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome (required — be specific: scenarios, commands, screenshots for UI changes)

  • After merging the latest main on November 5, 2026, ran Invoke-Pester -Path .\build\scripts\tests\PlatformHelper.Test.ps1 -PassThru: passed, 14 tests, 0 failures. Coverage includes full-version URL resolution, major.minor resolution, no configured platform, unavailable versions, and platform-index caching.
  • Container creation, AL compilation, and container-backed tests were not run locally; end-to-end validation requires Docker and BC artifacts.

Risk & compatibility

The new behavior only sets platformArtifactUrl when a BCPlatform version is configured in Packages.json; when it is absent the helper returns $null and container/compiler creation uses the existing default platform. Changing or removing the pin invalidates the cached compiler folder. The two AL-Go override scripts were refactored to call the shared helper, so their platform-selection behavior is functionally identical (deduplication only).

NewDevEnv created the dev container and compiler folder by calling New-BcContainer / New-BcCompilerFolder directly, bypassing the AL-Go override scripts that inject the platformArtifactUrl from the BCPlatform version pinned in build/Packages.json. As a result NewDevEnv ignored the configured platform version.

Add a reusable Get-BCPlatformArtifactUrl helper to PlatformHelper.psm1 and use it in NewDevEnv.psm1 so both the container and compiler folder honor the pinned BCPlatform version. Refactor the NewBcContainer.ps1 and PreNewBcCompilerFolder.ps1 override scripts to use the shared helper, and add tests for it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mazhelez
Maria Zhelezova (mazhelez) requested review from a team July 2, 2026 10:31
@github-actions github-actions Bot added the Build: scripts & configs Build scripts and configuration files label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234'

Comment thread build/scripts/PlatformHelper.psm1 Fixed
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 1 · Outcome: not-applicable

PR #9032 changes only PowerShell build-tooling files (build/scripts/DevEnv/NewDevEnv.psm1, build/scripts/NewBcContainer.ps1, build/scripts/PlatformHelper.psm1, build/scripts/PreNewBcCompilerFolder.ps1, build/scripts/tests/PlatformHelper.Test.ps1); the diff contains no AL source changes. All six al-code-review sub-skills (performance, security, privacy, upgrade, style, UI) returned outcome 'not-applicable' since each requires AL (or, for UI, AL/JS/CSS/HTML control add-in) content in the diff, which is absent here.

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

No findings were posted for this iteration.

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.

Merge the two fullBuildPatterns arrays into one. Having duplicate JSON
keys caused PowerShell's ConvertFrom-Json to use only the last value
(["src/Layers/*"]), losing the build/*, src/rulesets/*, and workflow
patterns. This broke 6 BuildOptimization PS tests in CI.
@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Jul 2, 2026
spetersenms
spetersenms previously approved these changes Jul 6, 2026
@github-actions github-actions Bot added the Build: Automation Workflows and other setup in .github folder label Jul 8, 2026
@mazhelez

Copy link
Copy Markdown
Contributor Author

Copilot

Please fix this alert:
The cmdlet 'Get-BCPlatformArtifactUrl' returns an object of type 'System.String' but this type is not declared in the OutputType attribute.

Copilot AI commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Copilot

Please fix this alert:
...

Fixed by declaring [OutputType([string])] on Get-BCPlatformArtifactUrl.

@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Jul 8, 2026
@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) added Team: Other GitHub request for other area than SCM, Finance or Integration Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction labels Jul 16, 2026
@mazhelez

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

…v-bcplatform-version

# Conflicts:
#	.github/AL-Go-Settings.json

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in 967238a. The only conflict was in .github/AL-Go-Settings.json — main added src/DisabledTests/* to fullBuildPatterns, which I kept alongside the consolidated patterns from this branch.

@github-actions github-actions Bot added needs-approval Workflow runs require maintainer approval to start and removed Build: Automation Workflows and other setup in .github folder needs-approval Workflow runs require maintainer approval to start labels Jul 21, 2026
Remove the standalone Get-PlatformVersionUrl helper since it had no
independent production caller and the extra indirection was confusing.
Its validation and URL formatting now live directly in
Get-BCPlatformArtifactUrl.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a438d803-37a3-4dd1-9478-d45bf6c35b7f
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

Copilot AI left a comment

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.

🟡 Changes recommended

The persistent compiler cache can bypass the configured platform version and reuse an outdated compiler.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates NewDevEnv to honor the BCPlatform version pinned in Packages.json.

Changes:

  • Adds a shared platform artifact URL helper.
  • Applies the pinned platform to container/compiler creation.
  • Adds Pester coverage for URL resolution.
File summaries
File Description
build/scripts/PlatformHelper.psm1 Adds shared platform URL resolution.
build/scripts/tests/PlatformHelper.Test.ps1 Tests platform URL behavior.
build/scripts/NewBcContainer.ps1 Uses the shared helper.
build/scripts/PreNewBcCompilerFolder.ps1 Uses the shared helper.
build/scripts/DevEnv/NewDevEnv.psm1 Applies the pinned platform in NewDevEnv.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread build/scripts/DevEnv/NewDevEnv.psm1 Resolved
CreateCompilerFolder returned the persisted CompilerFolder whenever it existed, so a change to the BCPlatform version in Packages.json was ignored and an outdated compiler kept being reused. Record the resolved platform artifact URL in a marker file and recreate the cached folder when the configured version differs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

AB#658052

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added this to the Version 30.0 milestone Nov 5, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

@mazhelez

Copy link
Copy Markdown
Contributor Author

Copilot please resolve the merge conflicts

…v-bcplatform-version

# Conflicts:
#	build/scripts/NewBcContainer.ps1

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Copilot please resolve the merge conflicts

Resolved in e1c1715, preserving both the container isolation settings and the shared platform URL helper. All 14 platform helper tests passed; CodeQL timed out on the merge diff.

@github-actions github-actions Bot added the needs-approval Workflow runs require maintainer approval to start label Dec 2, 2026

This branch was previously deployed

1 inactive (outdated) deployment
triage — 2116e5ac Deployed Sep 28, 2026 by mazhelez via Classify team ownership #6015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build: scripts & configs Build scripts and configuration files needs-approval Workflow runs require maintainer approval to start Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction Team: Other GitHub request for other area than SCM, Finance or Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants