Skip to content

Add drift-guard test for VertexSymbol visual field coverage#1933

Closed
kmcginnes wants to merge 1 commit into
mainfrom
drift-guard-test
Closed

Add drift-guard test for VertexSymbol visual field coverage#1933
kmcginnes wants to merge 1 commit into
mainfrom
drift-guard-test

Conversation

@kmcginnes

Copy link
Copy Markdown
Collaborator

Description

Adds a test that fails when a field is added to VertexVisualStyle but not consumed by the VertexSymbol preview component or explicitly excluded with justification.

Two layers enforce this:

  1. Compile-time — a satisfies Record<keyof VertexVisualStyle, true> check on the exhaustive key record. Adding a field to the type without listing it here is a type error.
  2. Runtime — the test asserts CONSUMED ∪ EXCLUDED = ALL_VISUAL_FIELDS, so even if someone skips the type check, CI catches it.

How to read

  1. visualFields.ts — the field sets and their compile-time guards
  2. visualFields.test.ts — the three runtime assertions (exhaustiveness, no overlap, no phantoms)

Exhaustive destructuring in pickVisual() with a rest-must-be-empty
satisfies check. Adding a field to VertexVisualStyle without listing
it in the destructure is a compile error — no sidecar files or
runtime test needed.
@kmcginnes kmcginnes closed this Jul 13, 2026
@kmcginnes kmcginnes deleted the drift-guard-test branch July 13, 2026 22:03
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