Skip to content

refactor: remove unused fixtures, barrels and redundant code - #9686

Merged
aglinxinyuan merged 3 commits into
apache:mainfrom
aglinxinyuan:refactor/unused-test-fixtures-and-helpers
Nov 25, 2026
Merged

aglinxinyuan merged 3 commits into
apache:mainfrom
aglinxinyuan:refactor/unused-test-fixtures-and-helpers

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Remove code that nothing uses, and constructs that repeat a default or an alias, from the Python tests, the agent service, three frontend specs, the AsterixDB source and the RustFS test container, and make an unreachable error check in the single-node example loader reachable (+84/−137 lines). Only the loader's behavior changes: a workflow file that jq cannot parse is now reported and skipped instead of aborting the loader.

  • Python tests (14 files): test_console_message.py drops the unused internal_queue and timed_buffer fixtures and their imports. Two tests drop fixture parameters they never read (executor, a_timestamp), and test_proxy_client.py names an unused loop value _. The others write dict(...) calls as literals, return from fixtures that yield without teardown, drop empty @pytest.fixture() parentheses, merge nested with blocks, return a value directly instead of through a local, take the first element with next(iter(...)), and spell datetime.timezone.utc, socket.timeout and bytes() as datetime.UTC, TimeoutError and b"" (Ruff targets Python 3.11).
  • Agent service: src/agent/index.ts and src/api/index.ts only re-export modules that callers import directly. No file imports either barrel, and the package entry is src/index.ts. workflow-system-metadata.ts drops the unused OperatorSchema and ValidationError type imports.
  • Frontend specs: the dataset and model creator specs drop FormsModule and HttpClientTestingModule, which createFormlyModalFixture already provides, and the admin Gmail spec drops three modules that the standalone component and its stubbed service do not need.
  • load-examples.sh: tests the content=$(jq -c . "$workflow_file") assignment in the if instead of checking $? after it. The script runs under set -euo pipefail and main calls load_workflows directly, so the old check could never fire: a workflow file that jq could not parse aborted the loader and skipped the files after it, although the comment above FAILURES calls each failure deliberately non-fatal. Now print_error counts the file, the loop moves on, and main still exits non-zero at the end. test_load_examples_sh.sh adds a case with an unparseable workflow sorted ahead of a good one.
  • AsterixDB source: AsterixDBConnUtil and AsterixDBSourceOpExec assign the version response and the parsed row once as vals instead of overwriting null and None placeholders.
  • RustFSContainer: drops the Scaladoc lines saying the console is left disabled. RustFS 1.0.0 enables the console by default, and the fixture does not override it.
Event PR / Commit
Introduced by Python tests: #1259 (2021-07-23), #1498 (2022-04-15), #1452 (2022-05-13), #2067 (2023-07-27), #1748 (2023-11-09), #2815 (2024-09-05), #4520 (2026-04-27), #4704, #4719 and #4795 (2026-05-03), #4893 (2026-05-04), #6643 (2026-07-20), #6988 (2026-07-29), #7374 (2026-08-07), #7579 (2026-08-13), #8067 (2026-08-29), #8542 (2026-09-15), #9279 (2026-11-04), #8704 (2026-11-05), #9623 (2026-11-23); agent service: #4020 (2025-11-25), #4495 and #4540 (2026-04-28); frontend specs: #6513 (2026-07-18), #6576 (2026-07-20), #8068 (2026-08-28); load-examples.sh: #4247 (2026-03-02); AsterixDB source: #1044 (2021-02-25); RustFSContainer: #8542 (2026-09-15)
Usage removed by Creator spec modules: #9522 (2026-11-22, refactor(frontend): share dataset and model resource UI) moved both specs to createFormlyModalFixture. Everything else: unused, unreachable or redundant since introduction.

As of 2026-11-24:

  • The AsterixDB placeholders have been overwritten before any read for over 5 years.
  • The console-message fixtures have been unused for over 2 years.
  • The load-examples.sh check has been unreachable for almost 9 months.
  • The agent-service barrels have had no importer for the 7 months the service has existed.
  • The creator spec modules have been redundant for 2 days.

