A pinned copy of the Azure Landing Zones Library is test data, with a coverage report and a regression baseline¶
Context and Problem Statement¶
The Azure Landing Zones Library (ALZ) is the largest public set of custom Azure Policy definitions, and the reference for what Bylaw must be able to express: 149 custom policy definitions and 44 initiatives in its platform/alz library (checked 2026-11-28; ADR-0010). Converting all of it is the best test of the decompiler (ADR-0039) and the language, and its results tell users what to expect when they migrate. ALZ is MIT licensed, copyright Microsoft Corporation, which allows copying it with its notice (checked 2026-11-28; recorded in the spec). How is ALZ content brought into the repository, what is measured, and how is it kept from regressing?
Decision Drivers¶
- Reproducible: the same commit of Bylaw gives the same results.
- The licence's terms are met: the copyright notice and licence text travel with the content.
- Never shipped: ALZ content isn't part of the published module.
- A change that makes Bylaw convert fewer definitions fails the build.
- Keeping up with ALZ is a deliberate step, not an accident of the network.
Considered Options¶
- A pinned copy committed as test data, with a baseline
- Downloaded at test time
- A git submodule
Decision Outcome¶
Chosen option: "A pinned copy committed as test data, with a baseline".
The copy¶
tests/Alz/holds the policy definitions and policy set definitions from ALZ'splatform/alzlibrary, as they are in ALZ, at one commit. Other content, such as archetypes and assignments, isn't copied.tests/Alz/THIRD-PARTY-NOTICES.mdhas Microsoft's copyright line, the full MIT licence text, the source repository and the commit.build/alz/Update-AlzSnapshot.ps1 -Commit <sha>replaces the copy with another commit, rewrites the notice, and stops if the repository's licence is no longer MIT, so a change of licence is never picked up unnoticed. It reads the commit through the GitHub API, without cloning..gitattributesmarks the copy as vendored, so it doesn't count in the repository's language statistics, and it is outsidesrc/, soPackagedoesn't publish it.
The coverage report¶
build/alz/Get-AlzCoverage.ps1converts every definition in the copy withConvertTo-Bylaw, and reports per definition:Converted,EscapeHatch(with the conditions that neededCondition, ADR-0040), orFailed(with the diagnostics). It writesout/alz-coverage.mdandout/alz-coverage.json.- It can also run against the latest ALZ, fetched into an ignored folder, to see what an update would change before pinning it.
- The README gives the totals for the pinned commit, such as "143 of 149 converted, 4 with the escape hatch, 2 failed", updated when the copy or the baseline changes.
The baseline¶
tests/Alz/baseline.jsonrecords the expected status of each definition.- A test converts the copy and fails when any definition's status is worse than its baseline:
ConvertedtoEscapeHatchorFailed, orEscapeHatchtoFailed. A better status also fails, with a message to update the baseline, so improvements are recorded rather than lost. - Every
ConvertedandEscapeHatchresult is also proven equivalent to its input (ADR-0041), so the test checks the conversions are right, not only that they ran. - The test is tagged
Alz. Since 2026-11-29 CI runs it once, in its own Ubuntu job beside the OS matrix (Windows and Linux; macOS runs weekly, separately), which skips it (build.ps1 -ExcludeTag Alz); it took about 3 minutes of each OS's run. Conversion gives the same result on every OS, which the byte-for-byte comparison of the converted files checks, so one run is enough. The release job waits for both.
The converted files¶
Added 2026-11-29. A status says whether a definition converts, not what it converts to: a change that makes the output worse but still proven equivalent, such as a full alias where a short field would do, kept every status and passed. So the conversions are committed too, as golden files.
tests/Alz/converted/holds what each definition converts to:policy_definitions/<name>.bylaw.ps1andpolicy_set_definitions/<name>.bylaw.ps1, with DeployIfNotExists templates in atemplates/folder beside them, asConvertTo-Bylawwrites them.Get-AlzCoverage.ps1 -UpdateBaselinereplaces the folder as a whole, with the baseline, so no file outlives the conversion that wrote it.- The test compares each conversion with its committed files byte for byte, and fails on a committed file the conversion no longer writes. A change to
ConvertTo-Bylawor the language then shows in review as a diff of real policies. - They are derived from ALZ content, so they follow the same rules: they stay under
tests/Alz/, covered by its notice, and are never shipped..gitattributesmarks them generated, so GitHub collapses them in diffs.
Keeping up with ALZ¶
Added 2026-11-29. The copy stays pinned, and moving it stays a reviewed step, but nobody had to remember to check. A weekly workflow, .github/workflows/alz-sync.yml, runs build/alz/Sync-AlzSnapshot.ps1: when ALZ's latest commit differs from the pinned one, it pins the latest (which stops unless the licence is still MIT), updates the baseline, converted files and README totals, and opens one pull request, or updates the open one, from the alz/sync branch. The description lists the definitions added, removed and changed, and every status that changed, worse ones first, with a checklist: the licence, the converted files, the README. Nothing is merged automatically. A pull request opened with the workflow's token doesn't start other workflows, so it starts CI on the branch itself.
Consequences¶
- Good, because the decompiler and the language are measured against the definitions people most often migrate, and can't silently get worse.
- Good, because the licence's terms are met in one visible place.
- Good, because every change to what
ConvertTo-Bylawwrites is visible in review, across about 200 real policies. - Bad, because the repository carries a few hundred ALZ files, and as many converted ones, which need updating deliberately. A change to the decompiler can rewrite many converted files at once.
- Bad, because the README's totals go stale if the baseline is updated without them. The baseline update script will print the new totals to copy in.
Confirmation¶
The baseline test passes on the pinned copy; the notice matches the pinned commit and the licence; and Package output contains no ALZ file.
Pros and Cons of the Options¶
A pinned copy committed as test data¶
- Good, because results are reproducible offline, and changes to ALZ are reviewed as a diff.
- Bad, because the copy must be updated by hand.
Downloaded at test time¶
- Good, because nothing extra is committed.
- Bad, because a test result depends on the network and on ALZ's latest commit, so a change in ALZ can fail an unrelated change to Bylaw.
A git submodule¶
- Good, because it pins a commit without copying files.
- Bad, because it brings the whole ALZ repository, needs
git submodule update, and the notice still has to be added beside it.