Skip to content

Standardize timestamp in FrontmatterValidation.psm1 to use Get-StandardTimestamp #1001

@WilliamBerryiii

Description

@WilliamBerryiii

Summary

FrontmatterValidation.psm1 uses [datetime]::UtcNow (raw .NET) to generate timestamps. This produces a DateTime object rather than a formatted string, and is inconsistent with the shared utility pattern. Replace with Get-StandardTimestamp from CIHelpers.psm1 for consistent ISO 8601 UTC string timestamps across all log outputs.

Current Behavior

The module generates timestamps using [datetime]::UtcNow, which produces a raw .NET DateTime object. When serialized to JSON, the format depends on PowerShell's default serialization behavior, which may not match ISO 8601 "o" format used by other scripts.

Expected Behavior

The module uses Get-StandardTimestamp from CIHelpers.psm1, producing a pre-formatted ISO 8601 UTC string ending in Z.

Root Cause

The module was developed independently and used a raw .NET method rather than a PowerShell formatting approach. This predates the shared timestamp utility.

Files Requiring Changes

File Change
scripts/linting/Modules/FrontmatterValidation.psm1 Replace [datetime]::UtcNow with Get-StandardTimestamp
Corresponding Pester test file Update timestamp-related assertions

Fix Guidance

  1. Verify Get-StandardTimestamp is available (requires Issue Add Get-StandardTimestamp utility to CIHelpers module #993 merged first).
  2. Find [datetime]::UtcNow usage and replace with Get-StandardTimestamp.
  3. Ensure CIHelpers.psm1 is imported (add import if not present).
  4. Note: this changes the type from DateTime to String — verify that downstream usage handles this (JSON serialization should produce the same or better result).
  5. Update any Pester tests that assert on timestamp type or format.

Depends on: #993 (Get-StandardTimestamp utility)

RPI Framework Starter Prompts

Phase 1: Research

Select Task Researcher from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:

Research timestamp standardization in FrontmatterValidation.psm1. Investigate: (1) Read the target module and find all [datetime]::UtcNow usages (exact line numbers). (2) Verify Get-StandardTimestamp is available in CIHelpers.psm1 (from Issue #993). (3) Determine whether the module already imports CIHelpers.psm1 or needs an import added. (4) Trace how the timestamp is used downstream — is it assigned to a hashtable property that gets serialized to JSON? Does anything depend on it being a DateTime object? (5) Check existing Pester tests for timestamp-related assertions that may need updating. (6) Review codecov.yml patch coverage requirements.

Phase 2: Plan

Select Task Planner from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:

Plan timestamp standardization for FrontmatterValidation.psm1 using the research document. The plan should cover: (1) Replacing [datetime]::UtcNow with Get-StandardTimestamp call (noting the type change from DateTime to String). (2) Importing CIHelpers.psm1 if not already imported. (3) Verifying downstream consumers handle the String type correctly. (4) Updating Pester tests to verify the new ISO 8601 UTC string format. (5) Validation: npm run test:ps, npm run lint:ps.

Phase 3: Implement

Select Task Implementor from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:

Implement timestamp standardization for FrontmatterValidation.psm1 following the plan. Steps: (1) Replace [datetime]::UtcNow with Get-StandardTimestamp at the identified line numbers. (2) Add CIHelpers.psm1 import if needed. (3) Update Pester test assertions for timestamp format (now a string, not DateTime). (4) Run npm run lint:ps and npm run test:ps. (5) Run npm run lint:frontmatter and verify the JSON output contains a standardized UTC ISO 8601 timestamp string.

Phase 4: Review

Select Task Reviewer from the agent picker at the bottom of the GitHub Copilot Chat prompt pane, then send the following prompt:

Review timestamp standardization for FrontmatterValidation.psm1. Verify: (1) [datetime]::UtcNow is replaced with Get-StandardTimestamp. (2) CIHelpers.psm1 is imported if it wasn't already. (3) The type change from DateTime to String does not break downstream consumers. (4) JSON output timestamp is ISO 8601 UTC ending in Z. (5) No other logic was changed. (6) Pester tests updated and passing. (7) npm run lint:ps clean.

References

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomerslintingLinting rules and validationscriptsPowerShell, Bash, or Python scripts

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions