Skip to content

test(amber, common): remove unused spec mixins and bindings - #9597

Merged
aglinxinyuan merged 3 commits into
apache:mainfrom
aglinxinyuan:test/scala-unused-spec-mixins
Nov 23, 2026
Merged

aglinxinyuan merged 3 commits into
apache:mainfrom
aglinxinyuan:test/scala-unused-spec-mixins

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Remove unused ScalaTest mixin traits, unread local exception bindings, and type checks that cannot fail across 31 test specs in amber, common/workflow-core, and common/workflow-operator, and shut down the actor systems of the two TestKit specs that never did. No production code changes:

  • Unused MockFactory mixin (amber): Remove the MockFactory trait and import in NetworkInputGatewaySpec, CostBasedScheduleGeneratorSpec, RangeBasedShuffleSpec, and WorkerSpec, which create no mocks or stubs.
  • Unused BeforeAndAfterEach mixin (amber, common/workflow-core): Remove the trait and import in BatchSizePropagationSpec, DataProcessorSpec, TrivialControlSpec, FileResolverSpec, LargeBinaryInputStreamSpec, LargeBinaryOutputStreamSpec, and S3StorageClientSpec, which define no per-test hooks.
  • Unused or redundant BeforeAndAfterAll mixin (amber, common/workflow-core): Remove it from DefaultCostEstimatorSpec, IcebergDocumentConsoleMessagesSpec, and LakeFSStorageClientMtimeSpec, which define no suite hooks, and from LargeBinaryInputStreamSpec, LargeBinaryOutputStreamSpec, and S3StorageClientSpec, whose S3StorageTestBase already extends it; their super.beforeAll()/super.afterAll() chains are unchanged.
  • Missing actor-system shutdown (amber): LoggingSpec and ReplaySpec mixed in BeforeAndAfterAll with no hook and never shut down their TestKit actor systems; they now call TestKit.shutdownActorSystem(system) in afterAll, like the other TestKit specs.
  • Unused BeforeAndAfter mixin (common/workflow-operator): Remove the trait and import in URLFetcherOpExecSpec, TypeCastingOpExecSpec, HtmlVizOpExecSpec, and KeywordSearchOpExecSpec, which have no before/after blocks.
  • Unread val ex = bindings and type checks that cannot fail (common/workflow-operator): Drop 17 unread val ex = assignments on expectError[AssertionError](...) calls across 10 visualization operator specs (ImageVisualizerOpDescSpec, ScatterMatrixChartOpDescSpec, ContinuousErrorBandsOpDescSpec, FigureFactoryTableOpDescSpec, HistogramChartOpDescSpec, TablesPlotOpDescSpec, TernaryContourOpDescSpec, TernaryPlotOpDescSpec, WaterfallChartOpDescSpec, and WindRoseChartOpDescSpec). In ContinuousErrorBandsOpDescSpec, NestedTableOpDescSpec, WaterfallChartOpDescSpec, and WindRoseChartOpDescSpec, also replace each val ex = expectError[AssertionError](...) followed by ex shouldBe a[AssertionError] with a bare expectError call, since expectError already returns the intercepted AssertionError.

Any related issues, documentation, discussions?

Closes #9595.

How was this PR tested?

Ran on 7e79747ea8 (JDK 17.0.14, sbt 1.12.9, STORAGE_ICEBERG_CATALOG_TYPE=hadoop, Docker running for the WorkflowCore RustFS and LakeFS test containers):

sbt --batch \
  "WorkflowCore/scalafmtCheckAll" \
  "WorkflowOperator/scalafmtCheckAll" \
  "WorkflowExecutionService/scalafmtCheckAll" \
  "WorkflowCore/scalafixAll --check" \
  "WorkflowOperator/scalafixAll --check" \
  "WorkflowExecutionService/scalafixAll --check"

sbt --batch "WorkflowOperator/testOnly org.apache.texera.amber.operator.keywordSearch.KeywordSearchOpExecSpec org.apache.texera.amber.operator.source.fetcher.URLFetcherOpExecSpec org.apache.texera.amber.operator.typecasting.TypeCastingOpExecSpec org.apache.texera.amber.operator.visualization.ImageViz.ImageVisualizerOpDescSpec org.apache.texera.amber.operator.visualization.ScatterMatrixChart.ScatterMatrixChartOpDescSpec org.apache.texera.amber.operator.visualization.continuousErrorBands.ContinuousErrorBandsOpDescSpec org.apache.texera.amber.operator.visualization.figureFactoryTable.FigureFactoryTableOpDescSpec org.apache.texera.amber.operator.visualization.histogram.HistogramChartOpDescSpec org.apache.texera.amber.operator.visualization.htmlviz.HtmlVizOpExecSpec org.apache.texera.amber.operator.visualization.nestedTable.NestedTableOpDescSpec org.apache.texera.amber.operator.visualization.tablesChart.TablesPlotOpDescSpec org.apache.texera.amber.operator.visualization.ternaryContour.TernaryContourOpDescSpec org.apache.texera.amber.operator.visualization.ternaryPlot.TernaryPlotOpDescSpec org.apache.texera.amber.operator.visualization.waterfallChart.WaterfallChartOpDescSpec org.apache.texera.amber.operator.visualization.windRoseChart.WindRoseChartOpDescSpec"

sbt --batch "WorkflowCore/testOnly org.apache.texera.amber.storage.FileResolverSpec org.apache.texera.service.util.LargeBinaryInputStreamSpec org.apache.texera.service.util.LargeBinaryOutputStreamSpec org.apache.texera.service.util.S3StorageClientSpec org.apache.texera.amber.core.storage.util.LakeFSStorageClientMtimeSpec"

sbt --batch "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.messaginglayer.NetworkInputGatewaySpec org.apache.texera.amber.engine.architecture.messaginglayer.RangeBasedShuffleSpec org.apache.texera.amber.engine.architecture.scheduling.CostBasedScheduleGeneratorSpec org.apache.texera.amber.engine.architecture.scheduling.DefaultCostEstimatorSpec org.apache.texera.amber.engine.architecture.worker.DataProcessorSpec org.apache.texera.amber.engine.architecture.worker.WorkerSpec org.apache.texera.amber.engine.architecture.control.TrivialControlSpec org.apache.texera.amber.engine.e2e.BatchSizePropagationSpec org.apache.texera.amber.engine.faulttolerance.LoggingSpec org.apache.texera.amber.engine.faulttolerance.ReplaySpec org.apache.texera.amber.storage.result.iceberg.IcebergDocumentConsoleMessagesSpec"
  • scalafmtCheckAll and scalafixAll --check across WorkflowCore, WorkflowOperator, and WorkflowExecutionService: passed.
  • WorkflowOperator: 15 suites, 94 passed (0 failed, 0 skipped).
  • WorkflowCore: 5 suites, 118 passed (0 failed, 0 skipped).
  • WorkflowExecutionService: 11 suites, 65 passed (0 failed, 0 skipped).

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

Generated-by: Antigravity (Gemini 4 Neon), Claude Code (Claude Opus 5.5)

Copilot AI balanced review requested due to automatic review settings November 21, 2026 01:54

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 was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

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

  • Committers with relevant context: @parshimers
    You can request their reviews formally with /request-review @parshimers.

  • Contributors with relevant context: @Yicong-Huang, @mengw15, @Ma77Ball
    You can notify them by mentioning @Yicong-Huang, @mengw15, @Ma77Ball in a comment.

@codecov-commenter

codecov-commenter commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.66%. Comparing base (95e2748) to head (7e79747).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9597      +/-   ##
============================================
- Coverage     91.67%   91.66%   -0.02%     
  Complexity     5135     5135              
============================================
  Files          1304     1301       -3     
  Lines         58088    57943     -145     
  Branches       7582     7546      -36     
============================================
- Hits          53254    53112     -142     
+ Misses         2922     2919       -3     
  Partials       1912     1912              
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.55% <ø> (-0.01%) ⬇️ Carriedforward from 6c774a5
amber 85.76% <ø> (ø)
computing-unit-managing-service 63.83% <ø> (ø)
config-service 87.50% <ø> (ø)
file-service 82.16% <ø> (ø)
frontend 96.43% <ø> (-0.03%) ⬇️ Carriedforward from 6c774a5
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.50% <ø> (+0.11%) ⬆️ Carriedforward from 6c774a5
result-service 85.71% <ø> (ø)
workflow-compiling-service 78.30% <ø> (ø)

*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 kunwp1 November 21, 2026 02:00
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main 95e2748 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 459 0.28 20,719/27,496/27,496 us 🟢 -12.9% / 🔴 +104.6%
⚪ bs=100 sw=10 sl=64 966 0.59 101,756/122,430/122,430 us ⚪ within ±5% / 🔴 +41.3%
🔴 bs=1000 sw=10 sl=64 1,129 0.689 876,200/987,295/987,295 us 🔴 +5.2% / 🔴 +21.2%
Baseline details

