Skip to content

Enforce the style data producer/consumer lockstep structurally - #2125

Closed
kmcginnes wants to merge 1 commit into
fuse-canvas-vertex-passesfrom
test-style-data-lockstep
Closed

Enforce the style data producer/consumer lockstep structurally#2125
kmcginnes wants to merge 1 commit into
fuse-canvas-vertex-passesfrom
test-style-data-lockstep

Conversation

@kmcginnes

Copy link
Copy Markdown
Collaborator

Description

The ADR from #2112 records this as a Consequence:

Producer and consumer must stay in lockstep. A new per-type style property must be added in two places together — the ge_* field + its producer, and the matching data(…) mapper. Editing one side alone silently drops the style.

Nothing enforced it, and the migration had already dropped assertions for ge_labelBackgroundOpacity, ge_labelBackgroundColor, ge_labelBorderWidth, ge_labelBorderColor, ge_labelBorderStyle and 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:

  • every ge_* key the producers emit appears as a data(...) mapper somewhere in the stylesheet
  • every ge_* mapper corresponds to a key a producer emits

Non-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 hardcoding node / 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 describe block at the end of useGraphStyles.test.tsx.

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.
@kmcginnes
kmcginnes deleted the branch fuse-canvas-vertex-passes August 14, 2026 21:11
@kmcginnes

Copy link
Copy Markdown
Collaborator Author

Superseded by #2128, which consolidates this stack into a single PR targeting #2112. Same commits, same end state — the branch there is byte-identical to the tree these were cut from, rebased onto schema-view-style-perf after #2118 was squash-merged into it.

@kmcginnes kmcginnes closed this Aug 14, 2026
@kmcginnes
kmcginnes deleted the test-style-data-lockstep branch August 14, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant