Skip to content

Snapshot-test applies_to parsing before the domain-model refactor - #4881

Merged
Mpdreamz merged 1 commit into
mainfrom
snap/applies-to
Nov 17, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
snap/applies-to

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

Adds snapshot tests that record how applies_to YAML 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_to parsing 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

ApplicableToYamlConverter has 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 ApplicableTo table

About 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 ToString text 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, every ProductApplicability property 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

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]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner November 16, 2026 21:15
@Mpdreamz Mpdreamz added the chore label Nov 16, 2026
@Mpdreamz
Mpdreamz requested a review from reakaleek November 16, 2026 21:15
@Mpdreamz Mpdreamz added the chore label Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@Mpdreamz
Mpdreamz merged commit d0fce01 into main Nov 17, 2026
56 checks passed
@Mpdreamz
Mpdreamz deleted the snap/applies-to branch November 17, 2026 09:47
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.

1 participant