Skip to content

Keep applies-item badges for keys without a value - #5008

Merged
reakaleek merged 3 commits into
mainfrom
fix-applies-item-badges-ebbba5d0
Nov 23, 2026
Merged

reakaleek merged 3 commits into
mainfrom
fix-applies-item-badges-ebbba5d0

Conversation

@reakaleek

@reakaleek reakaleek commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

An applies-item tab such as { self:, ece: ga 4.2 } shows a badge for every key again, including the keys that have no value. The fix is a temporary workaround until SharpYaml ships a release.

Affects: Authoring, Configuration

Prompt summary: Implement issue #5007. Multi-key applies-item tabs lose the badge of any key that has no value and is followed by a comma. The real fix is in SharpYaml and has no release date, so restore the badges now with a workaround that is marked for removal.

Why

SharpYaml 3.17.0 reads self:, in a flow mapping as a key named self:, with the colon kept. ApplicableToYamlConverter does not know that key, so it drops it and the tab label loses the badge. 26 of 107 multi-key tabs in docs-content are affected, for example { ess:, ece: } and { self:, eck: }.

Closes #5007

What

Empty-value keys keep their name

The converter strips the trailing colon from a key that has no value before it maps keys to applicability. It does this in nested mappings too, so deployment: { self:, ece: ga 4.2 } also works. Keys with a value, and the last key before }, are unchanged.

The workaround is temporary

SharpYaml commit 1e41a26 fixes the scanner, and no release contains it yet. The release is requested in xoofx/SharpYaml#184. A TODO on NormalizeEmptyValueKeys links the follow-up that bumps SharpYaml and deletes the method: elastic/docs-eng-team#1236.

Tests

A snapshot table covers the issue's shapes: { self:, ece: ga 4.2 }, { ess:, ece: }, { self:, ece:, eck: }, { stack:, serverless: } and two nested forms. An HTML snapshot checks that each tab label renders both badges. Both tests fail without the workaround, so they also guard the later removal.

Verify

dotnet test --project tests/Elastic.Markdown.Tests --treenode-filter "/*/*/ApplicableToYamlSnapshotTests/Read_FlowMappings_KeysWithoutAValue"
dotnet test --project tests/Elastic.Markdown.Tests --treenode-filter "/*/*/ApplicabilitySwitchEmptyValueKeysTests/*"
mise run test

Notes

  • Before the fix, nested empty-value keys were dropped without any hint. They now apply.
  • That the upstream commit fixes this case is read from its diff. It is not yet run against these tests.

🤖 Generated with Claude Code

SharpYaml reads `{ self:, ece: ga 4.2 }` as a key named `self:` with the colon kept. The converter then dropped it as unknown, so the tab label lost its Self-managed badge. The converter now strips the colon from keys that have no value, including in nested mappings.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
SharpYaml fixes the flow-mapping scanner upstream in commit 1e41a26, which no release contains yet. The tests stay and fail until the next SharpYaml release is pinned.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@reakaleek
reakaleek marked this pull request as draft November 23, 2026 14:10
@github-actions

Copy link
Copy Markdown
Contributor

The SharpYaml release that fixes the flow-mapping scanner has no date yet. The converter strips the colon again until then, and a TODO links the follow-up that removes it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@reakaleek
reakaleek marked this pull request as ready for review November 23, 2026 14:37
@reakaleek
reakaleek enabled auto-merge (squash) November 23, 2026 14:42
@reakaleek
reakaleek merged commit 7c4cb68 into main Nov 23, 2026
44 checks passed
@reakaleek
reakaleek deleted the fix-applies-item-badges-ebbba5d0 branch November 23, 2026 14:47
claude Bot pushed a commit that referenced this pull request Nov 24, 2026
SharpYaml 3.18.0 contains upstream fix 1e41a26 (xoofx/SharpYaml#184), so
`{ self:, ece: ga 4.2 }` parses `self` as a key without a value again.
Remove NormalizeEmptyValueKeys from ApplicableToYamlConverter, added in #5008.
The snapshot and HTML tests from #5008 stay as regression guards.

Refs #5007, #5008

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EeRLAkeiiEBtg2XAkxV2fC
claude Bot pushed a commit that referenced this pull request Nov 24, 2026
SharpYaml 3.18.0 contains upstream fix 1e41a26 (xoofx/SharpYaml#184), so
`{ self:, ece: ga 4.2 }` parses `self` as a key without a value again.
Remove NormalizeEmptyValueKeys from ApplicableToYamlConverter, added in #5008.
The snapshot and HTML tests from #5008 stay as regression guards.

Refs #5007, #5008

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EeRLAkeiiEBtg2XAkxV2fC
reakaleek added a commit that referenced this pull request Nov 24, 2026
* Bump SharpYaml to 3.18.0 and drop the empty-value key workaround

SharpYaml 3.18.0 contains upstream fix 1e41a26 (xoofx/SharpYaml#184), so
`{ self:, ece: ga 4.2 }` parses `self` as a key without a value again.
Remove NormalizeEmptyValueKeys from ApplicableToYamlConverter, added in #5008.
The snapshot and HTML tests from #5008 stay as regression guards.

Refs #5007, #5008

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EeRLAkeiiEBtg2XAkxV2fC

* Update YAML error-position snapshots for SharpYaml 3.18.0

SharpYaml 3.18.0 reports different source marks on YamlException:
"Expected a ... token" errors now end one column after the offending
token, and duplicate mapping key errors point at the duplicate entry
instead of the end of the document. Only the (Lin/Col/Chr) ranges in
the expected snapshots change; the message text is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EeRLAkeiiEBtg2XAkxV2fC

---------

Co-authored-by: Jan Calanog <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Co-authored-by: Jan Calanog <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-key applies-item drops badges for keys without a value

2 participants