fix(scripts): standardize timestamp in FrontmatterValidation.psm1 to use Get-StandardTimestamp#1285
Open
chaosdinosaur wants to merge 4 commits intomainfrom
Open
Conversation
…use Get-StandardTimestamp - Change ValidatedAt from [datetime] to [string] using Get-StandardTimestamp - Replace [datetime]::UtcNow with (Get-Date).ToUniversalTime() for StartedAt and CompletedAt to preserve Duration arithmetic - Add Timestamp field to ToHashtable() for JSON output consistency - Import CIHelpers.psm1 for Get-StandardTimestamp access - Update Pester tests for new string type and Timestamp field Fixes #1001
Contributor
There was a problem hiding this comment.
Review Summary
This PR correctly addresses issue #1001 — the implementation is well-reasoned, the approach to preserving [datetime] typing for StartedAt/CompletedAt (required for Duration arithmetic) while using Get-StandardTimestamp for the string-typed ValidatedAt is sound, and the test updates are thorough. One naming consistency issue found.
Issue Alignment ✅
The PR directly and completely addresses issue #1001:
- All three
[datetime]::UtcNowusages are replaced. CIHelpers.psm1is imported.ValidatedAttype changed from[datetime]to[string].Timestampfield added toToHashtable().- Pester tests updated for the new string format.
PR Template Compliance ✅
- Description is clear and specific.
Fixes #1001is present.- "Bug fix" and "Script/automation" checkboxes are correctly checked.
- Testing section is detailed.
- Checklist items are appropriately checked.
Coding Standards ✅ (one minor finding)
See inline comment on FrontmatterValidation.psm1 line 197.
Code Quality ✅
- The
Import-Moduleat module scope follows the established pattern from other.psm1files in the repo. - Using
(Get-Date).ToUniversalTime()forStartedAt/CompletedAtpreserves the[datetime]type required for$this.Duration = $this.CompletedAt - $this.StartedAtarithmetic — correct design decision. Get-StandardTimestampreturns(Get-Date).ToUniversalTime().ToString('o')which matches the regex assertion^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z$in the tests — format validation is accurate.- No security concerns.
Action Required
One change needed (inline comment above):
- Rename
Timestamp→timestampinToHashtable()(line 197 ofFrontmatterValidation.psm1) and update the matching test assertions inFrontmatterValidation.Tests.ps1(lines 355–356) to keep JSON key casing consistent with all other keys in the hashtable.
…ency Rename the ToHashtable() key from PascalCase 'Timestamp' to camelCase 'timestamp' to match all other keys in the hashtable (totalFiles, filesWithErrors, filesWithWarnings, etc.). Update Pester assertions.
…nflict - Remove -Force flag from Import-Module CIHelpers in FrontmatterValidation.psm1 - Fixes 7 test failures in Validate-MarkdownFrontmatter.Tests.ps1 where Write-CIAnnotations, Test-CIEnvironment, and Set-CIEnv became unresolvable 🐛 - Generated by Copilot
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1285 +/- ##
==========================================
- Coverage 87.72% 87.71% -0.01%
==========================================
Files 61 61
Lines 9320 9322 +2
==========================================
+ Hits 8176 8177 +1
- Misses 1144 1145 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
auyidi1
approved these changes
Apr 3, 2026
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
Standardized timestamps in
FrontmatterValidation.psm1to useGet-StandardTimestampfromCIHelpers.psm1:ValidatedAtproperty from[datetime]to[string], now set viaGet-StandardTimestampproducing ISO 8601 UTC strings ending inZ.[datetime]::UtcNowwith(Get-Date).ToUniversalTime()forStartedAtandCompletedAtto preserveDurationarithmetic while using the same UTC source asGet-StandardTimestamp.Timestamp = Get-StandardTimestamptoValidationSummary.ToHashtable()so the JSON output includes a standardized timestamp consistent with all other lint result files.Import-ModuleforCIHelpers.psm1at module scope.Related Issue(s)
Fixes #1001
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
[datetime]::UtcNowreplaced withGet-StandardTimestampforValidatedAt(type changed from[datetime]to[string]).StartedAt/CompletedAtuse(Get-Date).ToUniversalTime()preservingDurationarithmetic.Timestampfield added toToHashtable()usingGet-StandardTimestamp.ValidatedAtto assert ISO 8601 UTC format instead of DateTime range comparison.Timestampkey inToHashtable()output.npm run lint:pspassed.npm run test:pspassed (129 tests for this file).Checklist
Required Checks
Required 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:generateSecurity Considerations
Additional Notes
This is the most complex issue in the timestamp standardization series (#994-#1002) because
FrontmatterValidation.psm1uses[datetime]typed class properties for arithmetic (Duration computation). The fix preserves[datetime]typing forStartedAt/CompletedAtto maintain Duration arithmetic, while changingValidatedAtto a[string]type withGet-StandardTimestamp. ATimestampfield was added toToHashtable()to ensure JSON output includes a standardized UTC timestamp consistent with all other lint result files.The prerequisite
Get-StandardTimestampfunction was merged in #993.