feat(v0.4c): Socket system foundation — tag-gated socket snapping#36
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…during snap) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The on-disk node body enumerated fields and omitted sockets; because the schema field is .optional() the omission type-checked silently, so sockets were lost on every save/reopen. Add sockets to the body + round-trip test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…de-align) A node with any tagged socket opts into socket-based assembly: it no longer falls back to sub-stage B's whole-bbox face snap, so tag compatibility actually gates whether two parts connect (incompatible tags no longer stick via B). Nodes without sockets keep the B→A chain unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
v0.4 sub-stage C — the foundation of the Socket system for modular assembly. A node gets named local connection points (
Socket {id, name, position, tag}); holding Ctrl/Cmd while dragging snaps a dragged socket onto a tag-compatible socket on another node (world positions coincide). Sockets are authored in the Properties panel, shown as viewport markers, persist with the project, and are undoable. Position-only alignment (orientation mating, rule engine, glb-embedded sockets, etc. are later stages — see roadmap Backlog).How (TDD, per-task commits)
Socketschema (.optional()field — old projects load fine) + typesnapToSocketspure fn — tag-compatible, screen-pixel gate, world-nearestsetNodeSocketsstore mutation +SetNodeSocketsCommand(undoable, merges rapid edits)Key design decision (diverges from the approved spec, after visual verification)
The spec's chain was
socket → B (node-align) → A (grid)unconditionally. In practice B (sub-stage #34, which snaps bbox faces) masked socket tag-gating — two boxes stuck face-to-face even with incompatible tags. Changed to: a node with any tagged socket snaps via sockets only (a miss falls through to grid A, never B), so tag compatibility truly gates whether parts connect. Nodes without sockets keep theB → Achain unchanged. (spec §6.3 has the divergence note.)Spec:
docs/superpowers/specs/2026-06-08-v0.4c-socket-system-design.mdPlan:
docs/superpowers/plans/2026-06-08-v0.4c-socket-system-plan.mdVerification
pnpm lint(0 new) ·pnpm typecheck(0) ·pnpm test(469/469)pnpm tauri dev) — verified by maintainer:socketsfield) loads fineIncludes 3 fixes found during smoke: tag input collapsed to 0-width; sockets dropped on save; markers froze mid-snap.
🤖 Generated with Claude Code