Skip to content

Fix Locale in Metadata for New-MarkdownCommandHelp#813

Merged
adityapatwardhan merged 4 commits into
PowerShell:mainfrom
teramako:fix_locale_metadata
Jul 8, 2026
Merged

Fix Locale in Metadata for New-MarkdownCommandHelp#813
adityapatwardhan merged 4 commits into
PowerShell:mainfrom
teramako:fix_locale_metadata

Conversation

@teramako

@teramako teramako commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

PR Summary

use MetadataUtils.GetCommandHelpBaseMetadata(cmdHelp) instead of MetadataUtils.GetCommandHelpBaseMetadataFromCommandInfo(commandInfo)

PR Context

To fix issue:


This change is Reviewable

@ArmaanMcleod

Copy link
Copy Markdown

Hey @adityapatwardhan Could we please review this PR?

@adityapatwardhan

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@adityapatwardhan

Copy link
Copy Markdown
Member

/azp run

sdwheeler
sdwheeler previously approved these changes Jul 6, 2026

@sdwheeler sdwheeler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@sdwheeler sdwheeler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@teramako

teramako commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@adityapatwardhan
Rebased onto the latest main and resolved the merge conflict in the test file.
The previous CI failure was caused by the conflict, so please re-run the CI/CD pipeline.

@adityapatwardhan

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@adityapatwardhan

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@adityapatwardhan

Copy link
Copy Markdown
Member

@teramako please have a look at the test failures

@teramako

teramako commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

I reviewed the CI failure and confirmed that the regression comes from the
metadata changes introduced in this PR. The failing test output was:

Executing script D:\a\1\s\test\Pester\ConvertToCommandHelp.Tests.ps1

  Describing New-CommandHelp tests
    [+] Should return a command help object 12ms
    [+] Should have the appropriate metadata properties and values 'document type = cmdlet' 3ms
    [+] Should have the appropriate metadata properties and values 'title = New-CommandHelp' 2ms
    [+] Should have the appropriate metadata properties and values 'Module Name = microsoft.powershell.platyPS' 2ms
    [+] Should have the appropriate metadata properties and values 'Locale = en-US' 3ms
    [+] Should have the appropriate metadata properties and values 'PlatyPS schema version = 2024-05-01' 2ms
    [-] Should have the appropriate metadata properties and values 'HelpUri = <empty>' 21ms
      Expected <empty>, but got $null.
      26:         $result.Metadata[$key] | Should -Be $value
      at <ScriptBlock>, D:\a\1\s\test\Pester\ConvertToCommandHelp.Tests.ps1: line 26
    [+] Should have the appropriate metadata properties and values 'ms.date = 07/07/2026' 2ms
    [-] Should have the appropriate metadata properties and values 'external help file = Microsoft.PowerShell.PlatyPS.dll-Help.xml' 4ms
      Expected 'Microsoft.PowerShell.PlatyPS.dll-Help.xml', but got $null.
      26:         $result.Metadata[$key] | Should -Be $value
      at <ScriptBlock>, D:\a\1\s\test\Pester\ConvertToCommandHelp.Tests.ps1: line 26

Switching to MetadataUtils.GetCommandHelpBaseMetadata(cmdHelp) caused both
HelpUri and external help file to become $null, because CommandHelp
does not yet contain these values at the time metadata is generated. These
fields are only reliably populated when using
GetCommandHelpBaseMetadataFromCommandInfo(commandInfo).

Therefore, I am changing the approach: I will continue using
GetCommandHelpBaseMetadataFromCommandInfo(commandInfo) and update only the
Locale handling by passing the explicit locale value. This preserves the
existing behavior for HelpUri and external help file while still fixing the
Locale metadata issue.

A new commit has been pushed with this updated approach.

@teramako teramako force-pushed the fix_locale_metadata branch from 747bc70 to 106f699 Compare July 8, 2026 13:26
@adityapatwardhan

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@adityapatwardhan

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@sdwheeler sdwheeler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@adityapatwardhan adityapatwardhan merged commit 1f12712 into PowerShell:main Jul 8, 2026
8 checks passed
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.

4 participants