Skip to content

Anchor ERD relationships to attribute rows (closes #5) - #11

Merged
dbose merged 1 commit into
mainfrom
5-attribute-level-relationships
Sep 10, 2026
Merged

dbose merged 1 commit into
mainfrom
5-attribute-level-relationships

Conversation

@dbose

@dbose dbose commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Relationships were drawn entity-box to entity-box, so with composite keys or multiple relationships between the same pair the diagram said nothing about which columns actually join. They now anchor to the concrete attribute rows.

  • EntityNode renders a per-attribute source+target Handle keyed by the attribute ULID, plus reserved entity-level fallback handles (__entity_source/target) so an unmapped relationship still renders header-to-header exactly as before.
  • ModelCanvas.anchorFor() maps each relationship end to its attribute handle when the attribute resolves on that entity, else the fallback — a per-end decision.
  • Composite keys draw as ONE line anchored to the first member with a "(N)" count (IDEF1X-style), not N overlapping crow's-feet. Parallel relationships between the same pair now separate onto their own rows via distinct handles.
  • Hovering an attribute highlights the relationships it joins and dims the rest; hovering an edge emphasises both endpoint rows — folded into the existing dimmed/highlighted data-flow, no re-layout.
  • FK/relationship-endpoint attributes are pinned below the business keys so the anchored endpoints stay visible on tall cards.
  • Dragging column→column prefills the relationship modal with both attributes (from_attribute/to_attribute), reusing the existing create_relationship payload.

Frontend only — the model already carried from/to attribute ULIDs, and create_relationship already accepted per-column attributes; the issue's assumed metadata dependency was already satisfied. Verified end to end in the browser against the ibor demo (row anchoring, attribute-hover highlight+dim, per-row connect ports). tsc + vite build clean (Node 20); works in both the architect canvas and SME ModelWorkspace since both mount ModelCanvas.

What this changes

How it was tested

Checklist

  • Tests pass locally (uv run pytest)
  • Lint passes (uv run ruff check packages/)
  • Docs or the README updated if behavior changed
  • The change fits the git-native, stateless design (git stays the source of truth)

Relationships were drawn entity-box to entity-box, so with composite keys or
multiple relationships between the same pair the diagram said nothing about which
columns actually join. They now anchor to the concrete attribute rows.

- EntityNode renders a per-attribute source+target Handle keyed by the attribute
  ULID, plus reserved entity-level fallback handles (__entity_source/target) so an
  unmapped relationship still renders header-to-header exactly as before.
- ModelCanvas.anchorFor() maps each relationship end to its attribute handle when the
  attribute resolves on that entity, else the fallback — a per-end decision.
- Composite keys draw as ONE line anchored to the first member with a "(N)" count
  (IDEF1X-style), not N overlapping crow's-feet. Parallel relationships between the
  same pair now separate onto their own rows via distinct handles.
- Hovering an attribute highlights the relationships it joins and dims the rest;
  hovering an edge emphasises both endpoint rows — folded into the existing
  dimmed/highlighted data-flow, no re-layout.
- FK/relationship-endpoint attributes are pinned below the business keys so the
  anchored endpoints stay visible on tall cards.
- Dragging column→column prefills the relationship modal with both attributes
  (from_attribute/to_attribute), reusing the existing create_relationship payload.

Frontend only — the model already carried from/to attribute ULIDs, and
create_relationship already accepted per-column attributes; the issue's assumed
metadata dependency was already satisfied. Verified end to end in the browser against
the ibor demo (row anchoring, attribute-hover highlight+dim, per-row connect ports).
tsc + vite build clean (Node 20); works in both the architect canvas and SME
ModelWorkspace since both mount ModelCanvas.
@dbose
dbose merged commit 083a702 into main Sep 10, 2026
0 of 2 checks passed
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.

Visual canvas: connect specific attributes (columns), not just whole entities

1 participant