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

   ### What changes were proposed in this PR?
   
   `ValidationWorkflowService.combineValidation` is what folds the per-check 
results (JSON-schema validation and operator-connection validation) into the 
single verdict the workflow editor acts on:
   
   ```ts
   public static combineValidation(...validations: Validation[]): Validation
   ```
   
   It had no direct test. This PR adds one, covering the three decisions the 
implementation actually makes:
   
   - **Validity is an AND** across all validations, independent of argument 
order.
   - **Messages are merged only from the validations that failed.** The merge 
is guarded on `validation.isValid` rather than on the `messages` key being 
absent, so a stray `messages` field on something reporting `isValid: true` is 
dropped rather than leaking into the combined result.
   - **A later failure wins** when two failing validations use the same message 
key, since the merge is a spread in argument order.
   
   Two shape details are asserted as well, because call sites depend on them:
   
   - The valid branch returns `{ isValid }` only — it omits `messages` entirely 
rather than returning an empty map, so reading `messages` off a valid result 
yields `undefined`.
   - A no-argument call is vacuously valid.
   
   No production code is changed; this is a test-only PR.
   
   ### Any related issues, documentation, discussions?
   
   Closes #6684
   
   ### How was this PR tested?
   
   Nine cases were added to `validation-workflow.service.spec.ts` in a new 
top-level `describe`. `combineValidation` is static, so the block needs no 
`TestBed` setup.
   
   | Case | Asserts |
   | --- | --- |
   | no arguments | vacuously valid, `messages` is `undefined` |
   | all valid | result is exactly `{ isValid: true }` |
   | one invalid | invalid, carries that validation's messages |
   | invalid first / invalid last | invalid either way (order independence) |
   | several invalid | message maps are merged |
   | key collision | the later failure's message wins |
   | stray `messages` on a valid validation | dropped from the result |
   | invalid with an empty message map | invalid, `messages` is `{}` |
   | any combination | the input validations are not mutated |
   
   ```
   npx ng test --watch=false --include="**/validation-workflow.service.spec.ts"
   # Test Files  1 passed (1)
   #      Tests  19 passed (19)     <- 10 existing + 9 added here
   ```
   
   `npx prettier --check` reports no diff on the changed file.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Yes, partially. I (Suyash Jain) worked on this PR together with Claude Code 
as a pair-programming assistant. The added specs were run locally against the 
existing suite before opening this PR.
   
   Generated-by: Claude Code (Claude 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