Remove broken round-polygon shapes from the picker and coerce stored values#1923
Open
kmcginnes wants to merge 5 commits into
Open
Remove broken round-polygon shapes from the picker and coerce stored values#1923kmcginnes wants to merge 5 commits into
kmcginnes wants to merge 5 commits into
Conversation
e52fd8c to
28b2054
Compare
…values (#1922) Cytoscape's round-polygon renderer degenerates at 24px for six shapes (round-triangle, round-pentagon, round-hexagon, round-heptagon, round-octagon, round-tag), rendering them as blobs and causing edges to disappear. This removes them from the shape picker so they can't be newly selected, and coerces any previously-stored values to round-rectangle at both the storage-read boundary (ReadTransform) and the styling-import boundary (Zod transform). The shapes remain in SHAPE_STYLES so older files still parse without rejection.
Move coerceBrokenShape() and the broken-shape set into vertexStylesTransform.ts so the import from storageAtoms is type-only into graphStyles.ts, breaking the runtime cycle that caused a ReferenceError during initialization. Change the coercion target from "round-rectangle" to "roundrectangle" (the value NODE_SHAPE uses for the picker) so the style dialog displays "Round Rectangle" instead of a blank field for coerced entries.
…me coercion Review feedback applied: - Each broken round-polygon shape now maps to its sharp-cornered counterpart (round-hexagon → hexagon, etc.) instead of collapsing all six to a single flat replacement. This preserves the user's visual-differentiation intent. - Remove the Zod .transform() from stylingParser.ts — import stores the value as-is and the ReadTransform coerces on next load, keeping the import path non-destructive and the original recoverable. - Add debug logging to transformVertexStyles so coercions are observable. - Convert the transform test loop to it.each for better failure diagnostics. - Add ADR documenting the coerce-vs-reject decision and reversal condition. - Update the ReadTransform ADR with transformVertexStyles as a second consumer.
1d3c409 to
9fad9e0
Compare
Proves the end-to-end pipeline: legacy data seeded in localForage with a broken round-polygon shape → atomWithLocalForage with the ReadTransform → atom value has the shape coerced to its non-round counterpart. Also verifies no write-back occurs (stored original is preserved).
The common case (no broken shapes stored) now avoids allocating a Map that is immediately discarded, matching the pattern used by the sibling transformGraphViewLayout.
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
Cytoscape's round-polygon renderer degenerates at the 24px node size used on the canvas for six shapes (
round-triangle,round-pentagon,round-hexagon,round-heptagon,round-octagon,round-tag): the fill renders as a blob and the edge-intersection computation returns no valid point, so connected edges disappear. These shapes became selectable via #1886; no upstream cytoscape fix exists (3.34.0 is latest).This PR removes the six shapes from the picker and coerces any previously stored value to its non-round counterpart at the read boundary, preserving the user's visual-differentiation intent:
round-triangletriangleround-pentagonpentagonround-hexagonhexagonround-heptagonheptagonround-octagonoctagonround-tagtagNODE_SHAPE.ReadTransformon theuser-vertex-stylesandshared-vertex-stylesatoms coerces stored broken shapes at load time (never writes back, so originals are recoverable if cytoscape fixes the bug).SHAPE_STYLESstays inclusive — the six values remain in the enum andShapeStyletype, so older styling files still parse cleanly.How to read
coerceBrokenShape(), and theReadTransformValidation
pnpm check:typesandpnpm check:formatpass.pnpm testpasses — 2128 tests across 185 files.Related Issues
Check List
pnpm checkspasses with no errors.pnpm testpasses with no failures.