From 71fed3e5632f17ddb84e2412fa6636f7e4ad9be8 Mon Sep 17 00:00:00 2001 From: TheAbider <51920546+TheAbider@users.noreply.github.com> Date: Wed, 12 Aug 2026 23:02:32 -0700 Subject: [PATCH] Guard the module count in Header.ps1's description A count audit across every documented surface found exactly three stale numbers, and all three sat outside what section 174 can reach: - the GitHub repo description advertised a 167-action toolkit against a live 201 (fixed via the API; repo metadata is not in the tree, so no test can ever see it) - the wiki said 189 available actions (separate repository, fixed there) - Header.ps1's .DESCRIPTION claimed 78 modules against a live 81 Every file section 174 does cover was correct, including the README's action, module and structural-test counts and the Pester badge, which was verified against a live count of exactly 312. The guard works; the rot appeared precisely where it does not look. Header.ps1 is worth adding because its preamble is the text that lands at the top of the generated monolithic and therefore inside the shipped EXE. The assertion is scoped to the text before the first .CHANGELOG. Everything after it is version history, where "64 modules, 1873 tests" is a true statement about v1.20.4 -- a whole-file check would demand falsifying the changelog to go green. A separate assertion fails loudly if that .CHANGELOG marker ever disappears, so losing the scope boundary cannot silently turn this into a false-positive machine. Mutation-verified three ways: a stale preamble count is caught, the historical entries are correctly left alone, and removing the scope marker fails rather than scanning history. Structural tests 5493 -> 5495. --- Header.ps1 | 2 +- README.md | 2 +- Tests/Run-Tests.ps1 | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Header.ps1 b/Header.ps1 index d2f4a39..add4b85 100644 --- a/Header.ps1 +++ b/Header.ps1 @@ -3,7 +3,7 @@ RackStack - All-in-one Windows Server setup utility (Monolithic Build). .DESCRIPTION - This is the MONOLITHIC BUILD -- all 78 modules combined into a single file. + This is the MONOLITHIC BUILD -- all 81 modules combined into a single file. Generated by sync-to-monolithic.ps1 from the modular source in Modules/. The .exe is compiled from this file via ps2exe. diff --git a/README.md b/README.md index 680db49..fcba1e0 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ OpenSSF Best Practices codecov PSScriptAnalyzer 0 errors - 5493 structural tests + 5495 structural tests Pester 312 tests SLSA Level 3

diff --git a/Tests/Run-Tests.ps1 b/Tests/Run-Tests.ps1 index ff9c59a..77d3ac5 100644 --- a/Tests/Run-Tests.ps1 +++ b/Tests/Run-Tests.ps1 @@ -10651,6 +10651,24 @@ try { # README test badge label is the specific 'structural tests' (distinct from the Pester badge). Write-TestResult "DocFreshness: README test badge uses a specific label" ($readmeRaw -match 'structural%20tests|structural tests') + + # Header.ps1's .DESCRIPTION states the module count, and it is the text that + # lands at the top of the shipped monolithic and therefore inside the EXE. + # It was NOT covered here and rotted to "all 78 modules" against a live 81. + # + # Scope matters: everything from the first .CHANGELOG onward is version + # history, where "64 modules, 1873 tests" is a true statement about v1.20.4. + # Asserting over the whole file would demand falsifying that history, so only + # the current-tense preamble is checked. + $headerRaw = Get-Content (Join-Path $script:ModuleRoot 'Header.ps1') -Raw + $firstChangelog = $headerRaw.IndexOf('.CHANGELOG') + $headerPreamble = if ($firstChangelog -gt 0) { $headerRaw.Substring(0, $firstChangelog) } else { $headerRaw } + Write-TestResult "DocFreshness: Header.ps1 preamble is separable from its changelog" ` + ($firstChangelog -gt 0) "no .CHANGELOG found — the check below would scan version history" + $hdrMod = @([regex]::Matches($headerPreamble, '(\d{2,4})\s+modules\b')) + $hdrStale = @($hdrMod | Where-Object { [int]$_.Groups[1].Value -ne $liveModuleCount }) + Write-TestResult "DocFreshness: Header.ps1 module count == $liveModuleCount" ` + ($hdrStale.Count -eq 0) $(if ($hdrStale.Count) { "stale: $(($hdrStale | ForEach-Object { $_.Value }) -join ', ')" } else { "" }) } catch { Write-TestResult "Documentation Freshness Tests" $false $_.Exception.Message