Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

fix(app-shell): the flow designer's Remove node takes its edges, and a new node never inherits a removed one's (objectui#11772) - #11825

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-11772-flow-remove-node-edges
Oct 7, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/issue-11772-flow-remove-node-edges

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #11772

Clause-②: no

The objectui half of objectstack#22088 (the server half lands independently).

What was wrong, measured on main (9990f9e)

The card's reproduction, driven through the real FlowPreview canvas and the real FlowInspector over a host that merges each patch the way the Studio Automations pillar does ({ ...d, ...patch }), on the draft Studio creates for a new flow (start → end, edge e1):

  1. the edge's "Insert node here" adds node_1 (e1: start → node_1, edge_1: node_1 → end);
  2. the inspector's "Remove node" left both edges in the draft, naming a node that no longer existed. The saved draft was exactly the card's second reproduction: nodes [start, end], edges [start → node_1, node_1 → end];
  3. "Add connected node" on start minted node_1 again, so both stale edges re-attached to the new node.

On main the new pin file went red on exactly that: 6 failed, 4 passed (the 4 were the controls and the dangling-edge rows, which already worked; see Hypothesis 4).

What changed

  • Remove node removes the node's edges in the same patch. One function, edgesAfterNodeRemoval, serves both removal gestures: the inspector's "Remove node" and the canvas's Delete key. The inspector can see draft.edges, and its host applies patches shallowly (MetadataInspectorProps.onPatch: "Apply a shallow patch to the draft"), so the edges go into the same patch as the node. StudioDesignSurface.tsx is not touched.

  • A node on a single path is spliced out: its predecessor is reconnected to its successor. Single path, read off the edge shapes:

    • exactly one edge in (P to X) and exactly one edge out (X to S), not one self-loop edge;
    • the edge in is not a declared back-edge (retargeting a loop's closing hop would change what the loop re-enters);
    • the edge out is plain: no condition, no label, not the default branch, type default. So X made no routing choice of its own that the splice would drop;
    • P and S are other nodes of the flow, and P is not S;
    • no edge already joins P to S the same way (edgeRouteKey), so the splice never draws the repeated connection the Problems panel now flags.

    The reconnected edge is the edge in, retargeted to S, in the edge in's place. Its id, condition, label, default flag and type are P's routing choice, so they stay. A decision branch that led to X now leads to S, at the same position in the declaration order the engine evaluates branches in. This is exactly the inverse of the canvas's insert-on-edge, which splits P to S into the original edge retargeted to X (in place) plus an appended plain X to S. So inserting a node on an edge and removing it gives the draft back byte for byte (pinned). Anything else (a branch node, a join, a node whose edge out is guarded or labelled, the start or the end) loses its edges and is not reconnected.

  • A new node never takes an id that existed in this editing session. The four node minters (the canvas's add, insert-on-edge and revise loop, and the empty flow's first node) now go through freshNodeId: uniqueId('node', …) over the node ids, both endpoints of every edge, and the ids FlowPreview has seen this session. The session is the FlowPreview mount; Studio remounts it when another flow is opened. A draft with nothing removed and nothing dangling mints exactly what it minted before (pinned as a control). The shared uniqueId contract is unchanged; its widget, kv, ol, sl and edge callers are untouched.

  • The Problems panel flags a repeated connection: an edge that joins the same two nodes the same way as an earlier edge (same type, same condition read through conditionText, same default flag, same label). Each extra copy is its own error row, targeted at that copy's own edge key, so clicking the row selects the copy to remove in the edge inspector. Two edges that join the same nodes differently (two decision branches to one node, an approval's approve and reject to one node) are not flagged. New row engine.flowProblems.repeatedEdge, en and zh.

The PM's mechanism hypotheses, measured

  • H1 (where the pruning lives): option one. remove reaches the draft through loc.write(null) and onPatch, and the host merges shallowly, so the edges fit in the same patch from the inspector. The canvas's Delete key already pruned edges with its own copy of the filter; it now calls the same function, which adds the single-path splice there too.
  • H2 (the id rule's home): at the flow callers, not in uniqueId. uniqueId keeps its lowest-free-suffix contract. Edge ids keep that plain rule: nothing in a flow refers to an edge by its id (the engine routes by endpoints, condition and label), so a reused edge id cannot re-attach anything. The edge minters in FlowCanvas.tsx are unchanged.
  • H3 (single path): defined above, with one difference from the example in the brief. The brief's example excluded a decision branch and a fault edge. Here the edge IN may be a decision branch or a fault edge, because its attributes are the predecessor's routing and survive the splice unchanged, the same way insert-on-edge keeps them on the first half. The edge OUT must be plain. A node that is itself a branch point (several edges out, or a guarded or labelled edge out) is not reconnected.
  • H4 (Problems panel): half falsified. An edge whose source or target is not a node was already flagged, by validateFlowDraft (engine.flowValidate.edgeSourceMissing / edgeTargetMissing). Measured on main: the card's second-reproduction draft already shows both rows, in en and zh. No second check was added, which would have reported each edge twice; the existing rows are now pinned through the real panel. The repeated pair was not flagged anywhere, and the card's published flow (three copies of start → node_1) read "No problems". That half is new.
  • H5 (publish): the client does not block publish. buildFlowProblems feeds only the canvas banner, the badges, the red ring and stroke (deriveInvalidElements), and the Problems panel. Nothing on the Studio save or publish path reads them, and Studio passes no server diagnostics to the flow preview. What an author with a dangling or repeated edge can do: see the error in the banner and the panel, click the row to select that edge, and remove it with the edge inspector's Remove. They can still save the draft and publish, until objectstack#22088 makes the server refuse such a flow. Stored flows are not migrated.

Tests

Pins (all through the real components):

  • previews/FlowPreview.removeNode-11772.test.tsx: the card's reproduction end to end; the insert-then-remove round trip, byte for byte; the control (nothing removed: node_1 and edge_1 as before); a removed id with no edges is not minted again in the session; a stored dangling edge's id is not minted; the Problems panel rows for the dangling edges and the repeated copies, in en and zh; the skeleton draws no row.
  • inspectors/FlowNodeInspector.removeEdges-11772.test.tsx: nine edge shapes through the real Remove button (single path, decision branch, branch node, guarded edge out, labelled edge out, back-edge in, already-joined ends, join, dangling edge in), plus a draft holding a duplicate node id. For each of the nine, the canvas's Delete key produces the same edges as the inspector.
  • previews/flow-problems.repeatedEdge-11772.test.ts: one error per extra copy with its own edge key, an id-less copy keyed by index, zh, the condition spellings agree, the four "joined differently" shapes stay unflagged, and a control.

Ablations, each through ablation-replace.mjs from the committed implementation at d2b3a07, restore proven by blob hash equal to HEAD and an empty git diff HEAD:

Mutation Result
inspector remove writes the node only (the old behaviour) 30 of 38 red, including the card's reproduction and the round trip
freshNodeId ignores edge endpoints and the session 3 of 10 red: the card's reproduction, the session id, the stored dangling id
the repeated-connection check removed 6 of 17 red (en, zh, keys, red stroke); the "joined differently" controls stay green
the single-path splice disabled 3 of 38 red: the round trip, the single-path splice, the decision-branch splice
the "already joined" guard removed 1 of 28 red: the no-second-copy pin

Each local reading, with the commit it ran at, is in the report comment on the card. The full @object-ui/app-shell suite (1,062 test files) was not run locally: two attempts exceeded the container's 10-minute foreground limit on a shared box. Instead the narrowed set ran: every test file that names a changed module or a changed gesture (51 files). The full suite is left to CI.

Files

Everything is on the claim's file surface. FlowCanvas.tsx changes beyond its uniqueId('node', …) callers in one place: its Delete key handler calls the shared removal function, so the two removal gestures agree. ProblemsPanel.tsx needed no change: the new rows render like every other edge problem.

Nothing is added to the package entry. The changed modules are not reachable from dist/index.d.ts, checked by walking its relative imports after a build, with preview-registry.d.ts as the reachable positive control. Patch changeset on @object-ui/app-shell.

Acceptance notes

  • objectui#11778 (the three add-node entry points, the create_record default type, notify in the Node Type select) is not addressed here.
  • Out of scope, reported to the seat rather than fixed here: renaming a node's id in the inspector's ID field leaves the node's edges naming the old id. The rename patch writes only nodes, and the field commits on every keystroke. Measured with a probe on this branch: the patch carries no edges. After this PR the old id is never minted again and the Problems panel names the dangling edges, but the renamed node is still disconnected. Rewriting the endpoints on every keystroke could join a half-typed id to another node's edges, so this needs its own design.
  • Stored flows that already carry dangling or repeated edges are not rewritten. The Problems panel now names both kinds so an author can repair them.

Generated by Claude Code

claude added 3 commits October 7, 2026 16:43
…nherits a removed one's (objectui#11772)

The flow inspector's Remove node wrote null to the node and left every edge
naming it; the next node minted the same id and the stale edges re-attached,
so a published flow ran one create_record once per stale edge.

- One removal for both gestures (inspector Remove, canvas Delete key):
  `edgesAfterNodeRemoval` drops every edge naming the node in the same patch
  and splices a single-path node out (the inverse of insert-on-edge).
- Node ids are minted over node ids and edge endpoints, plus the editing
  session's ledger in FlowPreview, so a removed id is never minted again.
- The Problems panel flags each extra copy of a repeated connection
  (`engine.flowProblems.repeatedEdge`); dangling edges were already flagged.

Claude-Session: https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8
Co-authored-by: Claude <noreply@anthropic.com>
…key they share (objectui#11772)

`edgesAfterNodeRemoval` and `freshNodeId` move from FlowCanvas.tsx into the
React-free flow-problems module next to `edgeRouteKey`, so the node inspector
no longer imports a component module and the canvas file exports components
only. Adds the shape pins (inspector Remove and canvas Delete agree on every
fixture), the repeated-connection pins, and the patch changeset.

Claude-Session: https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8
Co-authored-by: Claude <noreply@anthropic.com>
…ys (objectui#11772)

The ledger's effect read the memoised `nodes` / `edges`; it now reads the
draft's own arrays, per AGENTS.md #10. Recording is idempotent, so behaviour
is unchanged.

Claude-Session: https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 336 chunks) 3516.0 KB 3551.8 KB
Main entry chunk (gzip) 156.3 KB 350 KB
Entry file index-CanpBnss.js —
Status PASS —

The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it.


📦 Bundle Size Report

Package Size Gzipped
app-shell (consoleActionDispatch.js) 0.20KB 0.19KB
app-shell (index.js) 17.82KB 6.58KB
app-shell (runtime-config.js) 22.59KB 7.89KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.11KB 3.87KB
auth (ActiveOrganizationStorage.js) 27.95KB 10.04KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 2.07KB 1.00KB
auth (AuthProvider.js) 40.22KB 10.61KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.15KB 5.40KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.72KB 2.24KB
auth (SocialSignInButtons.js) 9.70KB 3.93KB
auth (UserMenu.js) 3.39KB 1.21KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 40.70KB 10.94KB
auth (createAuthenticatedFetch.js) 8.54KB 3.46KB
auth (index.js) 3.63KB 1.64KB
auth (invitation-status.js) 1.22KB 0.70KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 5.30KB 1.02KB
auth (useWorkspaceAdminStatus.js) 11.08KB 4.58KB
collaboration (CommentThread.js) 27.11KB 7.97KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.28KB 2.60KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.50KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 578.94KB 139.21KB
core (index.js) 10.00KB 3.96KB
create-plugin (index.js) 27.94KB 9.51KB
data-objectstack (index.js) 235.41KB 65.46KB
fields (index.js) 266.88KB 67.46KB
i18n (LocalizationContext.js) 2.92KB 1.42KB
i18n (builtinAggregateLabels.js) 0.86KB 0.49KB
i18n (currency.js) 2.59KB 1.22KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 8.87KB 3.64KB
i18n (index.js) 5.52KB 2.39KB
i18n (pickLocalized.js) 9.86KB 3.95KB
i18n (provider.js) 39.35KB 12.88KB
i18n (translateFn.js) 0.20KB 0.18KB
i18n (useDisplayLocale.js) 3.52KB 1.76KB
i18n (useObjectLabel.js) 38.37KB 10.31KB
i18n (useSafeTranslation.js) 7.14KB 2.92KB
layout (index.js) 41.50KB 11.82KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.75KB
mobile (index.js) 1.99KB 0.87KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 6.62KB 2.45KB
mobile (useResponsive.js) 0.72KB 0.42KB
mobile (useSpecGesture.js) 5.52KB 2.10KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 13.86KB 5.00KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.52KB 2.26KB
permissions (discardProofCache.js) 1.04KB 0.55KB
permissions (evaluator.js) 8.33KB 3.07KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 4.83KB 2.27KB
plugin-ai (index.js) 16.04KB 3.92KB
plugin-calendar (index.js) 53.39KB 15.52KB
plugin-charts (index.js) 84.26KB 23.05KB
plugin-chatbot (index.js) 199.63KB 47.46KB
plugin-dashboard (index.js) 144.22KB 38.99KB
plugin-designer (index.js) 231.46KB 48.87KB
plugin-detail (index.js) 247.86KB 65.27KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 176.62KB 45.75KB
plugin-gantt (index.js) 179.17KB 45.07KB
plugin-grid (index.js) 238.51KB 65.53KB
plugin-kanban (index.js) 52.17KB 16.37KB
plugin-list (index.js) 116.85KB 29.12KB
plugin-map (index.js) 25.60KB 8.62KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 44.12KB 12.29KB
plugin-timeline (index.js) 39.10KB 11.81KB
plugin-tree (index.js) 15.07KB 5.33KB
plugin-view (index.js) 90.64KB 22.85KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.81KB 3.58KB
providers (index.js) 0.45KB 0.23KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.62KB 2.34KB
react (LazyPluginLoader.js) 4.47KB 1.63KB
react (SchemaRenderer.js) 120.63KB 39.56KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.50KB 2.06KB
react (schema-input.js) 4.31KB 2.07KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (body-dialect.js) 4.50KB 1.99KB
sdui-parser (codegen.js) 9.45KB 3.76KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 7.30KB 3.12KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (parse.js) 25.28KB 7.80KB
sdui-parser (provenance.js) 3.84KB 1.90KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 23.87KB 7.83KB
types (ai.js) 4.39KB 2.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 4.12KB 1.61KB
types (authoring-nodes.js) 0.20KB 0.19KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (cloud.js) 0.20KB 0.18KB
types (complex.js) 4.44KB 2.07KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (dashboard-widget-layout.js) 2.06KB 0.96KB
types (data-display.js) 3.75KB 1.85KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.85KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (expression.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 1.13KB 0.65KB
types (form.js) 0.20KB 0.18KB
types (http-inflight.js) 8.87KB 3.73KB
types (http-retry.js) 4.32KB 2.02KB
types (icon-key-migration.js) 4.26KB 1.63KB
types (index.js) 5.78KB 2.70KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 5.00KB 2.39KB
types (navigation.js) 0.20KB 0.18KB
types (node-slots.js) 7.18KB 2.34KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 2.52KB 1.31KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (select-option.js) 0.20KB 0.19KB
types (spec-report.js) 4.99KB 1.96KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (strict-authoring-face.js) 19.93KB 7.25KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 8.11KB 3.32KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 7, 2026 18:19
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 7, 2026 18:19
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit 2b30d39 Oct 7, 2026
45 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-11772-flow-remove-node-edges branch October 7, 2026 18:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

2 participants