[v2] Connection endpoints: colliding derived ids and no public endpoint/port-owner API
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Start with packages/graph/src/store/connection/ConnectionState.ts and ConnectionList.getOrCreateConnection to trace derived IDs and connection reuse. Then inspect the port and connection store APIs and their tests. Done means adding documented, tested endpoint and port-owner APIs and deterministic IDs that distinguish anchor connections across blocks and keep port-only IDs stable; the acceptance criteria also call for follow-up package limitations to be lifted.
索引モデルが issue の本文から書いたものです。
説明
Problem
TConnection has two addressing modes:
- Block-based:
sourceBlockId/targetBlockId, optionallysourceAnchorId/targetAnchorId. Core resolves these to ports:"<blockId>_output"/"<blockId>_input"for block points,"<blockId>/<anchorId>"for anchors. - Port-based:
sourcePortId/targetPortId.
Core has two gaps around these modes. Because of them, the extracted packages (#396) cannot treat both modes the same way.
1. Derived connection ids collide
ConnectionState.getConnectionId (packages/graph/src/store/connection/ConnectionState.ts, getConnectionId) builds the id of a connection that has no explicit id:
if (hasId(connection.sourceAnchorId) && hasId(connection.targetAnchorId)) {
return [connection.sourceAnchorId, connection.targetAnchorId].join(":"); // no block ids
}
return [connection.sourceBlockId, connection.targetBlockId].join(":");
ConnectionList.getOrCreateConnection then reuses whatever state already has that id and calls updateConnection on it.
- Anchor connections: two connections between different blocks that use the same anchor names get the same id (
"out:in"). The second one rewires the first instead of creating a new connection. This happens routinely after duplicating blocks (#408 had to give every copy an explicit id to avoid it). - Parallel block connections: they collapse into one (
"a:b"). - Port-only connections: they get a random id, so they cannot be addressed deterministically.
2. No public API to resolve endpoints
Given a ConnectionState or a PortState, there is no public, serializable way to get:
- the resolved source and target port ids together with the owning block id and anchor id, regardless of which mode the connection was declared in;
- the block that owns a port.
PortState.owner/componentis a view component, not store data, and it is absent until the view exists. - a connection by its endpoints (store lookup).
Impact
@gravity-ui/graph-layered,@gravity-ui/graph-elk: port-only connections are skipped and documented as unsupported, because there is no port → block resolution. Anchor endpoints are not taken into account in layout.@gravity-ui/graph-duplicate-block: port-based connections are copied only when the port id can be derived from block or anchor ids, and copies need explicit ids (see 1).@gravity-ui/graph-connection-editing: decides between block and port mode by comparing port ids withcreateBlockPointPortId/createAnchorPortId, and dedupes custom-port connections by scanning$connectionsMap.@gravity-ui/graph-playwright: cannot find connections by endpoints or reliably tell apart connections between the same blocks on different anchors. Related: #409.
Proposal (to be refined)
- Deterministic derived ids that include block ids for anchor connections, e.g.
"<sourceBlockId>/<sourceAnchorId>:<targetBlockId>/<targetAnchorId>", and that are stable for port-based connections, e.g. built from the port ids. This is a breaking change for consumers that rely on today's derived ids; it needs a migration note. ConnectionState.getEndpoints(): a serializable{ source: { portId, blockId?, anchorId? }, target: { … } }, available without the view.- Port owner as store data: a public port → owner block/anchor helper, e.g.
connectionsList.getPortOwner(portId)or owner info onPortState. connectionsList.findByEndpoints(...), accepting either mode.
Acceptance criteria
- Unit tests:
- two anchor connections with the same anchor names on different blocks stay distinct;
- parallel connections behave as documented;
- port-only connections get a stable id.
- The endpoint and owner APIs work for block, anchor and custom ports, are covered by tests for each mode separately, and are documented.
- Follow-ups listed for the packages above: lift the documented port-only limitations where the new API makes it possible.
- 主要言語
- TypeScript
- スター
- 145
- フォーク
- 12
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 43
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
gravity-ui/graph のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
gravity-ui/graph#457 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
gravity-ui/graph#455 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
gravity-ui/graph#456 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
gravity-ui/graph#431 ·
メンテナーはふだん 1 日以内に返信
-
Graph root is not a containing block for absolutely positioned layers対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
gravity-ui/graph#414 ·
メンテナーはふだん 1 日以内に返信
gravity-ui/graph の issue をすべて見る
似ている issue
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
openclaw/openclaw#199885 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
feature needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BoardGamesEmpire/board-games-empire-backend#1306 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
sequant-io/sequant#1689 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100