The GitHub Actions job "Required Checks" on texera.git/main has failed.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
069c47685df7aaff87c10f31b6bd282735d2f413 / Xinyuan Lin <[email protected]>
test(pyamber): guard executor module isolation across two MainLoops (#6530)

### What changes were proposed in this PR?

Adds a regression test,
`test_two_main_loops_load_distinct_operator_classes`, in
`amber/src/test/python/core/runnables/test_main_loop.py`. No source
changes.

It creates two `MainLoop`s in the same process, initializes the first
with `EchoOperator` and deliberately leaves that worker "unfinished"
(its temp fs is never closed, like a crashed/never-completed worker),
then initializes the second with `CountBatchOperator` and asserts the
second executor is exactly `CountBatchOperator`.

This guards `ExecutorManager`'s process-globally-unique module naming
end to end. Executor modules were historically named
`udf-v<per-instance-counter>`, so every loop's first executor was
`udf-v1` in the process-wide `sys.modules`; a loop whose worker never
completed left a stale `udf-v1.py` on `sys.path`, and the next loop
re-resolved `udf-v1` to that older file — silently running the wrong
operator. That collision was fixed by switching to a process-wide
counter, but the suite had no end-to-end test spanning two `MainLoop`s,
so a regression back to a per-instance counter would still pass CI. This
closes that gap.

The test uses **no** monkeypatch of `gen_module_file_name` — module
names must be process-globally unique on their own.

### Any related issues, documentation, discussions?

Regression coverage for the module-name collision fixed in #4717 (issue
#4705).

### How was this PR tested?

`cd amber && python -m pytest
src/test/python/core/runnables/test_main_loop.py` — the new test passes
on `main`. `ruff check` and `ruff format --check` are clean.

Confirmed it is a genuine guard, not a tautology: on the pre-fix code
(per-instance `udf-v<counter>` naming) the second loop resolves `udf-v1`
to the first loop's file, so the second executor loads `EchoOperator`
and the assertion fails — I reproduced that red state before it passed
against the fixed code.

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

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

---------

Signed-off-by: Xinyuan Lin <[email protected]>
Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/29883721731

With regards,
GitHub Actions via GitBox

Reply via email to