You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tests): add the missing byte order mark to Invoke-MtPackGitHubRequest.Tests.ps1 - #2795
One byte. FileEncoding.Tests.ps1 requires every tracked PowerShell file to be UTF-8 with a byte order mark, and powershell/tests/functions/Invoke-MtPackGitHubRequest.Tests.ps1 arrived without one in #2792 (77f3bdc8). It is the only tracked .ps1 file in the repository that is missing it.
The effect is not limited to main: the Linux leg of build-validation fails there, and every pull request that merges main inherits the failure. I found it while working out why four of my own PRs went red on build-validation (ubuntu-latest) and only on that leg — the general tests, this one included, run on Linux only.
Measured, on main at 02a220b2 and with this change:
main, as it is: FileEncoding.Tests.ps1 4 passed, 1 failed
-> "but got 'powershell/tests/functions/Invoke-MtPackGitHubRequest.Tests.ps1'"
with this one byte: FileEncoding.Tests.ps1 5 passed, 0 failed
GeneratedFileFormatting.Tests.ps1 3 passed
RepositoryLayout.Tests.ps1 14 passed
Both runs went through powershell/tests/pester.ps1, so on the Pester the repository pins.
Two other failures on that leg, which this does not fix
The same CI run reported four failures out of 8,760. One is the encoding test above. The other three are in Test-MtCaEmergencyAccessExists.Tests.ps1, in the No emergency access config defined (auto-detection mode) block.
Those pass on unmodified main when the file is run on its own — 20 of 20 here, through the same runner. So from the outside they look order- or environment-dependent rather than broken, and I would not want this PR to be read as fixing them. I have not isolated them; if they are known, ignore this paragraph, and if they are not, I am happy to go and find out what state is leaking between files, since a test that only fails in the full suite is the kind that gets ignored until it hides something real.
…uest.Tests.ps1
`FileEncoding.Tests.ps1` requires every tracked PowerShell file to be UTF-8 with
a BOM. This file arrived without one in maester365#2792, so the Linux leg of
build-validation fails on main and on every pull request that merges it.
It is the only tracked .ps1 file in the repository without a BOM.
maester365/maester#2792: Adds tests in the same file. This change adds a UTF-8 byte-order mark to that test file without changing test behavior.
Suggested reviewers:merill
Merge Risk: Minimal · previous review f140e
This change adds a missing byte-order mark to a test file so the repository's file-encoding check passes. It has no runtime impact and is ready to merge.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: adding the missing byte-order mark to the specified test file.
Description check
The description clearly explains the change, its cause, its CI impact, validation results, and the unrelated failures that remain. It does not reproduce every template heading or checklist item, but t…
Docstring Coverage
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Description check
Explanation
The description clearly explains the change, its cause, its CI impact, validation results, and the unrelated failures that remain. It does not reproduce every template heading or checklist item, but the required technical information is mostly complete.
Full details: Docstring Coverage
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer TIP This summary will be updated as you push new changes.
Following up on the three failures I said I would go and find: they are #2797, and they are not flaky.
In coverage mode pester.ps1 passes every file to one Invoke-Pester call from its own scope, so a test that reads a variable it never assigned finds the runner's. $config = New-PesterConfiguration is therefore visible to the tests as $config, and Test-MtCaEmergencyAccessExists.Tests.ps1 has five cases that pass $config to the check meaning "nothing configured, auto-detect". Measured with a Write-Host on a throwaway copy:
without coverage: config-is-null=True type=
with coverage: config-is-null=False type=PesterConfiguration
Three fail; two more pass for the wrong reason. Coverage runs only on the Linux leg, which is why only that leg is red.
So the four failures on that leg are: the byte order mark here, and those three there. On unmodified main at 02a220b2 I get 8,756 tests and 4 failures with PESTER_COVERAGE=true, and 3,989 tests with 0 failures in per-file mode — the same four CI reports. The two PRs together take it to zero.
This one stays a single byte and does not depend on #2797.
commit 3b8d487cfix(tests): restore UTF-8 BOM in private pack request tests
All three apply the identical change (ef bb bf before BeforeAll {), and main still does not have it — I checked the first three bytes of the file on main and they are 42 65 66.
That means two things. Whichever of the three lands first turns the hunk in the other two into a conflict on that file, and until one lands, FileEncoding.Tests.ps1 keeps failing on main, which is one of the two causes of the red build-validation (ubuntu-latest) leg. The other cause is #2797.
This PR is the cheapest way out of that: one byte, no behaviour, and it removes the hunk's reason to exist in the other two. I have also just brought it up to date with main (it was BEHIND, which blocks the merge button regardless of review), so the only thing left on it is a maintainer's approval.
Not asking anyone to reorder their work — just making sure the duplication is visible before three people resolve the same conflict.
4 = 1 + 3. This PR removes the byte order mark failure; #2797 removes the other three. Together they take the leg to zero, and neither overlaps the other.
Why it is worth landing rather than waiting: 28 of the 40 open non-draft PRs currently show that leg red, and for the ones where the job actually ran the failures are this same baseline, not the contributors' changes. Three PRs built today are green only because they have no ubuntu-latest run at all. So the red is telling every contributor in the repo that they broke something, and none of them did.
Linux is the only leg with PESTER_COVERAGE=true, which is why Windows and macOS are green throughout.
Happy to rebase or split further if that makes it easier to take.
FiraSenax
added a commit
to FiraSenax/maester
that referenced
this pull request
Nov 13, 2026
Measured evidence that this PR and #2797 are complementary and that together they take build-validation (ubuntu-latest) to zero failures. Read from the CI logs of four runs, no local run involved.
the BOM test, plus Should pass when a group is excluded from all policies (auto-detected), Should pass when a user is excluded from all policies (auto-detected) and Should only check user-targeted policies when both Agent Identity …
The subtraction is clean: the baseline is four, #2795 removes exactly the one it is about, #2797 removes exactly the three it is about, and no other failure appears in any of the four runs. The BOM failure names the file in its own message — powershell/tests/functions/Invoke-MtPackGitHubRequest.Tests.ps1 — which is the file #2795 adds the mark to.
Two notes for whoever picks this up:
ubuntu-latest is the only leg that fails because it is the only one running with PESTER_COVERAGE, so it is the only one that executes the OS-independent tests. macOS and Windows are green on all four runs.
The Smoke_Error and Smoke_Failed lines in those logs are the self-test fixtures and are not failures of the suite; pester.ps1 counts four, and four is what the throw at its line 285 reports.
The totals differ per run (8743, 8756, 8760) because each branch adds its own tests; the failure counts are what matter.
Every open PR against main inherits these four, so the cost of leaving them is paid by every contributor's red check, not only ours.
Still REVIEW_REQUIRED with no reviewer assigned. Rather than repeat the arithmetic, here is what I measured across the whole repository today, 14 Nov, because it changes what this PR is worth.
Every open PR that actually runs the suite on Ubuntu is red. All of them.
Of the 45 open non-draft PRs:
state of build-validation (ubuntu-latest)
count
red
28
green, but dorny/paths-filter skipped Pester entirely
2
green, Pester really ran — all completed 8–10 Nov
7
no such check recorded
8
The two green ones from today, #2808 and #2809, touch only website/contributors/contributors.yml; their Run Pester tests step is skipped, so the green says nothing about the suite. Since 11 Nov there is not one open PR where Pester ran on Ubuntu and passed — the most recent is #2782 at 2026-11-10T16:15:39Z.
The counts, measured from the job logs rather than the check rollup:
So the red is the repository's, not the pull requests'. The consequence is the part I had not said before: a check that is red on every PR has stopped being a signal. A genuine regression arriving tomorrow lands as red-on-an-already-red PR and is indistinguishable from the four that are already there — including on the 20 PRs by other people, where the author has no reason to suspect the failure is not theirs.
This PR removes one of the four and #2797 removes the other three; together they take build-validation (ubuntu-latest) to zero, with the run links already in the thread above. They are independent of each other and neither changes product code — this one adds a byte order mark to a test file.
Happy to rebase, split, or re-measure anything on request.
@merill flagging this one because it is not confined to this pull request: main is red on the Linux leg and has been since #2792, and every branch that merges main inherits it.
Measured just now against the open pull requests: 32 of 56 show build-validation (ubuntu-latest) as a failure. windows-latest and macOS-latest are green on the same runs, and the Pester step really did run there — I checked the step conclusions rather than the rollup, so this is not a skipped job reporting success.
Four tests fail, and between two one-file pull requests they are all four accounted for:
Failure
Cause
Fix
File encoding — one tracked .ps1 without a byte order mark
Invoke-MtPackGitHubRequest.Tests.ps1 arrived without one in #2792
this PR, one byte
Three cases in Test-MtCaEmergencyAccessExists.Tests.ps1
In coverage mode every file goes to one Invoke-Pester call, so a test reading $config without assigning it resolves the runner's own PesterConfiguration instead of $null. Coverage is on only for Linux, which is why only that leg fails
The practical cost is that a contributor cannot tell their own breakage from the repository's. @julien-ly reached the same two diagnoses independently on #2794 while checking whether his branch had caused it, which is the time this is taking from people.
Both are small and neither touches a check. Merging them in either order turns the leg green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One byte.
FileEncoding.Tests.ps1requires every tracked PowerShell file to be UTF-8 with a byte order mark, andpowershell/tests/functions/Invoke-MtPackGitHubRequest.Tests.ps1arrived without one in #2792 (77f3bdc8). It is the only tracked.ps1file in the repository that is missing it.The effect is not limited to
main: the Linux leg ofbuild-validationfails there, and every pull request that mergesmaininherits the failure. I found it while working out why four of my own PRs went red onbuild-validation (ubuntu-latest)and only on that leg — the general tests, this one included, run on Linux only.Measured, on
mainat02a220b2and with this change:Both runs went through
powershell/tests/pester.ps1, so on the Pester the repository pins.Two other failures on that leg, which this does not fix
The same CI run reported four failures out of 8,760. One is the encoding test above. The other three are in
Test-MtCaEmergencyAccessExists.Tests.ps1, in the No emergency access config defined (auto-detection mode) block.Those pass on unmodified
mainwhen the file is run on its own — 20 of 20 here, through the same runner. So from the outside they look order- or environment-dependent rather than broken, and I would not want this PR to be read as fixing them. I have not isolated them; if they are known, ignore this paragraph, and if they are not, I am happy to go and find out what state is leaking between files, since a test that only fails in the full suite is the kind that gets ignored until it hides something real.Summary by CodeRabbit