Skip to content

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

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

lsmlhi_25 (FOWEPJF255) wants to merge 1 commit 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 for LWG-2503, so previously valid manifests fail schema validation.

This change strips trailing CR/LF from string scalars before schema validation, and trims InstallerUrl / Url when they are stored. The parsed URL no longer keeps the chomping newline.

🔗 References

Resolves #6592

🔍 Validation

  • Added Manifest-Good-InstallerUrl-BlockScalar.yaml and ReadGoodManifestInstallerUrlBlockScalar, and included the fixture in ReadGoodManifests.
  • git diff --check passed.
  • The focused Catch2 suite was not run here: this checkout is a shallow clone and a full AppInstallerCLITests build was not executed in this pass.

✅ Checklist

🤖 AI Assistance

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

AI assistance drafted the trailing-line-break trim, the regression fixture, and this description. The change was reviewed against the issue's std::regex / YAML clip-chomping analysis 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

Copy link
Copy Markdown

check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

Unrecognized words (1)

LWG

These words are not needed and should be removed AAD ABCD abi ACL'd AMap Amd appdata ARMNT asan Baz bitmask bluetooth boundparms brk Buf certs cgi CMSG codepage commandline constexpr Cov cswinrt CTL Dbg Dcom decompressor dedupe DEFT devhome Dns dsc EOP ERANGE errcode errmsg errstr filemode Finalizers FULLWIDTH fuzzer GES github Hackathon HINSTANCE hlocal hmac Hyperlink ICONDIR icu idx img inet Intelli iwr JDK LCID lhs LONGLONG LPBYTE LPCWSTR LPDWORD LPSTR LPVOID LPWSTR MAJORVERSION MAXLENGTH maxvalue MDs MINORVERSION mta nlohmann NONAME NOUPDATE NTFS nullability ofile oid oop OPTOUT outfile OUTOFMEMORY PARAMETERMAP pdb PDWORD pid PKCS pkgs pkix placeholders positionals posix pscustomobject pseudocode PSHOST publickey qword redirector regexes remoting reparse REQS rhs rowid RTTI runspace runtimes SARL savepoint Scm sid sqlite subdir subkey trimstart ttl typedef uninitialize uninstallation UNMARSHALING userprofile versioned virtuals Webserver website wildcards winreg WMI workaround Wpp wsl

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:FOWEPJF255/winget-cli.git repository
on the fix/6592-schema-trailing-linebreak branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/winget-cli/actions/runs/39055206341/attempts/1' &&
git commit -m 'Update check-spelling metadata'

Pattern suggestions ✂️ (2)

You could add these patterns to .github/actions/spelling/patterns.txt:

# Automatically suggested patterns

# hit-count: 1 file-count: 1
# assign regex
= /[^*].*?(?:[a-z]{3,}|[A-Z]{3,}|[A-Z][a-z]{2,}).*/[gi]?(?=\W|$)

# hit-count: 1 file-count: 1
# regex choice
\(\?:[^)]+\|[^)]+\)

Alternatively, if a pattern suggestion doesn't make sense for this project, add a # to the beginning of the line in the candidates file with the pattern to stop suggesting it.

Notices ℹ️ (1)

See the 📂 files view, the 📜action log, or 📝 job summary for details.

ℹ️ Notices Count
ℹ️ candidate-pattern 2

See ℹ️ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@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?

{
{ "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?

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