The GitHub Actions job "Required Checks" on texera.git/main has failed.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
43ca4b2c70849af57656bc9a777d0e53f617bcc4 / Prateek Ganigi 
<[email protected]>
refactor(frontend): avoid redundant validateOperator call in 
applyOperatorBorder (#5702)

### What changes were proposed in this PR?

WorkflowEditorComponent.applyOperatorBorder(operatorID)` always
recomputes validation as its first step:

```typescript
const validation = this.validationWorkflowService.validateOperator(operatorID);
```

This is redundant when the helper is called from the validation-stream
subscriber in handleOperatorValidation, the stream's emitted event
already carries the Validation result that was just computed by
updateValidationState.

This PR:
- Adds an optional validation?: Validation parameter to
applyOperatorBorder. The helper uses it when provided, and falls back to
validateOperator(operatorID) otherwise.
- Updates handleOperatorValidation to pass value.validation from the
stream into the helper.
- Leaves the operator-add stream subscriber unchanged and hence it
doesn't have a Validation in hand at that point, so it correctly falls
through to the lazy-fetch path.
- Functionally identical (the stream emits the same Validation that
would have been recomputed), purely avoids the duplicate call.

Originally flagged as an optional nit during the PR #5146 review.
Attempted in PR #5626 but split out as per the reviewer's request so
that PR could stay scoped to test restructuring; this PR completes the
follow-up.

### Any related issues, documentation, discussions?

Closes #5683
Related: PR #5146 (where the nit was raised), PR #5626 (where this was
attempted and split out).

### How was this PR tested?

Added one focused unit test in `workflow-editor.component.spec.ts`
inside the existing `operator border restoration after navigation`
describe block: `it("uses the Validation passed in instead of
recomputing it", ...)`. The test clears the `validateOperator` spy after
the operator-add validation chain settles, then calls
`applyOperatorBorder` directly with a `Validation` argument and asserts
`validateOperator` is not called.

Verified locally:
- `tsc --noEmit`: clean
- `eslint`: clean
- `ng test` (jsdom): 26/26 pass in the editor spec (was 25, new test
adds one)
- `ng run gui:test-browser`: 13/13 pass

### Was this PR authored or co-authored using generative AI tooling?

This PR was co-authored using Claude Code (Anthropic Claude Opus 4.7)

Report URL: https://github.com/apache/texera/actions/runs/28150501801

With regards,
GitHub Actions via GitBox

Reply via email to