Skip to content

test(workflow-operator): add unit test coverage for visualization chart-config classes#5697

Open
aglinxinyuan wants to merge 2 commits into
apache:mainfrom
aglinxinyuan:test-visualization-chart-configs
Open

test(workflow-operator): add unit test coverage for visualization chart-config classes#5697
aglinxinyuan wants to merge 2 commits into
apache:mainfrom
aglinxinyuan:test-visualization-chart-configs

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Pin behavior of four previously-uncovered Jackson-annotated config classes that back visualization operators in common/workflow-operator/operator/visualization/. No production-code changes.

Spec Source class Tests
TablesConfigSpec TablesConfig 7
NestedTableConfigSpec NestedTableConfig 9
FigureFactoryTableConfigSpec FigureFactoryTableConfig 7
DumbbellDotConfigSpec DumbbellDotConfig 9

All four spec files follow the <srcClassName>Spec.scala one-to-one convention.

Behavior pinned (each class)

Surface Contract
Default field values empty strings on a fresh instance
Mutability var fields are assignable post-construction
JSON round-trip via objectMapper.writeValueAsString + readValue preserves every field
@JsonProperty(required = true) annotation present on every documented required field — verified via reflection
Distinct instances no static-field leakage across new calls

Per-class specifics

Spec Additional pins
TablesConfigSpec @NotNull annotation on attributeName (jakarta validation)
NestedTableConfigSpec newName serializes under wire-key name (per @JsonProperty(value = "name")); the field name newName MUST NOT appear as a JSON key; deserialization from {"name":...} re-populates newName
FigureFactoryTableConfigSpec @AutofillAttributeName annotation on attributeName (UI dropdown contract)
DumbbellDotConfigSpec dotValue serializes under wire-key dot; @NotNull + @AutofillAttributeName annotations; class-level @JsonSchemaInject restricts dot to integer/long/double attribute types

Any related issues, documentation, discussions?

Closes #5694.

How was this PR tested?

Pure unit-test additions; verified locally with:

  • sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.visualization.tablesChart.TablesConfigSpec org.apache.texera.amber.operator.visualization.nestedTable.NestedTableConfigSpec org.apache.texera.amber.operator.visualization.figureFactoryTable.FigureFactoryTableConfigSpec org.apache.texera.amber.operator.visualization.dumbbellPlot.DumbbellDotConfigSpec" — 32 tests, all green
  • sbt scalafmtCheckAll — clean
  • CI to confirm

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

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

…rt-config classes

Pins behavior of four previously-uncovered Jackson-annotated configs
in `common/workflow-operator/operator/visualization/`:
  - `TablesConfig` — required attributeName, @NotNull contract
  - `NestedTableConfig` — three fields, wire-key renaming for newName,
    required vs. optional split
  - `FigureFactoryTableConfig` — single required attributeName + autofill
  - `DumbbellDotConfig` — wire-key renaming for dotValue, @NotNull +
    autofill, plus the class-level @JsonSchemaInject restricting `dot`
    to numeric attribute types

Each spec pins defaults, mutability, JSON round-trip, instance
independence, and the Jackson + jakarta-validation annotations via
reflection — drift in any of those breaks UI dropdown behavior or
silently bypasses required-field validation.

Closes apache#5694
Copilot AI review requested due to automatic review settings June 13, 2026 23:27

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 adds Scala unit specs to pin the Jackson/validation/metadata-annotation contracts of four visualization operator config “bag” classes under common/workflow-operator/operator/visualization/, addressing the missing coverage described in #5694. It focuses on defaults, mutability, JSON serde round-trips, and reflection-based annotation checks, without changing production code.

Changes:

  • Added AnyFlatSpec-based unit tests for TablesConfig, NestedTableConfig, FigureFactoryTableConfig, and DumbbellDotConfig.
  • Verified @JsonProperty(required = true) (and where relevant, @JsonProperty(value=...)) contracts via reflection.
  • Added JSON round-trip tests using the project JSONUtils.objectMapper.

Reviewed changes

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

File Description
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/tablesChart/TablesConfigSpec.scala Adds unit coverage for TablesConfig defaults/mutability/serde/annotation contract.
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/nestedTable/NestedTableConfigSpec.scala Adds unit coverage for NestedTableConfig, including the newName ↔ wire-key name mapping.
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/figureFactoryTable/FigureFactoryTableConfigSpec.scala Adds unit coverage for FigureFactoryTableConfig, including @AutofillAttributeName.
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/dumbbellPlot/DumbbellDotConfigSpec.scala Adds unit coverage for DumbbellDotConfig, including wire-key dot and schema-inject annotation presence.

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

