Repository navigation
Consistently escape function metadata identifiers in .fx.yaml - #819
Merged
Crash Collison (tehcrashxor) merged 2 commits intoOct 13, 2026
Merged
Crash Collison (tehcrashxor) merged 2 commits into
Crash Collison (tehcrashxor) merged 2 commits into
Conversation
Function argument metadata keys are now escaped on write and unescaped on read, matching how other identifiers are handled. YamlWriter also rejects property names containing line breaks, which can't round-trip. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Crash Collison (tehcrashxor)
force-pushed
the
joshuac-microsoft-escape-arg-metadata-identifier
branch
from
October 13, 2026 22:18
dc07954 to
05c39a5
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Escaped empty identifiers remain accepted, and several YAML line terminators bypass the new validation.
2 open findings
What changed in this PR
Updates the legacy PAModel .fx.yaml pipeline to round-trip escaped function metadata identifiers and reject unsupported property names.
Changes:
- Escapes metadata keys during writing and unescapes them during parsing.
- Adds property-name validation and empty-identifier handling.
- Adds round-trip and validation tests.
| File | Description |
|---|---|
src/PAModelTests/YamlTest.cs |
Tests property-name rejection. |
src/PAModelTests/PAWriterVisitorTests.cs |
Tests metadata identifier round-tripping and errors. |
src/PAModel/PAConvert/Yaml/YamlWriter.cs |
Validates property names before writing. |
src/PAModel/PAConvert/PAWriterVisitor.cs |
Escapes metadata identifiers. |
src/PAModel/PAConvert/Parser/Parser.cs |
Unescapes metadata identifiers. |
src/PAModel/PAConvert/Parser/CharacterUtils.cs |
Handles raw empty identifiers. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Reject escaped identifiers that decode to an empty name, and reject all line terminators recognized by CharacterUtils.IsLineTerm in YAML property names. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Crash Collison (tehcrashxor)
enabled auto-merge (squash)
October 13, 2026 22:49
Ian Legler (ian-legler)
approved these changes
Oct 13, 2026
Crash Collison (tehcrashxor)
deleted the
joshuac-microsoft-escape-arg-metadata-identifier
branch
October 13, 2026 22:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Identifiers in function argument metadata blocks weren't escaped when written to
.fx.yaml, unlike other identifiers (control, property, function and parameter names). Some names containing special characters weren't written correctly and didn't round-trip between unpack and pack.Solution
Escape these identifiers on write and unescape them on read, the same way as other identifiers. Also harden
YamlWriterso it rejects property names it can't represent.Changes
PAWriterVisitor: function argument metadata keys are written withCharacterUtils.EscapeName.Parser.ParseArgMetadataBlock: keys are read withCharacterUtils.UnEscapeName. Simple identifiers are written exactly as before, so existing.fx.yamlfiles are unaffected.CharacterUtils.UnEscapeName: reports a parse error for an empty identifier (including escaped forms such as'') instead of throwingIndexOutOfRangeExceptionor returning an empty name.YamlWriter:WriteStartObjectand theWritePropertyoverloads throwArgumentExceptionfor property names containing any line terminator recognized byCharacterUtils.IsLineTerm.PAWriterVisitorTests(round-trip of simple and escaped identifiers, line breaks rejected, empty identifiers report an error) andYamlTest.WriteRejectsLineBreaksInPropertyNames.Validation
dotnet build src\PASopa.sln: succeeded, 0 warnings, 0 errors.dotnet test --no-build --project src\PAModelTests\PAModelTests.csproj: passed on net8.0, net10.0 and net48 (873 total, 0 failed).