Skip to content

Remove a race with another file write that is not essential to test presence of duplicates. - #40596

Merged
jrmccluskey merged 2 commits into
apache:masterfrom
tvalentyn:deflake
Oct 19, 2026
Merged

jrmccluskey merged 2 commits into
apache:masterfrom
tvalentyn:deflake

Conversation

@tvalentyn

Copy link
Copy Markdown
Contributor

Fix a flake that happened in #40000

@tvalentyn

Copy link
Copy Markdown
Contributor Author

R: @bvolpato

@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@tvalentyn

Copy link
Copy Markdown
Contributor Author

assign set of reviewers

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @jrmccluskey for label python.
Backup reviewer: damccorm (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

This pull request likely touches a core component ("core" label). Please review with scrutiny.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@jrmccluskey jrmccluskey 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.

Test case is failing:

apache_beam.testing.util.BeamAssertException: Failed assert: ['/Users/runner/work/beam/beam/sdks/python/target/.tox/py311-macos/tmp/tmpd28ix9tp/tmpr3dn2ae0', '/Users/runner/work/beam/beam/sdks/python/target/.tox/py311-macos/tmp/tmpd28ix9tp/tmpr3dn2ae0'] == [FileMetadata(/Users/runner/work/beam/beam/sdks/python/target/.tox/py311-macos/tmp/tmpd28ix9tp/tmpr3dn2ae0, 0, 1792019102.680488), FileMetadata(/Users/runner/work/beam/beam/sdks/python/target/.tox/py311-macos/tmp/tmpd28ix9tp/tmpr3dn2ae0, 0, 1792019102.680488)], unexpected elements [FileMetadata(/Users/runner/work/beam/beam/sdks/python/target/.tox/py311-macos/tmp/tmpd28ix9tp/tmpr3dn2ae0, 0, 1792019102.680488), FileMetadata(/Users/runner/work/beam/beam/sdks/python/target/.tox/py311-macos/tmp/tmpd28ix9tp/tmpr3dn2ae0, 0, 1792019102.680488)], missing elements ['/Users/runner/work/beam/beam/sdks/python/target/.tox/py311-macos/tmp/tmpd28ix9tp/tmpr3dn2ae0', '/Users/runner/work/beam/beam/sdks/python/target/.tox/py311-macos/tmp/tmpd28ix9tp/tmpr3dn2ae0'] [while running 'assert_that/Match']

@tvalentyn

Copy link
Copy Markdown
Contributor Author

oops, yes, I assumed it was preexisting

  11. [unknown]  1 test(s)
     suite  Python tests / Python Unit Tests (macos-latest, 3.13, py313)
     cause  BeamAssertException: Failed assert: ['/Users/runner/work/beam/beam/sdks/python/target/.tox/py313-macos/tmp/tmp_wi8zfq_/tmp5aikcszw', '/Users/runner/work/beam/beam/sdks/python/target/.tox/py313-macos/tmp/tmp_wi8zfq_/tmp5a
     why    no rule matched — needs a human
     test   MatchContinuouslyTest.test_without_deduplication (0s)
            apache_beam/runners/common.py:914 in apache_beam.runners.common.PerWindowInvoker.invoke_process
     chain  BeamAssertException → BeamAssertException
     log    https://github.com/apache/beam/actions/runs/38650898197/job/116149129946  (line ~19434)
     ── excerpt ──
     | [gw4] darwin -- Python 3.13.15 /Users/runner/work/beam/beam/sdks/python/target/.tox/py313-macos/bin/python
     | >   return self.do_fn_invoker.invoke_process(windowed_value)
     | apache_beam/runners/common.py:1512: 
     | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
     | apache_beam/runners/common.py:914: in apache_beam.runners.common.PerWindowInvoker.invoke_process
     |     self._invoke_process_per_window(
     | apache_beam/runners/common.py:1059: in apache_beam.runners.common.PerWindowInvoker._invoke_process_per_window
     |     self.process_method(*args_for_process, **kwargs_for_process),
     | target/.tox/py313-macos/lib/python3.13/site-packages/apache_beam/transforms/core.py:2128: in <lambda>
     |     wrapper = lambda x, *args, **kwargs: [fn(x, *args, **kwargs)]
     |                                           ^^^^^^^^^^^^^^^^^^^^^^
     | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
     | actual = [FileMetadata(/Users/runner/work/beam/beam/sdks/python/target/.tox/py313-macos/tmp/tmp_wi8zfq_/tmp5aikcszw, 0, 1792019...ta(/Users/runner/work/beam/beam/sdks/python/target/.tox/py313-macos/tm
     | equals_fn = <function row_namedtuple_equals_fn at 0x119868e00>
     |     def _equal(actual, equals_fn=equals_fn):
     |       expected_list = list(expected)
     |       # Try to compare actual and expected by sorting. This fails with a
     |       # TypeError in Python 3 if different types are present in the same
     |       # collection. It can also raise false negatives for types that don't have
     |       # a deterministic sort order, like pyarrow Tables as of 0.14.1
     |       if not equals_fn:
     |         equals_fn = row_namedtuple_equals_fn
     |         try:
     |           sorted_expected = sorted(expected)
     |           sorted_actual = sorted(actual)
     | … 15 more line(s) — open the log above
`

@tvalentyn
tvalentyn marked this pull request as ready for review October 16, 2026 17:22
@tvalentyn

Copy link
Copy Markdown
Contributor Author

_create_extra_file did a bit more than what was written in its name

@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.94%. Comparing base (76f6e6d) to head (b4aa168).
⚠️ Report is 210 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##             master   #40596       +/-   ##
=============================================
+ Coverage     56.16%   79.94%   +23.77%     
=============================================
  Files          1124      488      -636     
  Lines        178336    82556    -95780     
  Branches       1489        0     -1489     
=============================================
- Hits         100170    65997    -34173     
+ Misses        75645    16559    -59086     
+ Partials       2521        0     -2521     
Flag Coverage Δ
go ?
java ?
python 79.94% <ø> (+0.38%) ⬆️

Flags with carried forward coverage won't be shown. 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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvalentyn
tvalentyn requested a review from jrmccluskey October 16, 2026 18:08

@github-actions github-actions Bot 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.

📋 Review Summary

This PR resolves a test flakiness issue in MatchContinuouslyTest.test_without_deduplication by removing the mid-pipeline file creation side-effect. Because has_deduplication=False uses PeriodicImpulse followed by MatchAll, downstream beam.Map side-effects are not guaranteed to execute between polling intervals.

🔍 General Feedback

  • The change cleanly isolates the test to its core responsibility (verifying that has_deduplication=False emits duplicate matches across intervals) without relying on racy cross-stage execution ordering.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@jrmccluskey jrmccluskey 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

@jrmccluskey
jrmccluskey merged commit 6235796 into apache:master Oct 19, 2026
108 of 110 checks passed
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.

2 participants