fix(ci-versioning): stop misdiagnosing an empty subject set as a missing step - #17
Merged
Merged
Conversation
…ing step The subject list was written by piping an array into Set-Content. An empty pipeline never invokes Set-Content's process block, so no file is created (measured), and the guard downstream reports "the step that collects this repository's build output did not run" for a step that ran and produced nothing. Two different states arrive at the reader as one. Write with -Value instead, so the file exists whenever the step ran. Absence now means the step genuinely did not run, and the guard's existing "staged no assemblies" branch becomes reachable for the case it describes. Also correct both messages. The missing-file message now says it is a fault in the check rather than in the repository under test. The empty-set message names where to look: BHoM/Versioning_Toolkit's two projects stage to C:\ProgramData\BHoM\Upgrades\BHoMUpgrades\ and C:\ProgramData\BHoM\Developer\Versioning while Get-AssemblyStamp scans C:\ProgramData\BHoM\Assemblies only, so the answer was in two .csproj PostBuildEvent entries and the old message pointed at CI plumbing. Observed on BHoM/Versioning_Toolkit PR #348, run 33619426914: build succeeded, collect step ran, check reported that it had not. Behaviour otherwise unchanged. Whether a repository that stages nothing type-bearing should fail or skip, and which layer decides given RunCommand.cs warns-and-continues while this action exits 1, are open and tracked separately. Pester case added and verified by mutation: reverting to the pipe form fails 'writes the subject list unconditionally'. Local suite 72 passed, with the same 15 pre-existing environment failures as clean develop.
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.
What
The subject list is written with
Set-Content -Valueinstead of a pipe, so the file exists whenever the collecting step ran. Both guard messages corrected.Behaviour is otherwise unchanged: a repository that stages nothing still fails. It now fails with the right diagnosis.
Why
$subject | Set-Content -Path 'subject-assemblies.txt'writes nothing when$subjectis empty. An empty pipeline never invokesSet-Content's process block, so the file is not created (measured:Test-PathFalse for@(), True for two items). The guard downstream then takes its first branch:The step had run. So had the build. The guard's second branch describes the real state correctly and could never be reached, because the only way to reach it was a file that is never written in that state.
Observed on
BHoM/Versioning_ToolkitPR #348, run33619426914:build_subjectconclusionsuccess,Staged before subject build: 110 assembl(ies),Collect subject assembliesexecuted, and the check reported that it had not.Root cause of the empty set, for the record
Versioning_Toolkit.slncontains two projects and neither stages into the directory the collector scans:BHoMUpgradesC:\ProgramData\BHoM\Upgrades\BHoMUpgrades\PostBuildC:\ProgramData\BHoM\Developer\VersioningGet-StagedAssemblies.ps1'sGet-AssemblyStampscansC:\ProgramData\BHoM\Assembliesonly. So the subject set is correctly empty and always will be for this repository. The old message sent the reader to CI plumbing; the answer was in two.csprojPostBuildEvententries.Deliberately not in scope
Two decisions are open and are not settled here:
RunCommand.cshandles an empty subject namespace set by warning and continuing — commenting that "some repos legitimately emit nothing that declares a type, so failing them would be a false block" — while this action escalates the same condition toexit 1.Both are tracked separately. This PR only makes the failure say something true, which is a prerequisite for deciding either.
Verification
New Pester case
writes the subject list unconditionally, so absent and empty stay distinguishable, asserted on the-Valueform because the file is text under test rather than an executed script. Verified by mutation: reverting the collect step to the pipe form fails exactly that case and nothing else.Local
ci-versioning-action.Tests.ps1: 10 passed, 0 failed. Full.github/scripts/testssuite: 72 passed, 15 failed, against cleandevelop's 71 passed, 15 failed. Same 15 either way; they are local Windows PowerShell 5.1 failures in the resolve-dependencies ref-marker tests and do not occur on the pwsh 7 CI runner.Independent of #16 and touches non-adjacent regions of the same file, so the two can merge in either order.