Skip to content

Bug 646360: Validate introduced object IDs against allowed ranges in the PR gate - #10363

Open
Chethan Thopaiah (ChethanT) wants to merge 3 commits into
mainfrom
bugs/646360-object-range-gate
Open

Bug 646360: Validate introduced object IDs against allowed ranges in the PR gate#10363
Chethan Thopaiah (ChethanT) wants to merge 3 commits into
mainfrom
bugs/646360-object-range-gate

Conversation

@ChethanT

@ChethanT Chethan Thopaiah (ChethanT) commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a pull-request / merge-group gate check (in the existing TestObjectIdsAndManifests action and AppObjectValidation.psm1) that fails the build when a first-party app introduces AL objects whose numeric object IDs fall outside the allowed ranges 1..49999 and 99000750..99001048.

Root cause

The gate validated test-object ranges, duplicate object IDs, app IDs and manifests, but never validated that production object IDs stay within first-party ranges. This let the Subcontracting app be numbered into a range already assigned to and used by LS Retail; the overlap was only found later (customer case), costing ~1 week of rework.

Fix

  • New Test-IntroducedObjectIDsAreInAllowedRange validates object IDs read directly from AL object declarations (not app.json).
  • Only object signatures (object type, object id) newly introduced relative to the PR base commit are checked. Existing objects are grandfathered even if out of range; test objects are excluded (validated separately). New file → checked; renumber → new signature checked; edit with same type/ID → ignored; rename/move with unchanged signature → ignored; deletion → ignored.
  • All offending introduced objects are aggregated and reported (type, ID, name, path) before the build fails.
  • Base SHA is resolved robustly for both pull_request (event.pull_request.base.sha) and merge_group (event.merge_group.base_sha) events, with an origin/GITHUB_BASE_REF fallback; the check is skipped gracefully outside a PR context.
  • Extension, enum and permission-set objects (which also consume IDs from the app's ranges — 96 of 169 Subcontracting objects) are covered via a parameterized object-type pattern used only by this check, so the existing duplicate / test-range / app-ID / manifest checks are unchanged.

Test

Adds build/scripts/tests/AppObjectValidation.Test.ps138 regression tests covering range boundaries, in/out-of-range objects, unchanged & edited existing objects, renumber, rename/move, deletion, multiple aggregated failures, extension/enum/permission-set coverage, and pull_request / merge_group base-SHA resolution (incl. a git-backed integration test). All 38 pass; PSScriptAnalyzer clean with the repo's excluded rules.

AB#646360

🤖 Generated with GitHub Copilot

…the PR gate

Adds a pull-request/merge-group gate check that fails when a first-party app introduces
AL objects whose numeric IDs fall outside the allowed ranges (1..49999, 99000750..99001048).
This prevents object ID ranges reserved for partners/ISVs from being consumed by first-party
apps (the Subcontracting vs. LS Retail overlap incident).

Only object signatures newly introduced relative to the PR base commit are validated, so
existing objects are grandfathered even when out of range; test objects are validated
separately and are excluded. All offending introduced objects (type, ID, name, path) are
aggregated and reported before the build fails. Base SHA is resolved robustly for both
pull_request and merge_group events, with an origin/GITHUB_BASE_REF fallback. Extension,
enum and permission-set objects are included via a parameterized object-type pattern used
only by the new check, so the existing duplicate/test/app-ID/manifest checks are unchanged.

Adds AppObjectValidation.Test.ps1 with 38 regression tests covering range boundaries,
in/out-of-range objects, unchanged/edited existing objects, renumber, rename/move, deletion,
multiple aggregated failures, object-type coverage, and base-SHA resolution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ChethanT
Chethan Thopaiah (ChethanT) requested review from a team August 18, 2026 14:25
@github-actions github-actions Bot added Build: Automation Workflows and other setup in .github folder Build: scripts & configs Build scripts and configuration files Other GitHub request for other area than SCM, Finance or Integration Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction labels Aug 18, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 18, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build: Automation Workflows and other setup in .github folder Build: scripts & configs Build scripts and configuration files Other GitHub request for other area than SCM, Finance or Integration Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant