{"record":{"id":"7e522af06b140cbb","repo":"apache/beam","slug":"splitatfraction-test-completed-vacuously-no-successful-split","errorCode":null,"errorMessage":"SplitAtFraction test completed vacuously: no successful split fractions found","messagePattern":"SplitAtFraction test completed vacuously: no successful split fractions found","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/source_test_utils.py","lineNumber":612,"sourceCode":"\n  any_successful_fractions = False\n  any_non_trivial_fractions = False\n\n  for i in range(len(expected_items)):\n    stats = SplitFractionStatistics([], [])\n\n    assert_split_at_fraction_binary(\n        source, expected_items, i, 0.0, None, 1.0, None, stats)\n\n    if stats.successful_fractions:\n      any_successful_fractions = True\n    if stats.non_trivial_fractions:\n      any_non_trivial_fractions = True\n\n    all_non_trivial_fractions.append(stats.non_trivial_fractions)\n\n  if not any_successful_fractions:\n    raise ValueError(\n        'SplitAtFraction test completed vacuously: no '\n        'successful split fractions found')\n\n  if not any_non_trivial_fractions:\n    raise ValueError(\n        'SplitAtFraction test completed vacuously: no non-trivial split '\n        'fractions found')\n\n  if not perform_multi_threaded_test:\n    return\n\n  num_total_trials = 0\n  for i in range(len(expected_items)):\n    non_trivial_fractions = [2.0]  # 2.0 is larger than any valid fraction.\n    non_trivial_fractions.extend(all_non_trivial_fractions[i])\n    min_non_trivial_fraction = min(non_trivial_fractions)\n\n    if min_non_trivial_fraction == 2.0:","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/source_test_utils.py#L594-L630","documentation":"After exhaustively trying all split fractions, if not a single fraction produced a successful split, the test verified nothing and completes vacuously, so the harness raises this ValueError. It prevents silently passing tests where the source never splits at all.","triggerScenarios":"Calling assert_split_at_fraction_exhaustive on a source whose split_at_fraction always returns None (never splits) for every fraction and every number of items read before the split.","commonSituations":"Custom source with an unimplemented or always-failing try_split; RangeTracker that rejects all splits due to a miscomputed remaining range; source frozen at a single unsplitable unit (e.g. one compressed block).","solutions":["Implement/fix RangeTracker.try_split so it returns a valid split position when the fraction lands inside the remaining range.","Test with a known-good RangeTracker (e.g. OffsetRangeTracker) to confirm the harness works with your source.","Check that positions advance during reading so the remaining range at split time is non-empty.","If never splitting is intended, don't use the exhaustive test — assert MUST_FAIL behavior explicitly instead."],"exampleFix":"// before\ndef try_split(self, fraction):\n  return None  # never splits\n// after\ndef try_split(self, fraction):\n  split = self.start + int(fraction * (self.stop - self.start))\n  if split <= self.start or split >= self.stop:\n    return None\n  return self.position_range_tracker.try_split(split)","handlingStrategy":"validation","validationCode":"probe = source.split_at_fraction(0.5)  # or via a RangeTracker\nif probe is None:\n    pytest.skip('source never splits; exhaustive test would be vacuous')","typeGuard":null,"tryCatchPattern":"try:\n    assert_split_at_fraction_exhaustive(source, start, stop)\nexcept ValueError as e:\n    if 'no successful split fractions' in str(e):\n        pytest.fail(f'source never splits — check try_split: {e}')","preventionTips":["Implement RangeTracker.try_split to return a split inside (start, stop)","Baseline-test the source against OffsetRangeTracker behavior","Ensure positions advance during reading so splits have room"],"tags":["python","apache-beam","vacuous-test","split-at-fraction"],"backgroundTag":"empty-result-set","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}