Skip to content

Standardize timestamp in Invoke-YamlLint.ps1 to use Get-StandardTimestamp #994

@WilliamBerryiii

Description

@WilliamBerryiii

Summary

Invoke-YamlLint.ps1 uses Get-Date -Format "o" which produces a local-offset timestamp instead of UTC. Replace with Get-StandardTimestamp from CIHelpers.psm1 for consistent ISO 8601 UTC timestamps across all log outputs.

Current Behavior

The script generates timestamps using Get-Date -Format "o", which includes the local timezone offset (e.g., 2025-01-15T10:30:00.0000000-08:00). This makes cross-script timestamp correlation unreliable when scripts run in different timezone contexts.

Expected Behavior

The script uses Get-StandardTimestamp from CIHelpers.psm1, producing UTC timestamps ending in Z (e.g., 2025-01-15T18:30:00.0000000Z).

Root Cause

The script was developed independently and chose its own timestamp format before a shared utility existed.

Files Requiring Changes

File Change
scripts/linting/Invoke-YamlLint.ps1 Replace Get-Date -Format "o" 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 all Get-Date -Format "o" usage and replace with Get-StandardTimestamp.
  3. Ensure CIHelpers.psm1 is imported (add import if not present).
  4. Update any Pester tests that assert on timestamp 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 Invoke-YamlLint.ps1. Investigate: (1) Read the target script and find all timestamp usages (exact line numbers). (2) Verify Get-StandardTimestamp is available in CIHelpers.psm1 (from Issue #993). (3) Determine whether the script already imports CIHelpers.psm1 or needs an import added. (4) Check existing Pester tests for timestamp-related assertions that may need updating. (5) Identify any callers that depend on the current timestamp format. (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 Invoke-YamlLint.ps1 using the research document. The plan should cover: (1) Replacing all timestamp expressions with Get-StandardTimestamp calls. (2) Importing CIHelpers.psm1 if not already imported. (3) Updating Pester tests to verify the new timestamp format. (4) 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 Invoke-YamlLint.ps1 following the plan. Steps: (1) Replace Get-Date -Format "o" with Get-StandardTimestamp at the identified line numbers. (2) Add CIHelpers.psm1 import if needed. (3) Update Pester test assertions for timestamp format. (4) Run npm run lint:ps and npm run test:ps. (5) Run the script's npm command and verify the JSON output contains a standardized UTC ISO 8601 timestamp.

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 Invoke-YamlLint.ps1. Verify: (1) All local timestamp expressions are replaced with Get-StandardTimestamp. (2) CIHelpers.psm1 is imported if it wasn't already. (3) JSON output timestamp is ISO 8601 UTC ending in Z. (4) No other logic was changed. (5) Pester tests updated and passing. (6) 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