Skip to content

feat(behat): add deterministic feature-level sharding (#8974) - #9372

Draft
vitormattos wants to merge 4 commits into
mainfrom
feat/behat-feature-sharding-8974
Draft

vitormattos wants to merge 4 commits into
mainfrom
feat/behat-feature-sharding-8974

Conversation

@vitormattos

@vitormattos vitormattos commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements deterministic whole-feature sharding for #8974, without enabling parallel CI or altering Nextcloud installations.

  • Selects sorted repository-relative .feature paths using zero-based SHARD_INDEX and positive SHARD_TOTAL; stable for the same revision and shard count.
  • tests/integration/sharding/behat-shard.php supports --list, --verify (offline), and --run (one Behat process with only that shard's feature paths).
  • Uses Behat's native multiple-path arguments and default configuration discovery; no custom Behat extension, tags or workflow modifications.
  • Empty shards never run the full suite. --verify handles large totals without iterating millions of empty shards.
  • Moves PHPUnit coverage into tests/php/Unit/Behat/ so existing composer test:unit jobs discover it; fixes PHP-CS-Fixer violations.

Verification actually performed

Check Result
Standalone PHPUnit 10.5.66, PHP 8.2.35 34 tests / 91 assertions passed
Standalone PHPUnit 10.5.66, PHP 8.3.36 34 tests / 91 assertions passed
Project PHP CS Fixer 3.95.21, PHP 8.3 0 violations in all three affected PHP files
PHP lint, PHP 8.3 3 files passed
--verify, real LibreSign feature tree 46/46; 1 shard: 46; 2: 23/23; 4: 12/12/11/11; no overlaps or omissions
--run, genuine Behat 3.34.0, disposable six-feature fixture 3/3 scenarios passed in shard 0/2; 3/3 in shard 1/2; 1/1 in shard 3/4
Invalid input, empty shard, process arguments / exit propagation, large shard total Covered by PHPUnit
git diff --check Passed

The functional Behat smoke test used the exact Behat version pinned in tests/integration/composer.lock but a self-contained fixture, not a full Nextcloud deployment. The full integration suite and concurrent workers were not executed locally; their existing GitHub checks run normally on the PR.

Design rationale / upstream

Scope boundary

This PR does not execute shards concurrently, provision databases, isolate Nextcloud installations, change GitHub workflows, migrate to Behat 4, or add shard tags. This merge alone will not speed up CI. All mutable state/worker lifecycle and parallel execution remain #8975. There is no claim that selecting files makes shared Nextcloud installations safe to run concurrently.

Refs #8974, part of #8969.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos
vitormattos requested a review from a team as a code owner November 5, 2026 17:34
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant