refactor(scripts): refactor dev-tools and lib scripts to use CIHelpers module#482
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #482 +/- ##
==========================================
- Coverage 85.34% 85.34% -0.01%
==========================================
Files 23 23
Lines 4476 4475 -1
==========================================
- Hits 3820 3819 -1
Misses 656 656
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR refactors three utility scripts to use the shared CIHelpers module, replacing inline CI annotation patterns with standardized CIHelpers function calls. The changes include updating Test-ActionVersionConsistency.ps1 to use Write-CIAnnotation instead of raw ::error:: output, and adding test coverage for error propagation in Generate-PrReference.ps1 and Get-VerifiedDownload.ps1.
Changes:
- Replaced inline
$env:GITHUB_ACTIONSchecks and::error::output withWrite-CIAnnotationcalls in Test-ActionVersionConsistency.ps1 - Added CIHelpers module imports and cleanup to test files for Generate-PrReference.ps1 and Get-VerifiedDownload.ps1
- Added error propagation tests to verify error handling paths
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| scripts/tests/lib/Get-VerifiedDownload.Tests.ps1 | Adds CIHelpers import/cleanup and error propagation test, plus CIHelpers function mocks |
| scripts/tests/dev-tools/Generate-PrReference.Tests.ps1 | Adds CIHelpers import/cleanup and error propagation test, plus CIHelpers function mocks |
| scripts/security/Test-ActionVersionConsistency.ps1 | Replaces inline CI pattern with Write-CIAnnotation in catch block |
|
@copilot open a new pull request to apply changes based on the comments in this thread |
…est cleanup - Replace inline $env:GITHUB_ACTIONS check and ::error:: output with Write-CIAnnotation in Test-ActionVersionConsistency.ps1 - Standardize entry point guard to $script:SkipMain pattern - Add CIHelpers module cleanup in AfterAll for Generate-PrReference and Get-VerifiedDownload test files 🔧 - Generated by Copilot
e3c2e5d to
e8642ba
Compare
|
Thank you for this contribution, @chaosdinosaur! 🎉 Your refactoring of the dev-tools and lib scripts to use the CIHelpers module — along with the added test coverage for error propagation and CI annotation handling — cleans up the codebase and makes it more consistent. We appreciate the effort you put into this. |
…ttern - extract Invoke-ActionVersionConsistency function with full param block - replace HVE_SKIP_MAIN env var with MyInvocation.InvocationName guard - add Remove-Module CIHelpers cleanup to test AfterAll block 🔧 - Generated by Copilot
- pipe Export-ConsistencyReport to Out-Host inside Invoke-ActionVersionConsistency - prevents Write-Output json from contaminating function return value 🐛 - Generated by Copilot
…ency 🔧 - Generated by Copilot
|
@agreaves-ms or @katriendg ... can you do a quick review of this because I made some small changes on the cleanup for the tests. |
katriendg
left a comment
There was a problem hiding this comment.
The changes themselves look OK to me, though I believe the PR description is no longer accurate. Maybe this is due to changes having happened and merged from main, but it was a bit confusing to try and see what has been changed...
There are no new calls to CIHelpers as far as I can see, or added tests and mocking to test files which I don't really see?
Probably best to rebuild the PR description to match.
Thanks a lot in any case and sorry if our fast changes are making it harder for you :)
katriendg
left a comment
There was a problem hiding this comment.
And I meant to approve...
|
Addressing the two remaining unresolved review threads: 1. Attribute ordering (
|
| Metric | Value |
|---|---|
| Overall coverage | 82.47% (207/251 commands hit) |
| Threshold | 75% |
| Tests | 47/47 passing |
Invoke-ActionVersionConsistency (lines 380–414) shows 34 missed commands in the Pester in-process coverage report. This is expected because the Main Script Execution tests invoke the script via pwsh -NoProfile -Command subprocesses, which Pester's coverage instrumentation cannot track across process boundaries. Those 9 subprocess tests exercise all code paths in the function — exit codes for version mismatches, missing version comments, FailOnMismatch, FailOnMissingComment, and the success path.
The function is fully tested through the existing Main Script Execution test suite; the apparent gap is a Pester coverage tracking limitation, not a testing gap.
🤖 I have created a release *beep* *boop* --- ## [2.3.0](hve-core-v2.2.0...hve-core-v2.3.0) (2026-02-13) ### ✨ Features * **agents:** add GitHub backlog management pipeline ([#448](#448)) ([2b4d123](2b4d123)) * **docs:** define inactivity closure policies for issues and PRs ([#452](#452)) ([5e710fd](5e710fd)) * **extension:** implement collection-based plugin distribution system ([#439](#439)) ([3156d98](3156d98)) * **instructions:** replace EVEN/ODD hardcoding with runtime milestone discovery protocol ([#486](#486)) ([ae95eb2](ae95eb2)) * **plugin:** support Copilot CLI plugin generation from collection manifests ([#496](#496)) ([e6cee85](e6cee85)) * **scripts:** enhance on-create.sh to install actionlint and PowerShell modules ([#500](#500)) ([67585f5](67585f5)) ### 🐛 Bug Fixes * **docs:** replace broken relative link with inline code reference ([#465](#465)) ([8133b36](8133b36)) * **instructions:** prevent local-only paths from leaking into GitHub issues ([#489](#489)) ([497d2fe](497d2fe)) * **workflows:** prevent release-please infinite loop on main branch ([#470](#470)) ([134bdd6](134bdd6)) * **workflows:** remove release-please skip guard that prevents tag creation ([#511](#511)) ([5e53271](5e53271)) ### 📚 Documentation * **agents:** add GitHub Backlog Manager documentation and agent catalog ([#503](#503)) ([5e818ce](5e818ce)) * align CONTRIBUTING.md with docs/contributing/ guides ([#445](#445)) ([73ef6aa](73ef6aa)) ### ♻️ Refactoring * **scripts:** refactor dev-tools and lib scripts to use CIHelpers module ([#482](#482)) ([fdf9145](fdf9145)) * **scripts:** standardize PowerShell entry point guard pattern ([#477](#477)) ([6b84a8e](6b84a8e)) ### 🔧 Maintenance * **config:** standardize action mappings in artifact-retention.yml ([#487](#487)) ([7927db2](7927db2)) * **deps-dev:** bump cspell from 9.6.2 to 9.6.4 in the npm-dependencies group ([#461](#461)) ([c788095](c788095)) * **deps:** bump actions/setup-python from 5.1.1 to 6.2.0 in the github-actions group ([#462](#462)) ([69ef3c9](69ef3c9)) * **security:** add SBOM artifact retention policy ([#479](#479)) ([8031557](8031557)), closes [#453](#453) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: hve-core-release-please[bot] <254602402+hve-core-release-please[bot]@users.noreply.github.com>
Pull Request
Description
Add CIHelpers module import, mocking, and cleanup to test files for Generate-PrReference.ps1 and Get-VerifiedDownload.ps1. Add error propagation tests verifying CI annotation handling paths.
Replace remaining inline $env:GITHUB_ACTIONS check and raw ::error:: output in Test-ActionVersionConsistency.ps1 catch block with Write-CIAnnotation.
Related Issue(s)
Fixes #352
Type of Change
Select all that apply:
Code & Documentation:
Infrastructure & Configuration:
AI Artifacts:
prompt-builderagent and addressed all feedback.github/instructions/*.instructions.md).github/prompts/*.prompt.md).github/agents/*.agent.md).github/skills/*/SKILL.md)Other:
.ps1,.sh,.py)Sample Prompts (for AI Artifact Contributions)
User Request:
Execution Flow:
Output Artifacts:
Success Indicators:
For detailed contribution requirements, see:
Testing
Checklist
Required Checks
AI Artifact Contributions
/prompt-analyzeto review contributionprompt-builderreviewRequired Automated Checks
The following validation commands must pass before merging:
npm run lint:mdnpm run spell-checknpm run lint:frontmatternpm run lint:md-linksnpm run lint:psSecurity Considerations
Additional Notes