feat(scripts): add structured JSON log output to Validate-Collections.ps1#1431
Conversation
katriendg
left a comment
There was a problem hiding this comment.
Thank you for another one @MauroDruwel!
We have some changes requested to finetune a few things, looking very good overall.
Note here as well if you could update your PR description to match the PULL_REQUEST_TEMPLATE.md? Using the prompt is easiest.
82988c7 to
acf886c
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
acf886c to
be29d6f
Compare
|
All three review comments addressed @katriendg 😊:
Also rebased onto main (resolved conflicts in |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1431 +/- ##
==========================================
+ Coverage 87.41% 87.43% +0.02%
==========================================
Files 68 68
Lines 10302 10335 +33
==========================================
+ Hits 9005 9036 +31
- Misses 1297 1299 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
katriendg
left a comment
There was a problem hiding this comment.
Thank you so much @MauroDruwel. This is good for merging in!
Pull Request
Description
Validate-Collections.ps1was the only collections-facing linting script that did not write structured results tologs/. All other pipeline scripts persist JSON reports after each run; this gap meant collection validation results were lost at terminal close, blocking any tooling or CI step that reads fromlogs/.Changes made:
-OutputPathparameter toValidate-Collections.ps1(default:logs/collection-validation-results.json).$fileErrorsfrom plain strings to typed hashtables (ErrorType+Message), enabling specific error codes in JSON output:MissingRequiredField,InvalidIdFormat,DuplicateCollectionId,InvalidCollectionMaturity,RepoSpecificPath,PathNotFound,MissingSuffix,MissingItemKind,InvalidMaturity,IntraCollectionDuplicate.Add-ValidationResultthat accumulates a typed results list alongside every existingWrite-Hostcall (console output unchanged).Export-CollectionValidationReportfunction for path resolution, directory creation, and JSON serialization.Create logs directorystep inplugin-validation.ymlto beforeValidate collection metadatato make workflow intent explicit.ErrorTypeassertion to specific type, added severity differentiation, directory creation, multiple distinctErrorTypevalues in one run, and clean-runResultskey presence tests.Output schema:
{ "Timestamp": "2026-04-23T17:00:00.000Z", "TotalCollections": 14, "ErrorCount": 0, "Results": [ { "Collection": "hve-core", "Severity": "Warning", "ErrorType": "MissingCompanionCollectionMd", "Message": "missing companion 'hve-core.collection.md'" } ] }Related Issue(s)
Closes #992.
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)Testing
npm run lint:collections-metadatalogs/collection-validation-results.jsonnpm run lint:psnpm run test:ps -- -TestPath scripts/tests/collections/Baseline runs confirmed pre-existing test suite intact; post-change runs confirmed new tests pass and JSON file is created with correct schema.
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 validate:skillsnpm run lint:md-linksnpm run lint:psnpm run plugin:generatenpm run docs:testSecurity Considerations
Additional Notes
This PR was rebased on top of the main branch which includes #1430 (structured JSON output for
Validate-Marketplace.ps1). The merge conflict inpackage.jsonwas resolved by combining both-OutputPathflags:lint:collections-metadataandlint:marketplaceboth now pass their respective output paths.