HyukjinKwon opened a new pull request, #623: URL: https://github.com/apache/spark-connect-rust/pull/623
### What changes were proposed in this pull request? This fixes a flaky failure of the "Measure and publish coverage badges" job. The job failed twice on #615, a docs-only PR, and once on #620, each time in the same test: ``` test_ml_connect_logistic_regression_checks_its_labels_before_its_fit_as_pyspark > assert len(service.execute_requests) == sent + 1, classes E assert 3 == (1 + 1) ``` The extra requests are Deletes of `model-1` from a session of an earlier test. A native model sends the Delete of its cached object through its session without waiting for it (`CachedModelRef::drop` in `crates/spark-connect/src/ml.rs`). So the Delete of a model of one test can reach the mock server while the next test runs, and a test that counts the exact requests that it sends then sees one too many. Some checks already skip Deletes (`_commands_but_deletes`), but most of the exact checks do not: `len(service.execute_requests) == ...`, `service.execute_requests == []` and `(command,) = _commands(service)`. Instead of filtering each check, the mock server now drops these requests at the source: - `RemoteService.forget_session(session_id)`: from then on, the server still answers the ExecutePlanRequests of that session, but does not record them. It does count them, in `forgotten_requests`. - The `ml_mock` fixture forgets the session of a test when the test ends, before it stops the session. A model released after its session has stopped sends no Delete, so the late Deletes all come from sessions of ended tests, which are now forgotten. Other users of the mock server don't call `forget_session`, so nothing changes for them. ### Why are the changes needed? The coverage job runs the offline suites more slowly, so a late Delete reaches the next test more often there. Any PR could fail this job without a cause of its own. ### Does this PR introduce _any_ user-facing change? No. Tests only. ### How was this patch tested? - A new test, `test_the_deletes_of_the_models_of_an_ended_test_are_not_recorded_in_a_later_test`, releases a model of a forgotten session. It checks that the server answers the model's Delete without recording it, and that the requests of a live session are still recorded. The test fails with the server's filter disabled (`assert 0 == 1` on `forgotten_requests`) and passes with it. - `tests/test_ml_offline.py` and `tests/test_dropin_offline.py`: 2123 passed, 8 skipped. `ruff check` passes. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5.5 This pull request and its description were written by Isaac. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
