Enforce the style data producer/consumer lockstep structurally - #2125
Closed
kmcginnes wants to merge 1 commit into
Closed
Enforce the style data producer/consumer lockstep structurally#2125kmcginnes wants to merge 1 commit into
kmcginnes wants to merge 1 commit into
Conversation
The ADR records that a new per-type style property has to be added in two places together — the `ge_*` field and its producer, and the matching `data(…)` mapper — and that editing one side alone silently drops the style. Nothing enforced it, and the label background/border and arrow-colour mappings were asserted nowhere. Asserts both directions by collecting the key sets rather than listing names, so the test cannot rot the way a hand-written list does: every `ge_*` key the producers emit must appear as a mapper somewhere in the stylesheet, and every `ge_*` mapper must have a producer. Non-`ge_*` mappers such as `displayName` come from the rendered entity rather than these producers, so they are excluded by prefix. Walks every rule, so a legitimately re-added gated selector still counts.
Collaborator
Author
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.
Description
The ADR from #2112 records this as a Consequence:
Nothing enforced it, and the migration had already dropped assertions for
ge_labelBackgroundOpacity,ge_labelBackgroundColor,ge_labelBorderWidth,ge_labelBorderColor,ge_labelBorderStyleand the arrow-colour / distance mappings — asserted nowhere.This closes the loop by comparing key sets rather than listing field names, so it cannot rot the way a hand-written list does. Both directions:
ge_*key the producers emit appears as adata(...)mapper somewhere in the stylesheetge_*mapper corresponds to a key a producer emitsNon-
ge_*mappers (displayName) come from the rendered entity rather than these producers, so they're excluded by prefix, not by name. It walks every rule rather than hardcodingnode/edge, so a legitimately re-added gated selector is still covered.Verified by deliberate probe: adding a bogus mapper and a bogus producer field each failed the expected direction, then both probes were reverted.
How to read
One new
describeblock at the end ofuseGraphStyles.test.tsx.