fix(scripts): centralize ISO 8601 timestamp regex in CIHelpers#1343
Open
MauroDruwel wants to merge 1 commit intomicrosoft:mainfrom
Open
fix(scripts): centralize ISO 8601 timestamp regex in CIHelpers#1343MauroDruwel wants to merge 1 commit intomicrosoft:mainfrom
MauroDruwel wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Pull Request
Description
Add
Get-StandardTimestampPatterntoCIHelpers.psm1returning the canonicalregex for validating
Get-StandardTimestampoutput. Replace all standalonehardcoded ISO 8601 timestamp patterns across five test files with calls to this
function, eliminating duplication and drift.
Three distinct regex variants had already emerged across the test suite:
\.\d+Z$\.\d{3,7}Z$.*Z$Z, defeats validation purposeThe new function returns a single source of truth so all assertions stay in sync
automatically if the timestamp format changes.
Relationship to #1314
This PR was born from the review discussion on #1314, filed separately as #1333.
timestamp→TimestampCIHelpers.psm1+ 5 test filesBoth PRs are needed — they address different layers of the same standardization
effort (#1003). #1314 fixes how timestamps are named in JSON output; this PR
fixes how timestamps are validated in tests. Neither blocks the other and they
can merge in any order without conflicts.
Related Issue(s)
Closes #1333
Type of Change
Code & Documentation:
Other:
.ps1,.sh,.py)Testing
(Get-StandardTimestampPattern)calls in 5 test filesCIHelpers.Tests.ps1:Get-StandardTimestampPatternreturns a non-empty stringGet-StandardTimestampoutput (cross-validation)CIHelpersmodule imports to 3 test files that lacked directaccess (
SecurityClasses,SecurityHelpers,FrontmatterValidation)Files Changed
Module (new function + export):
scripts/lib/Modules/CIHelpers.psm1—Get-StandardTimestampPatternfunction andExport-ModuleMemberentryTests (hardcoded regex → function call):
scripts/tests/lib/CIHelpers.Tests.ps1— replaced regex; addedDescribe 'Get-StandardTimestampPattern'blockscripts/tests/linting/FrontmatterValidation.Tests.ps1— replaced 2 regexes; added CIHelpers importscripts/tests/linting/Invoke-YamlLint.Tests.ps1— replaced 1 regex (already imported CIHelpers)scripts/tests/security/SecurityClasses.Tests.ps1— replaced 1 regex; added CIHelpers importscripts/tests/security/SecurityHelpers.Tests.ps1— replaced 1 regex; added CIHelpers importChecklist
Required Checks
Required Automated Checks
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