Skip to content

fix: accept YAML block-scalar trailing line breaks in schema patterns - #6596

Open
lsmlhi_25 (FOWEPJF255) wants to merge 2 commits into
microsoft:masterfrom
FOWEPJF255:fix/6592-schema-trailing-linebreak
Open

lsmlhi_25 (FOWEPJF255) wants to merge 2 commits into
microsoft:masterfrom
FOWEPJF255:fix/6592-schema-trailing-linebreak

Conversation

@FOWEPJF255

@FOWEPJF255 lsmlhi_25 (FOWEPJF255) commented Oct 17, 2026 •

Copy link
Copy Markdown

📖 Description

YAML block scalars that use clip chomping (> / |) keep one trailing line break. Schema patterns such as InstallerUrl (^([Hh][Tt][Tt][Pp][Ss]?)://.+$) no longer match that break after the MSVC std::regex ECMAScript change, so previously valid manifests fail schema validation.

This change configures the shared Valijson regex engine with the ECMAScript multiline option. Schema anchors therefore retain their earlier behavior for all current and future pattern fields, while manifest values remain unchanged. The regression test verifies both successful validation and preservation of the YAML block scalar's trailing newline.

🔗 References

Resolves #6592

🔍 Validation

  • Added Manifest-Good-InstallerUrl-BlockScalar.yaml and ReadGoodManifestInstallerUrlBlockScalar, and included the fixture in ReadGoodManifests.
  • Replaced the live fixture URL with the repository's established https://ThisIsNotUsed sentinel.
  • git diff --check origin/master...HEAD passed.
  • A focused AppInstallerCLITests build was attempted with MSBuild, but this machine does not have the Visual C++ targets (Microsoft.Cpp.Default.props) installed, so compilation and the Catch2 test could not run locally. GitHub CI is the build/test authority for this update.

✅ Checklist

🤖 AI Assistance

  • AI assistance was used and has been disclosed in this PR
  • No AI assistance was used

AI assistance helped investigate Valijson's custom regex engine, draft the centralized multiline-regex fix and regression test, and update this description. I reviewed the implementation against issue #6592, the repository's contribution guidance, and the Valijson v1.0.4 interface before submission.

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

@FOWEPJF255
lsmlhi_25 (FOWEPJF255) requested a review from a team as a code owner October 17, 2026 17:46
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions

This comment has been minimized.

@Trenly Kaleb Luedtke (Trenly) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The upstream PR defines an option to simply recert to multiline matching, why not use that? Or, where the regex check actually takes place, why not specify rhe multiline option?

It feels to me like mutating the strings for each individual occurence would not lead to consistent behaviors

Installers:
- Architecture: x86
InstallerUrl: >
https://rubengustorage.blob.core.windows.net/publiccontainer/msixsdk-x86.msi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don’t think this should be using a hardcoded live URL - Don’t other tests use placeholders that get resolved at test runtime?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated in ff8a491. This fixture only exercises manifest parsing and schema validation and never downloads the URL, so I replaced the live endpoint with the repository's established https://ThisIsNotUsed test sentinel.

{
{ "Arch", [](const YAML::Node& value, const VariantManifestPtr& v)->ValidationErrors { variant_ptr<ManifestInstaller>(v)->Arch = Utility::ConvertToArchitectureEnum(value.as<std::string>()); return {}; } },
{ "Url", [](const YAML::Node& value, const VariantManifestPtr& v)->ValidationErrors { variant_ptr<ManifestInstaller>(v)->Url = value.as<std::string>(); return {}; } },
{ "Url", [](const YAML::Node& value, const VariantManifestPtr& v)->ValidationErrors { variant_ptr<ManifestInstaller>(v)->Url = Utility::Trim(value.as<std::string>()); return {}; } },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Applying the trim only to specific fields seems prone to failure. What happens when a new pattern field is added in the future ? The user would have to remember to add the trim?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated in ff8a491. I removed the field-specific trimming and configured the shared Valijson ValidatorT with a multiline std::regex engine instead. This applies the anchor behavior centrally to every schema pattern, including future fields, while preserving the original manifest scalar value; the regression assertion now checks that the trailing newline remains.

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.

[WinGetUtil] Schema pattern validation rejects values ending in a line break since 1.30 (VS 2026 toolset)

2 participants