Skip to content

fix(scripts): standardize timestamp in Validate-SkillStructure.ps1 to use Get-StandardTimestamp#1280

Open
chaosdinosaur wants to merge 3 commits intomainfrom
fix/996-standardize-timestamp-skill-validation
Open

fix(scripts): standardize timestamp in Validate-SkillStructure.ps1 to use Get-StandardTimestamp#1280
chaosdinosaur wants to merge 3 commits intomainfrom
fix/996-standardize-timestamp-skill-validation

Conversation

@chaosdinosaur
Copy link
Copy Markdown
Collaborator

Pull Request

Description

Replaced Get-Date -Format 'o' (local-offset timestamp) in Validate-SkillStructure.ps1 with Get-StandardTimestamp from CIHelpers.psm1. The script already imports CIHelpers.psm1 at line 29, so no additional import was needed. This produces genuine UTC timestamps ending in Z instead of local-offset timestamps.

Added a format assertion to the existing Pester test verifying the timestamp field is a UTC ISO 8601 string ending in Z.

Related Issue(s)

Fixes #996

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 -Format 'o' replaced with Get-StandardTimestamp at line 478.
  • Added ISO 8601 UTC format assertion to existing Pester timestamp test.
  • npm run lint:ps passed.
  • npm run test:ps passed (75 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.

… use Get-StandardTimestamp

Replace Get-Date -Format "o" with Get-StandardTimestamp from CIHelpers.psm1
for consistent UTC ISO 8601 timestamps. Add format assertion to Pester test.

Fixes #996
@chaosdinosaur chaosdinosaur requested a review from a team as a code owner April 2, 2026 18:45
@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.71%. Comparing base (84ddd5d) to head (7398b15).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1280      +/-   ##
==========================================
- Coverage   87.72%   87.71%   -0.02%     
==========================================
  Files          61       61              
  Lines        9320     9320              
==========================================
- Hits         8176     8175       -1     
- Misses       1144     1145       +1     
Flag Coverage Δ
pester 85.31% <100.00%> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
scripts/linting/Validate-SkillStructure.ps1 94.46% <100.00%> (ø)

... 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.

Automated Quality Review

Overall, this is a clean, focused fix that correctly addresses issue #996. The main production change is a straightforward one-line swap and the PR description is thorough.


✅ Issue Alignment

PR fully addresses issue #996:

  • Replaces Get-Date -Format 'o' (local-offset) with Get-StandardTimestamp (UTC, ending in Z) in Validate-SkillStructure.ps1.
  • CIHelpers.psm1 was already imported — no additional import needed, as the PR notes.
  • A format assertion was added to the existing Pester test.

No scope creep or missing requirements detected.


✅ PR Template Compliance

All required sections are filled in accurately:

  • Description is clear and specific.
  • Fixes #996 is present.
  • Bug fix and Script/automation checkboxes are checked and match the diff.
  • Testing section documents the manual verification and automated checks run.
  • All checklist items are appropriately checked or marked N/A.

✅ Code Quality

The production change at scripts/linting/Validate-SkillStructure.ps1 line 475 is correct. The unnecessary parentheses wrapping the old expression are also naturally removed. No other logic was altered.


⚠️ Coding Standards — Test Assertion

One inline comment was left on the test file (line 828). The .ToString('o') call on $json.timestamp is semantically a no-op because Get-StandardTimestamp already returns a [string], and String.ToString(IFormatProvider) ignores the format argument. The suggested fix simplifies the assertion to $json.timestamp | Should -Match '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.*Z$' for clarity and robustness.


Action Items

  • Remove the .ToString('o') call from the test assertion (see inline comment on line 828 of Validate-SkillStructure.Tests.ps1).

Generated by PR Review for issue #1280

Use raw JSON string matching instead of ConvertFrom-Json with property
access, avoiding PowerShell 7 DateTime coercion that makes direct regex
matching unreliable. Pattern follows the established approach from
Test-CopyrightHeaders.Tests.ps1 (#1278).
@chaosdinosaur chaosdinosaur force-pushed the fix/996-standardize-timestamp-skill-validation branch from 7d76b5e to c376780 Compare April 3, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize timestamp in Validate-SkillStructure.ps1 to use Get-StandardTimestamp

3 participants