Latest main 95e2748 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 459 tuples/sec 462 tuples/sec 1,018 tuples/sec -0.6% -54.9%
bs=10 sw=10 sl=64 MB/s 0.28 MB/s 0.282 MB/s 0.622 MB/s -0.7% -55.0%
bs=10 sw=10 sl=64 p50 20,719 us 18,847 us 10,127 us +9.9% +104.6%
bs=10 sw=10 sl=64 p95 27,496 us 31,563 us 13,693 us -12.9% +100.8%
bs=10 sw=10 sl=64 p99 27,496 us 31,563 us 16,105 us -12.9% +70.7%
bs=100 sw=10 sl=64 throughput 966 tuples/sec 972 tuples/sec 1,364 tuples/sec -0.6% -29.2%
bs=100 sw=10 sl=64 MB/s 0.59 MB/s 0.593 MB/s 0.832 MB/s -0.5% -29.1%
bs=100 sw=10 sl=64 p50 101,756 us 102,956 us 79,321 us -1.2% +28.3%
bs=100 sw=10 sl=64 p95 122,430 us 121,064 us 86,661 us +1.1% +41.3%
bs=100 sw=10 sl=64 p99 122,430 us 121,064 us 98,907 us +1.1% +23.8%
bs=1000 sw=10 sl=64 throughput 1,129 tuples/sec 1,130 tuples/sec 1,406 tuples/sec -0.1% -19.7%
bs=1000 sw=10 sl=64 MB/s 0.689 MB/s 0.689 MB/s 0.858 MB/s 0.0% -19.7%
bs=1000 sw=10 sl=64 p50 876,200 us 887,738 us 776,724 us -1.3% +12.8%
bs=1000 sw=10 sl=64 p95 987,295 us 938,399 us 814,345 us +5.2% +21.2%
bs=1000 sw=10 sl=64 p99 987,295 us 938,399 us 862,305 us +5.2% +14.5%
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,435.55,200,128000,459,0.280,20719.37,27496.45,27496.45
1,100,10,64,20,2069.61,2000,1280000,966,0.590,101756.05,122430.22,122430.22
2,1000,10,64,20,17708.13,20000,12800000,1129,0.689,876200.25,987294.68,987294.68

@kunwp1 kunwp1 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! A longer-term option: .scalafix.conf has RemoveUnused.locals = false, and no module enables -Wunused:locals. Turning those on in check mode would catch unread bindings like these in CI, instead of needing a hand sweep.

Address the review on apache#9597:

- Remove the unused MockFactory from CostBasedScheduleGeneratorSpec,
  RangeBasedShuffleSpec and WorkerSpec.
- Remove the unused BeforeAndAfterEach from BatchSizePropagationSpec,
  DataProcessorSpec and TrivialControlSpec.
- Remove the unused BeforeAndAfterAll from DefaultCostEstimatorSpec,
  LakeFSStorageClientMtimeSpec and IcebergDocumentConsoleMessagesSpec.
- Remove the unused BeforeAndAfter from KeywordSearchOpExecSpec.
- Drop BeforeAndAfterAll from LargeBinaryInputStreamSpec,
  LargeBinaryOutputStreamSpec and S3StorageClientSpec, since
  S3StorageTestBase already extends it.
- Shut down the actor system in LoggingSpec and ReplaySpec, the two
  TestKit specs that never did.
- Drop `ex shouldBe a[AssertionError]` after
  `expectError[AssertionError]`, which already returns that type, in
  ContinuousErrorBandsOpDescSpec, NestedTableOpDescSpec,
  WaterfallChartOpDescSpec and WindRoseChartOpDescSpec.
@aglinxinyuan

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Agreed on RemoveUnused.locals plus -Wunused:locals — it would catch unread bindings like these val ex ones in CI. It changes the shared lint setup for every module, though, so it fits better in its own PR than in this test cleanup.

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 23, 2026
Merged via the queue into apache:main with commit 6a16e1a Nov 23, 2026
39 checks passed
@aglinxinyuan
aglinxinyuan deleted the test/scala-unused-spec-mixins branch November 23, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unused ScalaTest mixins and unread bindings in Amber and common specs

4 participants