mengw15 opened a new pull request, #7916:
URL: https://github.com/apache/texera/pull/7916

   ### What changes were proposed in this PR?
   
   Extends `operator-property-edit-frame.component.spec.ts` with 23 tests 
covering
   the Python-UDF environment-loading branch and the early-return guards. 
Measured
   locally with `--coverage --coverage-reporters=lcovonly`:
   
   | `operator-property-edit-frame.component.ts` | Before | After |
   | --- | --- | --- |
   | lines | 350/422 (82.94 %) | **373/422 (88.39 %)** |
   | branches | 230/292 | **252/292** |
   | functions | 70/92 | **76/92** |
   
   Every line the issue lists is now covered. The remainder of the file is the 
Quill
   title-editing block, which the issue scopes out.
   
   **Python UDF environment loading.** The branch only runs for a Python UDF
   operator and the mock metadata declares none, so the test stubs
   `DynamicSchemaService.getDynamicSchema` rather than adding a fixture operator
   type; `ComputingUnitStatusService` and `WorkflowPveService` are stubbed with
   `of(...)` / `throwError(...)`, so every emission is synchronous.
   
   - `defaultEnv` is seeded when the operator's properties omit it, and an 
explicit
     `defaultEnv: false` is left alone.
   - The unit's `cuid` reaches `fetchPVEs`, and the fetched names arrive as the
     `envName` field's `props.options` — that is the observable end of
     `patchPythonUdfEnvironmentSchema` → `setFormlyFormBinding`. The two other 
arms
     (a unit with no `cuid`, and no unit at all) assert the fetch is skipped 
and the
     field binds with an empty option list.
   - Both sides of the error handler's `err instanceof Error` ternary, each 
asserting
     the exact `notificationService.error` message *and* that the fallback 
binding
     still ran (`props.options` empty, `expressions.hide` set).
   - `patchPythonUdfEnvironmentSchema`'s guard on a schema with no `properties` 
and
     one where `properties` is `true`; `hideEnvNameWhenDefaultEnvChecked` with 
no
     `envName` field present.
   
   **Guards.** `ngOnChanges` with no id; the status-update subscription with and
   without a selected operator; the ui-parameter subscription for a different
   operator; `isHuggingFaceOperator`; `checkOperatorProperty` on an operator 
deleted
   mid-debounce; both `typeInferenceOnLambdaFunction` early returns; and the
   attribute-type validator's `isDefined` chains — no operator selected, a rule
   naming a property the schema does not declare, a property with no
   `autofillAttributeOnPort`, a `const` rule with no `$data`, and a `$data`
   comparison whose two attributes resolve to the same type.
   
   One item from the issue is **not** covered, deliberately: the `if 
(this.currentOperatorId)`
   guard inside `registerOnFormChangeHandler` (line 738). 
`checkOperatorProperty`
   filters the stream *after* the debounce and already returns false when no 
operator
   is selected, so the handler can only ever run with an id set — the false arm 
is
   unreachable through the public stream. The test kept for that scenario 
asserts
   what is actually observable: deselecting mid-debounce results in no property
   write. No production code was changed.
   
   ### Any related issues, documentation, discussions?
   
   Closes #7910.
   
   ### How was this PR tested?
   
   `ng test --watch=false --include 
src/app/workspace/component/property-editor/operator-property-edit-frame/operator-property-edit-frame.component.spec.ts`
   — 219 passed / 1 skipped (196 passed before, 23 new), repeated 3× for 
stability;
   the whole `property-editor/**` folder stays green at 288 passed. `yarn 
format:ci`
   clean. Failure path verified by breaking one assertion in each of the 23 new
   tests: every one turned red with a non-zero exit, then all were restored to 
green.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to