Skip to content

test(workflow-core): fill uncovered branches in tuple and type utilities#6055

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:test-core-tuple-type-coverage
Jul 2, 2026
Merged

test(workflow-core): fill uncovered branches in tuple and type utilities#6055
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:test-core-tuple-type-coverage

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Fill uncovered code paths in five workflow-core tuple/type utility classes, selected from the Codecov report (not spec-name gaps). No production-code changes.

File Codecov before Missed lines targeted
Tuple.scala 54.1% 24 — getField miss/Attribute overload, enforceSchema, equals branches (incl. binary contents / non-Tuple), getPartialTuple, toString, size/type-mismatch throws, 3-arg builder add + null guards, case-class synthetics
TupleLike.scala 12.8% 32 — SeqTupleLike/MapTupleLike enforceSchema (positional vs name-based, null fill, extras dropped), inMemSize ???, all seven TupleLike.apply overloads, the NotAnIterable guard implicit
AttributeType.java 47.2% 18 — getName ANY branch (""), the full getAttributeType(Class) mapping incl. primitive/unknown fallback to ANY
AttributeTypeUtils.scala 71.7% 20 (+29 partials) — SchemaCasting, tupleCasting, both parseFields overloads, null-inference early-returns, BINARY/ANY inference fallback, LONG/DOUBLE compare, unsupported-type throws, forced-parse failures
ArrowUtils.scala 67.8% 15 — appendTexeraTuple/setTexeraTuple/getTexeraTuple round-trip (all 7 types + nulls + row indices), parse-failure → null field, fromAttributeType(null) throw, unrecognized texera_type metadata fallback

Extends the existing TupleSpec, AttributeTypeUtilsSpec, and ArrowUtilsSpec (the operator-module ArrowUtilsSpec doesn't attribute coverage to workflow-core sources), and adds TupleLikeSpec / AttributeTypeSpec.

Behavior notes pinned along the way: $attrType error messages render the lowercase wire name; the NotAnIterable iterable-guard implicit is not summoned for multi-iterable varargs under Scala 2.13 inference (pinned by direct invocation).

Any related issues, documentation, discussions?

Follow-up to the review feedback on #6043: prioritize tests that fill uncovered code paths.

How was this PR tested?

  • sbt "WorkflowCore/testOnly *TupleSpec *TupleLikeSpec *AttributeTypeSpec *AttributeTypeUtilsSpec org.apache.texera.amber.util.ArrowUtilsSpec" — 105 tests, all green
  • sbt "WorkflowCore/Test/scalafmtCheck" and sbt "WorkflowCore/scalafixAll --check" — clean
  • CI + Codecov delta to confirm

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8 [1M context])

Targets Codecov-missed lines: Tuple (24), TupleLike (32), AttributeType (18),
AttributeTypeUtils (20), ArrowUtils (15). Extends the existing TupleSpec,
AttributeTypeUtilsSpec, and ArrowUtilsSpec, and adds TupleLikeSpec and
AttributeTypeSpec.
Copilot AI review requested due to automatic review settings July 2, 2026 04:56
@github-actions github-actions Bot added the common label Jul 2, 2026
@github-actions

github-actions Bot commented Jul 2, 2026

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: @carloea2, @Yicong-Huang
    You can notify them by mentioning @carloea2, @Yicong-Huang in a comment.

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.

Pull request overview

This PR increases unit-test coverage in the common/workflow-core module by exercising previously uncovered branches in tuple/type utilities and Arrow tuple round-tripping, without modifying production code.

Changes:

  • Expanded TupleSpec to cover additional Tuple behaviors (schema enforcement, equality branches, partial tuples, builder guards).
  • Added new specs for TupleLike and AttributeType to cover factory overloads and type mappings.
  • Extended AttributeTypeUtilsSpec and ArrowUtilsSpec to cover parsing/casting edge paths and Arrow↔Texera tuple conversions (including metadata/tag and failure fallbacks).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
common/workflow-core/src/test/scala/org/apache/texera/amber/util/ArrowUtilsSpec.scala Adds round-trip tests for appendTexeraTuple/setTexeraTuple/getTexeraTuple, parse-failure fallback, null handling, and schema metadata fallback.
common/workflow-core/src/test/scala/org/apache/texera/amber/core/tuple/TupleSpec.scala Adds coverage for getField overloads, enforceSchema, equality branches, partial tuple creation, toString, builder guards, and case-class synthetics.
common/workflow-core/src/test/scala/org/apache/texera/amber/core/tuple/TupleLikeSpec.scala New suite covering SeqTupleLike/MapTupleLike enforcement behaviors and TupleLike.apply overloads (including the iterable-guard implicit).
common/workflow-core/src/test/scala/org/apache/texera/amber/core/tuple/AttributeTypeUtilsSpec.scala Adds coverage for schema/tuple casting helpers, parse/infer branches, numeric compare ordering, and unsupported-type error branches.
common/workflow-core/src/test/scala/org/apache/texera/amber/core/tuple/AttributeTypeSpec.scala New suite covering getName (including ANY branch), getAttributeType(Class) mappings, and round-trips via getFieldClass.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Keep both sides of ArrowUtilsSpec: main's State wire-hop tuple round-trip
and this branch's setTexeraTuple/appendTexeraTuple/getTexeraTuple coverage.
@codecov-commenter

