Skip to content

test: cover default canvas style for vertices without a schema type (#1779) - #2202

Closed
hdp01 wants to merge 1 commit into
aws:mainfrom
hdp01:fix/1779-blank-node-icon
Closed

hdp01 wants to merge 1 commit into
aws:mainfrom
hdp01:fix/1779-blank-node-icon

Conversation

@hdp01

@hdp01 hdp01 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Ports the regression coverage requested on #1781 (and #1779) to the current icon-registry pipeline: asserts useGraphStyles emits a node[type="«No Type»"] entry with the default icon for vertices without a schema type — the same fallback the details panel uses.

While scoping I verified the described root cause no longer matches the code: useAllVertexStyles always appends a LABELS.MISSING_TYPE entry and useBackgroundImageMap resolves the default icon through the registry (probed green). So this PR is test-only; no behavior change. If maintainers would rather close #1779 as fixed-by-refactor, this test still locks the behavior in.

Type of change

Validation

  • New test passes; full useGraphStyles.test.tsx file green (16/16).
  • oxlint + oxfmt --check clean on the touched file.
  • Note: the test runs under jsdom, not the file's previous happy-dom — happy-dom's DOMParser/DOMPurify interop drops the <svg> root during sanitize, so svg icon resolution can never complete there; jsdom matches browser behavior (same env as useBackgroundImageMap.test.ts).

…ws#1779)

Blank nodes carry the synthetic LABELS.MISSING_TYPE, which never appears
in the schema. Asserts useGraphStyles still emits a node[type=...] entry
for it with the default icon, matching the details-panel fallback.

Runs under jsdom: happy-dom's DOMParser/DOMPurify interop drops the svg
root during sanitize, so svg icon resolution can never complete there.

Relates to aws#1779; ports the coverage asked for on aws#1781 to the current
icon-registry pipeline.
@kmcginnes

Copy link
Copy Markdown
Collaborator

Thanks for this, @hdp01. This and #1781 cover the same fix, so I've combined them in #2695 with your commits included. You'll be credited as a co-author when it merges, and the release notes will link back here. I'll close this one once #2695 merges. There's more detail in our contributing guide.


🤖 Written by an AI agent on my behalf.

kmcginnes added a commit that referenced this pull request Dec 2, 2026
…t icon (#2695)

Based on #1781 by @P-r-e-m-i-u-m and #2202 by @hdp01.

## Summary

The Graph View canvas drew any node or edge whose type wasn't in the
synced schema with the app defaults and no icon, while the details panel
showed that type's saved style and the default icon.

**User-facing:** Nodes and edges whose type isn't in the schema now look
the same on the canvas as in the details panel: your saved style, and
the default icon for nodes. Blank nodes keep the default icon and style.

The canvas style cache now resolves every drawn type through the same
style atoms the details panel reads, so the schema gate and its
subscription go away:

```diff
 vertexValues(node)
-  if type is «No Type» or in the schema
-    style = vertexStyleByTypeAtom(type)
-  else
-    draw app defaults, background-image: none
+  style = vertexStyleByTypeAtom(type)
 subscribe
   userVertexStylesAtom, userEdgeStylesAtom
-  activeSchemaAtom
   iconRegistry
```

## Evidence

**Before:** `draws a type missing from the schema without an icon`
pinned `background-image: none`.

**After:** these tests fail on `main` and pass here:

- `draws a type missing from the schema with the default icon`
- `styles a vertex type missing from the schema with its stored style`
- `styles an edge type missing from the schema with its stored style`

Both contributors' blank-node tests run under jsdom in
`useGraphStyles.icons.test.tsx`.

**Verified live:** agent-tested in Chrome and Safari against a local
Gremlin Server. A `robot` node styled as a red star and a `builds` edge
styled green at 5px kept those styles and the node's default icon after
the schema refresh dropped both types.

<img width="1280" height="720" alt="verify-chrome-unknown-type"
src="https://github.com/user-attachments/assets/b85d6d62-507f-4a66-b0c8-7fe3318870c8"
/>

## Merge Danger

**Door:** two-way. No stored data changes, so reverting brings back the
old look.

**Impact:** canvas styling. See Upgrade Notes.

## Upgrade Notes

- **Saved node and edge styles now apply on the canvas to types that
aren't in the synced schema.** Those types used to draw with the default
look. They now match the details panel. You don't need to do anything.
If a style you saved earlier now shows up where you didn't expect it,
reset or edit it in the type's Customize dialog.

## Related

- Closes #1779
- Related to #1679

---

<sub>🤖 Written by an AI agent on my behalf.</sub>

---------

Co-authored-by: 🄂ʏᴇᴅ 🄰ʙᴅᴜʟ 🄰ᴍᴀ🄝 ✧ <amanbaba9404522@gmail.com>
Co-authored-by: hdp01 <154049023+hdp01@users.noreply.github.com>
@kmcginnes

Copy link
Copy Markdown
Collaborator

This fix landed in #2695 with your commits included, so you're credited as a co-author. Thanks again, @hdp01. Closing this one.


🤖 Written by an AI agent on my behalf.

@kmcginnes kmcginnes closed this Dec 2, 2026
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.

Blank nodes show no icon on graph canvas but display default icon in details panel

2 participants