Skip to content

Preserve validation metadata in Hybrid lifecycle compilation - #1026

Merged
PrzemyslawKlys merged 2 commits into
mainfrom
fix/hybrid-validation-metadata
Oct 4, 2026
Merged

PrzemyslawKlys merged 2 commits into
mainfrom
fix/hybrid-validation-metadata

Conversation

@PrzemyslawKlys

Copy link
Copy Markdown
Member

Hybrid binary-module compilation can turn a function with numeric ValidateSet(0,1,5) into a hosted lifecycle cmdlet whose generated validation set is empty. The module imports, but command metadata discovery and invocation fail. Other unrepresented attributes can lose validation options during the same promotion.

Apply the shared parameter metadata support policy before promoting a hosted lifecycle. Functions with unsupported numeric or mixed validation sets, named validation options, or script validation retain their authored PowerShell binding and validation. Reuse each parsed source document within planning. Add admission and dual-runtime compatibility checks to the existing compiler gate, and update the Strict parameter-set fixture to use supported object pipeline binding; string conversion remains covered by native lifecycle oracles.

The defect was found while qualifying DLL compilation for Locksmith2. Its rebuilt Hybrid artifact matches all 104 source export names and exported parameter-name sets, and Show-IssueReport runs with a synthetic issue. The separate Locksmith2 tooling upgrade does not enable compilation. Build performance changes are independent. A public PSPublishModule release containing this fix is required for Gallery consumers to receive the corrected compiler behavior.

Validation: 15 focused cases pass, including original/generated invocation on PowerShell 7 and Windows PowerShell 5.1. Four metadata admission cases fail against the untouched base and pass with the fix; the supported validation case passes in both. Package/Strict EXEs, Strict Core/Desktop binary modules, a Hybrid module, and a runtime-free CLR library build and execute against public 3.0.153 and local compiler source. A pre-existing broader lifecycle fixture's compiled-method count assertion fails identically on the untouched base; no full unfiltered compiler-suite pass is claimed. Independent read-only review covers metadata admission and its focused follow-ups. No public API or production dependency is added.

@PrzemyslawKlys
PrzemyslawKlys merged commit 7c13b8c into main Oct 4, 2026
9 checks passed
@PrzemyslawKlys
PrzemyslawKlys deleted the fix/hybrid-validation-metadata branch October 4, 2026 21:36
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.

1 participant