codecov-commenter commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.61%. Comparing base (878eb8a) to head (468a772).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6055      +/-   ##
============================================
+ Coverage     56.37%   56.61%   +0.23%     
- Complexity     2992     3007      +15     
============================================
  Files          1129     1129              
  Lines         43802    43802              
  Branches       4743     4743              
============================================
+ Hits          24695    24799     +104     
+ Misses        17658    17569      -89     
+ Partials       1449     1434      -15     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø)
agent-service 44.59% <ø> (ø) Carriedforward from 878eb8a
amber 58.00% <ø> (+0.62%) ⬆️
computing-unit-managing-service 0.00% <ø> (ø)
config-service 52.30% <ø> (ø)
file-service 62.81% <ø> (ø)
frontend 50.06% <ø> (ø) Carriedforward from 878eb8a
notebook-migration-service 78.57% <ø> (ø)
pyamber 91.15% <ø> (ø) Carriedforward from 878eb8a
python 90.69% <ø> (ø) Carriedforward from 878eb8a
workflow-compiling-service 55.14% <ø> (ø)

*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.

@aglinxinyuan aglinxinyuan requested a review from mengw15 July 2, 2026 05:09
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 0 better · 🔴 7 worse · ⚪ 8 noise (<±5%) · 0 without baseline

Compared against main 878eb8a benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 397 0.243 24,983/36,688/36,688 us 🔴 +15.5% / 🔴 +148.2%
🔴 bs=100 sw=10 sl=64 792 0.483 125,798/156,251/156,251 us 🔴 +18.2% / 🔴 +46.2%
bs=1000 sw=10 sl=64 925 0.565 1,081,672/1,148,620/1,148,620 us ⚪ within ±5% / 🔴 +12.2%
Baseline details

Latest main 878eb8a from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 397 tuples/sec 406 tuples/sec 786.27 tuples/sec -2.2% -49.5%
bs=10 sw=10 sl=64 MB/s 0.243 MB/s 0.248 MB/s 0.48 MB/s -2.0% -49.4%
bs=10 sw=10 sl=64 p50 24,983 us 21,627 us 12,495 us +15.5% +99.9%
bs=10 sw=10 sl=64 p95 36,688 us 34,117 us 14,784 us +7.5% +148.2%
bs=10 sw=10 sl=64 p99 36,688 us 34,117 us 18,468 us +7.5% +98.7%
bs=100 sw=10 sl=64 throughput 792 tuples/sec 841 tuples/sec 991.49 tuples/sec -5.8% -20.1%
bs=100 sw=10 sl=64 MB/s 0.483 MB/s 0.513 MB/s 0.605 MB/s -5.8% -20.2%
bs=100 sw=10 sl=64 p50 125,798 us 120,046 us 100,929 us +4.8% +24.6%
bs=100 sw=10 sl=64 p95 156,251 us 132,220 us 106,894 us +18.2% +46.2%
bs=100 sw=10 sl=64 p99 156,251 us 132,220 us 114,085 us +18.2% +37.0%
bs=1000 sw=10 sl=64 throughput 925 tuples/sec 910 tuples/sec 1,023 tuples/sec +1.6% -9.6%
bs=1000 sw=10 sl=64 MB/s 0.565 MB/s 0.556 MB/s 0.624 MB/s +1.6% -9.5%
bs=1000 sw=10 sl=64 p50 1,081,672 us 1,104,210 us 983,835 us -2.0% +9.9%
bs=1000 sw=10 sl=64 p95 1,148,620 us 1,144,170 us 1,023,777 us +0.4% +12.2%
bs=1000 sw=10 sl=64 p99 1,148,620 us 1,144,170 us 1,053,883 us +0.4% +9.0%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,503.23,200,128000,397,0.243,24983.19,36688.41,36688.41
1,100,10,64,20,2526.10,2000,1280000,792,0.483,125798.11,156251.25,156251.25
2,1000,10,64,20,21618.08,20000,12800000,925,0.565,1081672.24,1148620.33,1148620.33

@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

@aglinxinyuan aglinxinyuan added this pull request to the merge queue Jul 2, 2026
Merged via the queue into apache:main with commit 24b587f Jul 2, 2026
37 of 40 checks passed
@aglinxinyuan aglinxinyuan deleted the test-core-tuple-type-coverage branch July 2, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants