Skip to content

fix(scripts): standardize timestamp in Markdown-Link-Check.ps1 to use Get-StandardTimestamp#1283

Open
chaosdinosaur wants to merge 3 commits intomainfrom
fix/999-standardize-timestamp-markdown-link-check
Open

fix(scripts): standardize timestamp in Markdown-Link-Check.ps1 to use Get-StandardTimestamp#1283
chaosdinosaur wants to merge 3 commits intomainfrom
fix/999-standardize-timestamp-markdown-link-check

Conversation

@chaosdinosaur
Copy link
Copy Markdown
Collaborator

Pull Request

Description

Replaced (Get-Date).ToUniversalTime().ToString('o') (duplicated UTC expression) in Markdown-Link-Check.ps1 with Get-StandardTimestamp from CIHelpers.psm1. The script already imports CIHelpers.psm1 at line 51, so no additional import was needed. This centralizes timestamp generation through the shared utility.

Added a Pester test that verifies the script source uses Get-StandardTimestamp and no longer contains the raw ToUniversalTime() expression.

Related Issue(s)

Fixes #999

Type of Change

Select all that apply:

Code & Documentation:

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update

Infrastructure & Configuration:

  • GitHub Actions workflow
  • Linting configuration (markdown, PowerShell, etc.)
  • Security configuration
  • DevContainer configuration
  • Dependency update

AI Artifacts:

  • Reviewed contribution with prompt-builder agent and addressed all feedback
  • Copilot instructions (.github/instructions/*.instructions.md)
  • Copilot prompt (.github/prompts/*.prompt.md)
  • Copilot agent (.github/agents/*.agent.md)
  • Copilot skill (.github/skills/*/SKILL.md)

Other:

  • Script/automation (.ps1, .sh, .py)
  • Other (please describe):

Testing

  • Verified (Get-Date).ToUniversalTime().ToString('o') replaced with Get-StandardTimestamp at line 322.
  • Added Pester test verifying the source code uses Get-StandardTimestamp and no ToUniversalTime expressions remain.
  • npm run lint:ps passed.
  • npm run test:ps passed (18 tests for this file).

Checklist

Required Checks

  • Documentation is updated (if applicable) (N/A — no docs change needed)
  • Files follow existing naming conventions
  • Changes are backwards compatible (if applicable)
  • Tests added for new functionality (if applicable)

Required Automated Checks

The following validation commands must pass before merging:

  • Markdown linting: npm run lint:md
  • Spell checking: npm run spell-check
  • Frontmatter validation: npm run lint:frontmatter
  • Skill structure validation: npm run validate:skills
  • Link validation: npm run lint:md-links
  • PowerShell analysis: npm run lint:ps
  • Plugin freshness: npm run plugin:generate

Security Considerations

  • This PR does not contain any sensitive or NDA information
  • Any new dependencies have been reviewed for security issues (N/A — no dependency changes)
  • Security-related scripts follow the principle of least privilege (N/A — no privilege changes)

Additional Notes

This is part of the timestamp standardization series (issues #994-#1002). The prerequisite Get-StandardTimestamp function was merged in #993. CIHelpers.psm1 was already imported by this script, so the change is a direct expression swap with no import changes required.

… Get-StandardTimestamp

Replace (Get-Date).ToUniversalTime().ToString("o") with
Get-StandardTimestamp from CIHelpers.psm1 for centralized timestamp
management. Add Pester test verifying the standardized call.

Fixes #999
@chaosdinosaur chaosdinosaur requested a review from a team as a code owner April 2, 2026 20:57
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.61%. Comparing base (84ddd5d) to head (85b18a4).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1283      +/-   ##
==========================================
- Coverage   87.72%   87.61%   -0.11%     
==========================================
  Files          61       61              
  Lines        9320     9320              
==========================================
- Hits         8176     8166      -10     
- Misses       1144     1154      +10     
Flag Coverage Δ
pester 85.16% <100.00%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scripts/linting/Markdown-Link-Check.ps1 57.51% <100.00%> (-5.89%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary

This is a small, focused PR that correctly addresses issue #999. All checks pass — no blocking issues found.


✅ Issue Alignment

The changes directly implement what issue #999 requests:

  • scripts/linting/Markdown-Link-Check.ps1 line 322: (Get-Date).ToUniversalTime().ToString('o')Get-StandardTimestamp
  • CIHelpers.psm1 was already imported at line 51 — no additional import needed ✅
  • A Pester test was added to guard against regression ✅
  • No scope creep; all issue requirements covered ✅

✅ PR Template Compliance

Section Status
Description ✅ Clear and accurate
Related Issue Fixes #999
Type of Change ✅ Bug fix + Script/automation — both correct for .ps1 changes
AI Artifact section ✅ Correctly omitted (no AI artifact files changed)
Testing ✅ Describes manual verification + automated test results
Checklist ✅ All items addressed with appropriate N/A annotations
Security ✅ First item checked; others correctly marked N/A

✅ Coding Standards

Markdown-Link-Check.ps1 — follows powershell-script.instructions.md:

  • Single-expression substitution using the centralized shared utility ✅
  • Module already imported; no import changes required ✅

Markdown-Link-Check.Tests.ps1 — follows pester-testing.instructions.md:

  • New Context 'Timestamp standardization' added inside the existing Describe 'Invoke-MarkdownLinkCheck' -Tag 'Unit' block ✅
  • It name is descriptive and behavior-oriented ✅
  • Two assertions are complementary (positive existence check + negative absence check for the same behavioral property) — explicitly permitted by Pester conventions ✅
  • $PSScriptRoot used for path resolution, consistent with the mirror directory pattern ✅

💡 Informational note on test approach: The test inspects source code text rather than exercising runtime behavior. This is intentional and consistent with the timestamp-standardization series (#994#1002) — it functions as a regression guard to ensure the raw ToUniversalTime() expression is never reintroduced. No change requested; just noting the pattern for reviewer awareness.


✅ Code Quality and Security

  • Change is minimal and isolated to the timestamp expression ✅
  • Get-StandardTimestamp (from merged #993) produces the same ISO 8601 UTC format ✅
  • No security implications ✅
  • No breaking changes — callers receive the same timestamp format ✅
  • No performance concerns ✅

This PR meets initial quality standards. ✅

Generated by PR Review for issue #1283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize timestamp in Markdown-Link-Check.ps1 to use Get-StandardTimestamp

3 participants