@codecov-commenter

codecov-commenter commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.63%. Comparing base (a044287) to head (bc33a15).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5697      +/-   ##
============================================
- Coverage     52.79%   52.63%   -0.16%     
+ Complexity     2548     2542       -6     
============================================
  Files          1090     1090              
  Lines         42150    42150              
  Branches       4529     4529              
============================================
- Hits          22253    22186      -67     
- Misses        18575    18656      +81     
+ Partials       1322     1308      -14     
Flag Coverage Δ *Carryforward flag
access-control-service 71.42% <ø> (ø)
agent-service 34.36% <ø> (ø) Carriedforward from f4924c4
amber 52.30% <ø> (-0.42%) ⬇️
computing-unit-managing-service 1.65% <ø> (ø)
config-service 56.71% <ø> (ø)
file-service 57.06% <ø> (ø)
frontend 47.93% <ø> (ø) Carriedforward from f4924c4
pyamber 90.67% <ø> (ø) Carriedforward from f4924c4
python 90.74% <ø> (ø) Carriedforward from f4924c4
workflow-compiling-service 58.69% <ø> (ø)

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

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

✅ No material benchmark regressions detected

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

CI benchmark results are noisy; treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
bs=10 sw=10 sl=64 393 0.24 24,869/36,241/36,241 us ⚪ within ±5% / ⚪ within ±5%
bs=100 sw=10 sl=64 811 0.495 122,359/144,486/144,486 us ⚪ within ±5% / 🔴 -9.4%
bs=1000 sw=10 sl=64 937 0.572 1,076,054/1,140,883/1,140,883 us ⚪ within ±5% / 🔴 +11.9%
Baseline details

Latest main a044287 from 2026-06-13T22:20:02.070Z

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 393 tuples/sec 395.36 tuples/sec 410.7 tuples/sec -0.6% -4.3%
bs=10 sw=10 sl=64 MB/s 0.24 MB/s 0.241 MB/s 0.251 MB/s -0.5% -4.3%
bs=10 sw=10 sl=64 p50 24,869 us 24,519 us 23,798 us +1.4% +4.5%
bs=10 sw=10 sl=64 p95 36,241 us 34,935 us 35,169 us +3.7% +3.0%
bs=10 sw=10 sl=64 p99 36,241 us 34,935 us 35,169 us +3.7% +3.0%
bs=100 sw=10 sl=64 throughput 811 tuples/sec 833.83 tuples/sec 894.84 tuples/sec -2.7% -9.4%
bs=100 sw=10 sl=64 MB/s 0.495 MB/s 0.509 MB/s 0.546 MB/s -2.7% -9.4%
bs=100 sw=10 sl=64 p50 122,359 us 120,315 us 111,887 us +1.7% +9.4%
bs=100 sw=10 sl=64 p95 144,486 us 145,017 us 139,602 us -0.4% +3.5%
bs=100 sw=10 sl=64 p99 144,486 us 145,017 us 139,602 us -0.4% +3.5%
bs=1000 sw=10 sl=64 throughput 937 tuples/sec 953.24 tuples/sec 1,045 tuples/sec -1.7% -10.3%
bs=1000 sw=10 sl=64 MB/s 0.572 MB/s 0.582 MB/s 0.638 MB/s -1.7% -10.3%
bs=1000 sw=10 sl=64 p50 1,076,054 us 1,052,108 us 969,370 us +2.3% +11.0%
bs=1000 sw=10 sl=64 p95 1,140,883 us 1,094,010 us 1,019,271 us +4.3% +11.9%
bs=1000 sw=10 sl=64 p99 1,140,883 us 1,094,010 us 1,019,271 us +4.3% +11.9%
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,508.55,200,128000,393,0.240,24869.42,36240.77,36240.77
1,100,10,64,20,2467.42,2000,1280000,811,0.495,122359.19,144486.26,144486.26
2,1000,10,64,20,21347.09,20000,12800000,937,0.572,1076053.62,1140882.58,1140882.58

- Reword "jakarta validation" -> "javax.validation" in TablesConfigSpec
  and DumbbellDotConfigSpec (codebase uses javax.validation.constraints).
- Pin @AutofillAttributeName on TablesConfig.attributeName via
  reflection (UI-dropdown contract; parallel to FigureFactoryTableConfig).
- Replace string-contains assertions on serialized JSON with
  ObjectMapper.readTree + JsonNode lookups in NestedTableConfigSpec
  and DumbbellDotConfigSpec, so the wire-key tests stay robust to
  Jackson formatting changes (spaces, key ordering).

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

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

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

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

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.

add unit test coverage for visualization chart-config classes

3 participants