Matt Gilman created NIFI-16406:
----------------------------------

             Summary: Avoid sanitizing nonexistent connection positions in 
canvas flow snapshots
                 Key: NIFI-16406
                 URL: https://issues.apache.org/jira/browse/NIFI-16406
             Project: Apache NiFi
          Issue Type: Bug
          Components: Core UI
            Reporter: Matt Gilman


h2. Background

Canvas connections do not have a position. Their canvas geometry is represented 
by bends and labelIndex.

The connector canvas flow sanitizer currently passes connection.position to 
sanitizePosition(). Because connection.position is normally undefined, every 
connection is incorrectly treated as having a corrupt position.

The flow-designer sanitizer contains the same behavior.

h2. Current Behavior

Loading a connector canvas logs a warning for each connection:

{code}
Component Connection 106a6c6f-60ea-3aec-8544-f279243aafe3 has an out-of-range 
position undefined — falling back to (0, 0). Drag the component to a new 
location and save to repair the persisted value.
{code}

The warning is misleading:

* The persisted connection is not corrupt.
* Connections cannot be repaired by dragging them to a new position.
* The sanitizer adds an artificial position of (0, 0) to a non-positionable 
entity.

h2. Root Cause

The connection-specific sanitizer currently performs both of these operations:

* Sanitizes entity.position.
* Sanitizes component.bends.

Connections should only have their bend coordinates sanitized.

The affected paths are:

* 
apps/nifi/src/app/pages/connectors/state/connector-canvas/connector-canvas.effects.ts
* apps/nifi/src/app/pages/flow-designer/state/flow/flow.effects.ts

h2. Expected Behavior

* Connection entities are not passed through position sanitization.
* Connection bend coordinates continue to be sanitized.
* Loading a valid connection without position does not log a warning.
* Positionable canvas components continue to receive the existing position 
validation.

h2. Implementation Notes

Connections do not have a singular position property. Their canvas geometry is 
determined by their endpoints and bend coordinates, while labelIndex identifies 
the segment used for label placement.

The sanitizer should validate each bend coordinate without attempting to 
validate or add connection.position.

The same correction is required in both the connector canvas and flow-designer 
ingestion paths.

h2. Acceptance Criteria

* Connector canvas does not call sanitizePosition() for connection.position.
* Flow designer does not call sanitizePosition() for connection.position.
* Connection bends remain protected against non-finite and out-of-range 
coordinates.
* Valid connections without position produce no console warning.
* Invalid connection bends are replaced with the fallback coordinate and emit 
the expected warning.
* Unit tests cover positionless connections and invalid connection bends in 
both canvas paths.
* Existing position sanitization tests for processors, ports, funnels, labels, 
process groups, and remote process groups continue to pass.
* Frontend lint, unit tests, and production build pass.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to