Any related issues, documentation, discussions?

Closes #9685.

How was this PR tested?

Ran on this branch and on main at 424b2a757a (Windows 11; Python 3.12 with CI's pinned ruff 0.14.7; Node 24 with Yarn 4.14.1; Bun 1.3.13; JDK 17; the loader test in an Alpine container with Bash 5.2.21 and jq 1.7.1):

cd amber
ruff check src/main/python src/test/python
ruff format --check src/main/python src/test/python
pytest $(git diff --name-only --relative origin/main -- src/test/python)
cd ../agent-service
bun test
bun run typecheck
cd ../frontend
npx ng test --watch=false --include='**/user-dataset-creator.component.spec.ts' --include='**/user-model-creator.component.spec.ts' --include='**/admin-gmail.component.spec.ts'
npx tsc --noEmit -p src/tsconfig.spec.json
yarn prettier-eslint --list-different $(git diff --name-only --relative origin/main -- src)
yarn eslint $(git diff --name-only --relative origin/main -- src)
cd ..
sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.source.sql.*" WorkflowCore/Test/compile WorkflowOperator/scalafmtCheckAll WorkflowCore/scalafmtCheckAll "WorkflowOperator/scalafixAll --check" "WorkflowCore/scalafixAll --check"
bash bin/single-node/tests/test_load_examples_sh.sh
  • Python:
    • Ruff passes on all 218 files.
    • The 14 changed test files run 288 tests with the same outcome per test on both sides: 218 pass, 67 are skipped and 3 fail.
    • The three failures are timestamp cases in test_ui_parameter_contract.py that expect UTC and come out 8 hours off in this machine's time zone. They fail the same way on main.
  • Agent service: all 361 tests in 20 files and the typecheck pass on both sides.
  • Frontend: the three specs run 37 tests, all passing on both sides. The spec typecheck, prettier-eslint and ESLint pass.
  • Scala: the 11 source.sql suites, including the three AsterixDB specs, run 204 tests that all pass on both sides. WorkflowCore's tests compile, and scalafmt and scalafix pass on both modules.
  • load-examples.sh: test_load_examples_sh.sh passes all 11 checks. Against main's loader, the 9 existing checks pass and the 2 new ones fail: jq exits 5 at the malformed file, and the loader stops there without creating the other workflow.

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

Generated-by: Claude Code (Claude Opus 5.5)

Python tests drop two unused fixtures with their imports, unused fixture
parameters and a loop variable, and constructs that repeat a default or
an alias: dict() calls, fixtures that yield without teardown, empty
fixture parentheses, nested with blocks and timezone.utc. The agent
service drops two barrels nothing imports and two unused type imports.
Three frontend specs drop TestBed modules their fixtures already
provide. load-examples.sh drops a jq-failure check that errexit makes
unreachable, the AsterixDB source drops two placeholder initializers,
and RustFSContainer drops a comment that calls its console disabled.
Copilot AI balanced review requested due to automatic review settings November 25, 2026 06:22
@github-actions github-actions Bot added pyamber refactor Refactor the code frontend Changes related to the frontend GUI infra common agent-service labels Nov 25, 2026

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

@aglinxinyuan
aglinxinyuan requested a review from kunwp1 November 25, 2026 06:24
@codecov-commenter

codecov-commenter commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.77%. Comparing base (424b2a7) to head (956ceb4).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9686      +/-   ##
============================================
+ Coverage     91.71%   91.77%   +0.05%     
- Complexity     5134     5139       +5     
============================================
  Files          1305     1306       +1     
  Lines         58211    58289      +78     
  Branches       7599     7595       -4     
============================================
+ Hits          53391    53493     +102     
+ Misses         2917     2896      -21     
+ Partials       1903     1900       -3     
Flag Coverage Δ
access-control-service 77.44% <ø> (ø)
agent-service 99.56% <100.00%> (+<0.01%) ⬆️
amber 85.94% <100.00%> (+0.14%) ⬆️
computing-unit-managing-service 63.81% <ø> (ø)
config-service 87.50% <ø> (ø)
file-service 82.16% <ø> (ø)
frontend 96.44% <ø> (-0.01%) ⬇️
notebook-migration-service 83.84% <ø> (+0.07%) ⬆️
pyamber 98.58% <ø> (ø)
result-service 86.48% <ø> (ø)
workflow-compiling-service 80.90% <ø> (ø)

☔ 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 Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main 424b2a7 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 360 0.219 24,993/53,989/53,989 us 🔴 +14.0% / 🔴 +297.9%
🟢 bs=100 sw=10 sl=64 843 0.515 116,165/134,219/134,219 us 🟢 -50.9% / 🔴 +48.8%
🔴 bs=1000 sw=10 sl=64 967 0.59 1,025,011/1,154,009/1,154,009 us 🔴 +6.6% / 🔴 +36.7%
Baseline details

Latest main 424b2a7 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 360 tuples/sec 409 tuples/sec 956.03 tuples/sec -12.0% -62.3%
bs=10 sw=10 sl=64 MB/s 0.219 MB/s 0.249 MB/s 0.584 MB/s -12.0% -62.5%
bs=10 sw=10 sl=64 p50 24,993 us 24,151 us 10,527 us +3.5% +137.4%
bs=10 sw=10 sl=64 p95 53,989 us 47,339 us 13,570 us +14.0% +297.9%
bs=10 sw=10 sl=64 p99 53,989 us 47,339 us 16,510 us +14.0% +227.0%
bs=100 sw=10 sl=64 throughput 843 tuples/sec 766 tuples/sec 1,273 tuples/sec +10.1% -33.8%
bs=100 sw=10 sl=64 MB/s 0.515 MB/s 0.467 MB/s 0.777 MB/s +10.3% -33.7%
bs=100 sw=10 sl=64 p50 116,165 us 118,104 us 82,483 us -1.6% +40.8%
bs=100 sw=10 sl=64 p95 134,219 us 273,246 us 90,219 us -50.9% +48.8%
bs=100 sw=10 sl=64 p99 134,219 us 273,246 us 102,794 us -50.9% +30.6%
bs=1000 sw=10 sl=64 throughput 967 tuples/sec 962 tuples/sec 1,318 tuples/sec +0.5% -26.6%
bs=1000 sw=10 sl=64 MB/s 0.59 MB/s 0.587 MB/s 0.804 MB/s +0.5% -26.6%
bs=1000 sw=10 sl=64 p50 1,025,011 us 1,039,815 us 802,593 us -1.4% +27.7%
bs=1000 sw=10 sl=64 p95 1,154,009 us 1,082,857 us 843,998 us +6.6% +36.7%
bs=1000 sw=10 sl=64 p99 1,154,009 us 1,082,857 us 894,722 us +6.6% +29.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,556.17,200,128000,360,0.219,24992.84,53988.56,53988.56
1,100,10,64,20,2371.38,2000,1280000,843,0.515,116165.43,134219.34,134219.34
2,1000,10,64,20,20686.81,20000,12800000,967,0.590,1025010.62,1154008.66,1154008.66

@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! One optional suggestion and a nit below.

The file's other two empty byte strings already use the literal.
Under `set -euo pipefail`, a workflow file that jq cannot parse aborts
load-examples.sh at `content=$(jq -c . "$workflow_file")` and skips
every file after it, although the comment above FAILURES calls each
failure deliberately non-fatal (main's `$?` check after the assignment
could never fire). Testing the assignment in the `if` reports the file
through print_error and moves on to the next one; main still exits
non-zero at the end.

test_load_examples_sh.sh gains a case with an unparseable workflow
sorted ahead of a good one.
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 25, 2026
Merged via the queue into apache:main with commit 315de0b Nov 25, 2026
47 checks passed
@aglinxinyuan
aglinxinyuan deleted the refactor/unused-test-fixtures-and-helpers branch November 25, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-service common frontend Changes related to the frontend GUI infra pyamber refactor Refactor the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unused test fixtures, agent-service barrels and redundant code

4 participants