test(workflow-graph): cover isSink and isPythonUdf - #8603
suyashj1231 wants to merge 1 commit into
Conversation
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
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
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 |
kz930
left a comment
There was a problem hiding this comment.
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.
|
Already approved, this is just a note for later. |
What changes were proposed in this PR?
isSinkandisPythonUdfinworkflow-graph.tsboth gate real behavior but had no test coverage:isSinkdecides which operators the result panel renders, and which ones the operator menu allows caching for.isPythonUdfdecides 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:
Two consequences of those rules are asserted explicitly, since both are easy to misread at a call site:
isSinkmatches 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."PythonUDF"— the legacy non-V2 type, already present in the mock fixtures asmockPythonUDFPredicate— is not a Python UDF according toisPythonUdf, which matches onlyPythonUDFV2,PythonUDFSourceV2andDualInputPortsPythonUDFV2.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 newdescribeblocks, reusing the existing mock fixtures and a smalloperatorOfTypehelper for the synthetic type names.isSinkSink/sink/SINK/CsvFileSink/sinkOperator; substring looseness (SinkholeDetector); near-miss types (Sin,Ink,Snik,"")isPythonUdfPythonUDFdoes not;JavaUDF/scan/result do not; exact-match rule holds against wrong case and superstringsnpx prettier --checkreports 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.