Repository navigation
fix(ci): the PowerShell gate arrives with its sweep, 51 findings to zero - #973
Merged
Merged
Conversation
The plan for #964, committed before the work, and the #721 charter's retired status word with it. ci.yaml runs make vet-all, star lint go, make lint-all and star lint shell. It never runs star lint all, markdown, go-style or copyright, and it has no PowerShell step although install.ps1 ships to users. make check runs none of them. The count is 51, not the 33 the issue states. Measured with Test-PowerShell.ps1, the gate CI would actually run rather than PSScriptAnalyzer alone: 30 PSAvoidUsingWriteHost, 9 missing [CmdletBinding()], 4 missing param(), 3 missing shebang, 2 script-level param(), and one each of PSReviewUnusedParameter, PSUseBOMForUnicodeEncodedFile and PSUseSingularNouns. Four of those checks are the gate's own and account for 18 of the 51. Three pull requests, one plan, because the pieces have different blockers. The PowerShell gate and install.ps1 go first: devlore-cli#949's lanes 11 and 21 both edit install.ps1 and are held for it. Starlark is not buildifier's to cover. Ruled 2026-09-28: buildifier is being replaced, and #721 is the replacement. Every defect that shipped in the docker package was syntactically valid Starlark that buildifier parses without complaint. Markdown is measured and the answer is that there is no policy to measure against: 36,857 findings over 464 files, 25,318 of them line-length, against markdownlint's defaults, because no configuration exists anywhere. Phase 3 writes one in the base layer. lint-starlark.md restated its status in the body as `charter`, which is not one of the five and was retired by noblefactor-ops#219. A status in two places is a second copy that drifts, so the body no longer carries one.
install.ps1 ships to users and was checked by nothing, while noblefactor-ops has had this gate since its #218 and personal since its #216. Phase 2 of #964. The gate runs as three steps of quality-gate, not as a job of its own. This repository's ruleset requires exactly one check, quality-gate, so a separate job could not block a merge whatever it reported -- which ci.yaml already says of the test job beside it: "A gate nobody has watched refuse anything is a claim, not a gate." personal#216 could use a separate job because that repository's ruleset admits one. Test-PowerShell.ps1 and PSScriptAnalyzerSettings.psd1 are the organization's, so the script runs out of a pinned .base checkout rather than being copied here, and the rule set cannot drift between the three repositories. install.ps1, 47 findings: - 30 Write-Host calls go to the stream PowerShell already has for each level: Write-Information for progress, Write-Warning for warnings, Write-Error for failures. Write-Host went to none of them and cannot be captured, so a user whose install failed could not pipe the run to a file or paste a log -- which for an installer run under irm | iex is exactly when a log matters. Separate streams also let a caller silence warnings and keep progress, which one stream carrying text prefixes cannot offer. - Write-Fatal keeps its exit 1 and uses -ErrorAction Continue to do so. The script sets $ErrorActionPreference = Stop, under which a bare Write-Error throws and the exit never runs -- which would change how the installer terminates, and that is #965, another lane's work. This commit puts the message on the error stream and leaves the exit path as it found it. - The color is not replaced. $PSStyle is 7.2 and later and this script must run on Windows PowerShell 5.1, what a fresh Windows machine has (#948). Write-Warning and Write-Error label their own output, so info: and success: are the only prefixes left. - Nine functions gain [CmdletBinding()], four gain param(), and three gain [OutputType] because promoting a function to advanced brings PSUseOutputTypeCorrectly with it. - Get-ApiHeaders becomes Get-ApiHeader, with its call sites. - An em dash in a comment goes rather than the byte-order mark PSUseBOMForUnicodeEncodedFile would otherwise want, which #209 forbids. - Prefix is suppressed, not deleted. It is read by Main -- defaulted to ~/.local, made the bin directory, passed to self install -- across a dynamic-scope boundary the analyzer cannot see. Deleting it would silently drop a documented flag. The two .ps1 test fixtures are fixed rather than excluded. Ruled 2026-09-28: everything is linted, always, no exception without a compelling argument. Both keep doing their job -- the layer-journey and migrate suites pass unchanged. The gate reports 3 checked, 0 with findings.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Phase 2 of #964. Does not close it -- phases 3 and 4 are lanes 9 and 10 of
noblefactor-ops#232 and land separately.
install.ps1ships to users and was checked by nothing, while noblefactor-ops has had this gate sinceits #218 and personal since its #216. 51 findings to zero.
The count was 51, not 33
The issue says
install.ps1carries 33 findings. That was PSScriptAnalyzer's half. Measured withTest-PowerShell.ps1, the gate CI actually runs:PSAvoidUsingWriteHost[CmdletBinding()]param()block#!/usr/bin/env pwshparam()blockPSReviewUnusedParameter,PSUseBOMForUnicodeEncodedFile,PSUseSingularNounsThe gate's four own checks are 18 of the 51. Measuring a gate with a different tool than the one that
will run it is how it turns out to cost more than it was scoped for.
The gate is three steps of
quality-gate, not a job of its ownThe plan said "a PowerShell job on
ubuntu-latest, modeled on noblefactor-ops's." That was wrong forthis repository, and the plan records the correction rather than rewording the box.
This repository's ruleset requires exactly one check,
quality-gate. A separate job could not blocka merge whatever it reported -- which
ci.yamlalready says of thetestjob beside it:personal#216 could use a separate job because that repository's ruleset admits one.
Test-PowerShell.ps1andPSScriptAnalyzerSettings.psd1are the organization's, so the script runs outof a pinned
.basecheckout rather than being copied here, and the rule set cannot drift between thethree repositories.
This run is the gate's own proof. CI has never linted PowerShell here. If the
.basearrangement orthe file discovery is wrong, it fails in this run rather than passing silently.
install.ps1The 30
Write-Hostcalls go to the streams PowerShell already has --Write-Informationforprogress,
Write-Warningfor warnings,Write-Errorfor failures.Write-Hostwent to none of themand cannot be captured, so a user whose install failed could not pipe the run to a file or paste a log,
which for an installer run under
irm | iexis exactly when a log matters. Separate streams also let acaller silence warnings and keep progress, which one stream carrying text prefixes cannot offer.
Write-Fatalkeeps itsexit 1, deliberately. The script sets$ErrorActionPreference = 'Stop',under which a bare
Write-Errorthrows and that exit never runs -- which would change how the installerterminates, and how it terminates is #965, another lane's work.
-ErrorAction Continueputs themessage on the error stream and leaves the exit path exactly as it found it.
The color is not replaced.
$PSStyleis PowerShell 7.2 and later, and this script must run onWindows PowerShell 5.1 -- what a fresh Windows machine has, which is why #948 landed it. ANSI is not
reliable there either.
Write-WarningandWrite-Errorlabel their own output, soinfo:andsuccess:are the only prefixes left.The rest: nine functions gain
[CmdletBinding()], four gainparam(), and three gain[OutputType]because promoting a function to advanced brings
PSUseOutputTypeCorrectlywith it.Get-ApiHeadersbecomes
Get-ApiHeaderwith its call sites. An em dash in a comment goes, rather than the byte-ordermark the rule would otherwise want and which #209 forbids.
-Prefixis suppressed, not deleted. It is read byMain-- defaulted to~/.local, made the bindirectory, passed to
self install-- across a dynamic-scope boundary the analyzer cannot see. Deletingit would have silently dropped a documented flag.
The two test fixtures are fixed, not excluded
Ruled 2026-09-28: everything is linted, always, no exception without a compelling argument. The
argument that a fixture represents content we do not control, and stops doing so in house style, was
weighed and is not compelling enough to cut a hole in the gate. Both keep doing their job -- the
layer-journey and migrate suites pass unchanged -- and the migrate fixture says in its own comment that
it stands for what a user migrates from.
What this unblocks
devlore-cli#949's lanes 11 and 21 -- #950 and #965 -- both edit
install.ps1and are held for thiswork. Its lane 13 waits on lane 11. Once this merges they are free, and
install.ps1is gated, sowhatever they add to it has to keep it clean.
Time
Computed by the algorithm of noblefactor-ops#188 at merge.