Skip to content

test(workflow-graph): cover isSink and isPythonUdf - #8603

Open
suyashj1231 wants to merge 1 commit into
apache:mainfrom
suyashj1231:test/6674-issink-ispythonudf
Open

suyashj1231 wants to merge 1 commit into
apache:mainfrom
suyashj1231:test/6674-issink-ispythonudf

Conversation

@suyashj1231

@suyashj1231 suyashj1231 commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

isSink and isPythonUdf in workflow-graph.ts both gate real behavior but had no test coverage:

  • isSink decides which operators the result panel renders, and which ones the operator menu allows caching for.
  • isPythonUdf decides whether the console is displayed and whether the UDF parameter sync runs.

The two helpers use deliberately different matching rules, and this PR pins both down:

isSink       // case-insensitive substring match on "sink"
isPythonUdf  // exact membership in the three V2 UDF type constants

Two consequences of those rules are asserted explicitly, since both are easy to misread at a call site:

  1. Because isSink matches on a substring rather than an anchored suffix, an unrelated operator whose type merely contains "sink" is reported as a sink. The test records this rather than leaving it to be rediscovered.
  2. "PythonUDF" — the legacy non-V2 type, already present in the mock fixtures as mockPythonUDFPredicate — is not a Python UDF according to isPythonUdf, which matches only PythonUDFV2, PythonUDFSourceV2 and DualInputPortsPythonUDFV2.

No production code is changed; this is a test-only PR.

Any related issues, documentation, discussions?

Closes #6674

How was this PR tested?

Ten cases were added to the existing workflow-graph.spec.ts, in two new describe blocks, reusing the existing mock fixtures and a small operatorOfType helper for the synthetic type names.

Helper Cases
isSink view-result operator is a sink; scan/sentiment/UDF operators are not; case-insensitivity across Sink/sink/SINK/CsvFileSink/sinkOperator; substring looseness (SinkholeDetector); near-miss types (Sin, Ink, Snik, "")
isPythonUdf all three V2 constants match; legacy PythonUDF does not; JavaUDF/scan/result do not; exact-match rule holds against wrong case and superstrings
npx ng test --watch=false --include="**/workflow-graph.spec.ts"
# Test Files  1 passed (1)
#      Tests  78 passed (78)     <- 68 existing + 10 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.

Both helpers gate real behaviour — isSink decides which operators the
result panel renders and which ones the operator menu lets you cache,
isPythonUdf decides whether the console and the UDF parameter sync run —
but neither had any test.

The two use different matching rules, and the tests pin both down:

  isSink       case-insensitive substring match on "sink"
  isPythonUdf  exact membership in the three V2 UDF type constants

The substring rule means an unrelated operator whose type merely
contains "sink" is reported as a sink; that case is covered explicitly so
the looseness is recorded rather than discovered later. On the other
side, "PythonUDF" (the legacy non-V2 type, already in the mock fixtures)
is not a Python UDF by this helper, which is easy to misread at a call
site, so it is asserted directly.

Closes apache#6674

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: @kz930
    You can notify them by mentioning @kz930 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 (74ac4fe).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8603   +/-   ##
=========================================
  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 @kz930 Would you mind having a look at this one when you get a chance? It's test-only, just a few cases covering isSink and isPythonUdf. thank you!

@kz930 kz930 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.

Verified the two helpers against workflow-graph.ts and ran the spec locally: 78 passing. Good call pinning the legacy PythonUDF case and the substring looseness of isSink. LGTM.

@kz930

kz930 commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Already approved, this is just a note for later. isSink uses toLocaleLowerCase(), so the "SINK" case is locale-dependent: under a tr-TR runtime it lowercases to "sınk" and stops matching. Nothing to change in this PR, the only real type containing "sink" is SimpleSink and its i is already lowercase, but toLowerCase() would be the locale-independent choice if that helper is ever touched. I create PR 8616 as an issue that cover this problem.

This branch has not been deployed

No deployments
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 isSink and isPythonUdf

3 participants