Repository navigation
Snapshot-test applies_to parsing before the domain-model refactor - #4881
Merged
Merged
Conversation
The YAML converter for `applies_to` had no direct test, and the refactor in [#4530](#4530) must not change what it reads or reports. These tests record about 450 YAML inputs, the model's JSON, equality and ordering, and how pages render the value. Odd results are recorded as they are. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4881/ |
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.
Adds snapshot tests that record how
applies_toYAML is read, serialized and rendered today, so the refactor in #4530 can prove it changes none of it.Affects: Authoring, Internals only
Prompt summary: Lock in the current behaviour of
applies_toparsing with a large table of inputs, ahead of a domain-model refactor that must not change behaviour. Record odd behaviour as it is, and use only synthetic data.Why
ApplicableToYamlConverterhas no direct test. The refactor in #4530 reshapes the types it builds, so a change in a lifecycle, a version, or a diagnostic would pass unnoticed.What
YAML to
ApplicableTotableAbout 450 YAML documents, grouped by family in verified text files: every product key in four spellings, every lifecycle spelling, 45 version specs, lists and version inference, scalar, mapping and sequence shapes, unknown and case-variant keys, and the version rules. Each block holds the JSON, the
ToStringtext and every diagnostic with its severity.Model behaviour
The JSON converter is read with malformed and unusual entries. Equality, hashing, ordering and operators,
AppliesCollection.TryParse, the explicit casts, everyProductApplicabilityproperty and every lifecycle are tabulated. Parsed YAML is round-tripped through JSON.Page rendering
Four documentation sets cover the inline
{applies_to}role,{applies-switch}, the:applies_to:option of admonitions and dropdowns, and 30 front matter cases. They snapshot diagnostics and the rendered markup.Out of scope: Roles with invalid YAML or an empty body throw with a stack trace in the diagnostic, so they cannot be snapshotted. The new snapshots do not depend on the scrubber being added on
snap/config-global. Each new test class was checked by mutating the product code and confirming a failure.Verify
mise run test mise run lint mise run snap:orphans