From 47f28c43b4337fe0e74eb8bab3ef0acba1528e12 Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Mon, 19 Oct 2026 16:26:36 +0900 Subject: [PATCH 1/2] test: stabilize in_tail compatibility notification test **Which issue(s) this PR fixes**: None. **What this PR does / why we need it**: The compatibility test can race with the stat watcher: after writing the file, the watcher may call on_notify before the test's explicit call. That consumes the test subclass's one-time false response, so the read position has already advanced when the assertion runs. Disable the stat watcher in this test so its explicit notifications control the call order. The failure reported by PR #5529 (GitHub Actions run 39210929391) is this test-ordering instability, not a failure caused by the multithreading implementation. The test uses the default synchronous mode, and this stabilizes a compatibility test introduced by a separate refactoring. **Docs Changes**: None. **Release Note**: None; this only makes a test deterministic. Assisted-by: LLM GPT-6 Luna (OpenAI) Signed-off-by: Takuro Ashie --- test/plugin/in_tail/test_compatibility.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/plugin/in_tail/test_compatibility.rb b/test/plugin/in_tail/test_compatibility.rb index d4c6c68297..37a4c14f95 100644 --- a/test/plugin/in_tail/test_compatibility.rb +++ b/test/plugin/in_tail/test_compatibility.rb @@ -466,7 +466,8 @@ def test_receive_lines_without_super # the lines must be emitted once the buffer is not full anymore. def test_receive_lines_returning_false_does_not_advance_the_position File.binwrite("#{@tmp_dir}/tail.txt", "") - d = create_subclass_driver(SINGLE_LINE_CONFIG, :ReceiveLinesFailsOnce) + config = SINGLE_LINE_CONFIG + config_element('', '', { 'enable_stat_watcher' => 'false' }) + d = create_subclass_driver(config, :ReceiveLinesFailsOnce) plugin = d.instance d.run do tw = first_watcher(plugin) From 4bab47d13cc10a1a09bf87545c8abc226d9911d7 Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Fri, 23 Oct 2026 10:06:56 +0900 Subject: [PATCH 2/2] test: detach watchers in in_tail position compatibility test Disabling the stat watcher still lets timer callbacks race with explicit notifications. Detach all of the tail watcher's triggers before writing the file so only the test drives on_notify. Signed-off-by: Takuro Ashie --- test/plugin/in_tail/test_compatibility.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/plugin/in_tail/test_compatibility.rb b/test/plugin/in_tail/test_compatibility.rb index 37a4c14f95..8eea33bb2b 100644 --- a/test/plugin/in_tail/test_compatibility.rb +++ b/test/plugin/in_tail/test_compatibility.rb @@ -466,11 +466,12 @@ def test_receive_lines_without_super # the lines must be emitted once the buffer is not full anymore. def test_receive_lines_returning_false_does_not_advance_the_position File.binwrite("#{@tmp_dir}/tail.txt", "") - config = SINGLE_LINE_CONFIG + config_element('', '', { 'enable_stat_watcher' => 'false' }) - d = create_subclass_driver(config, :ReceiveLinesFailsOnce) + d = create_subclass_driver(SINGLE_LINE_CONFIG, :ReceiveLinesFailsOnce) plugin = d.instance d.run do tw = first_watcher(plugin) + # Only explicit notifications should drive this test, without stat or timer callbacks. + tw.watchers.each { |trigger| plugin.event_loop_detach(trigger) } File.binwrite("#{@tmp_dir}/tail.txt", "test1\ntest2\n") tw.on_notify