Skip to content

test(validation): cover ValidationWorkflowService.combineValidation - #8604

Merged
mengw15 merged 1 commit into
apache:mainfrom
suyashj1231:test/6684-combine-validation
Sep 20, 2026
Merged

mengw15 merged 1 commit into
apache:mainfrom
suyashj1231:test/6684-combine-validation

Conversation

@suyashj1231

@suyashj1231 suyashj1231 commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

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:

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.

combineValidation is what turns per-check results into the single
verdict the workflow editor acts on, and it had no direct test.

The cases pin down the three things the implementation decides:

  - validity is an AND across all validations, order-independent
  - messages are merged only from the validations that failed, so a
    stray `messages` on something reporting isValid: true is dropped
  - a later failure wins when two failures use the same message key

Two shape details are asserted too, since call sites depend on them: the
valid result omits `messages` entirely rather than returning an empty
map, and the no-argument call is vacuously valid.

Closes apache#6684

Claude-Session: https://claude.ai/code/session_01EeaEYRdhRYWL7ya7w8LJux
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Sep 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @mengw15
    You can notify them by mentioning @mengw15 in a comment.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.76%. Comparing base (e7d1676) to head (2ec9039).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8604   +/-   ##
=========================================
  Coverage     92.76%   92.76%           
  Complexity     4897     4897           
=========================================
  Files          1236     1236           
  Lines         52155    52163    +8     
  Branches       6409     6410    +1     
=========================================
+ Hits          48380    48391   +11     
  Misses         2194     2194           
+ Partials       1581     1578    -3     
Flag Coverage Δ *Carryforward flag
access-control-service 71.78% <ø> (ø) Carriedforward from e7d1676
agent-service 99.16% <ø> (ø) Carriedforward from e7d1676
amber 88.59% <ø> (ø) Carriedforward from e7d1676
computing-unit-managing-service 55.20% <ø> (ø) Carriedforward from e7d1676
config-service 87.37% <ø> (ø) Carriedforward from e7d1676
file-service 81.53% <ø> (ø) Carriedforward from e7d1676
frontend 96.59% <ø> (+0.01%) ⬆️
notebook-migration-service 83.73% <ø> (ø) Carriedforward from e7d1676
pyamber 98.41% <ø> (ø) Carriedforward from e7d1676
workflow-compiling-service 74.09% <ø> (ø) Carriedforward from e7d1676

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@suyashj1231

Copy link
Copy Markdown
Contributor Author

Hi @mengw15 Would you mind having a look at this one when you get a chance? It's test-only, just a few cases covering combineValidation.

@mengw15
mengw15 requested a lite review from Copilot September 20, 2026 18:03

@mengw15 mengw15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The test-only changes accurately cover the documented behavior without introducing issues.

Review effort: Lite
Findings: None

What changed in this PR

Adds direct unit coverage for ValidationWorkflowService.combineValidation, validating aggregation semantics and edge cases.

Changes:

  • Tests validity aggregation and message merging.
  • Covers empty inputs, collisions, stray messages, and mutation safety.
File Description
frontend/​src/​app/​workspace/​service/​validation/​validation-workflow.service.spec.ts Adds nine focused combineValidation tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Merged via the queue into apache:main with commit c16e152 Sep 20, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit test coverage for combineValidation

4 participants