Skip to content

[#690] Reclassified trait-specific composer dependencies as optional.#691

Merged
AlexSkrypnyk merged 5 commits into
mainfrom
feature/690-composer-deps
Jul 9, 2026
Merged

[#690] Reclassified trait-specific composer dependencies as optional.#691
AlexSkrypnyk merged 5 commits into
mainfrom
feature/690-composer-deps

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Jul 9, 2026

Copy link
Copy Markdown
Member

Closes #690

Summary

The require section of composer.json is trimmed to only what every consumer needs regardless of which traits they use - php, behat/behat, and behat/mink. Four trait-specific packages (drupal/drupal-extension, lullabot/mink-selenium2-driver, dmore/behat-chrome-extension, softcreatr/jsonpath) move to require-dev (so this library's own test suite still exercises them) plus suggest entries that tell consumers when each one is needed. The conflict on drupal/drupal-extension: <6 is preserved unchanged. This is a breaking change for consumers relying on transitive installation, so it is documented in MIGRATION.md as a batched change for the next major release. A new CONTRIBUTING.md "Dependency policy" section codifies the rule going forward, a new README "Optional dependencies" note tells consumers what to add, and scripts/provision.sh is updated so the library's own fixture site keeps installing the now-optional packages it needs to run the full Behat suite.

Changes

  • composer.json: reclassified drupal/drupal-extension, lullabot/mink-selenium2-driver, dmore/behat-chrome-extension, and softcreatr/jsonpath from require into require-dev + suggest; kept php, behat/behat, behat/mink in require; preserved the existing conflict on drupal/drupal-extension: <6.
  • scripts/provision.sh: the fixture-site Composer merge now pulls the module's suggest packages (the trait-specific runtime deps that left require) into the fixture's require-dev, so docs.php and every Behat scenario - which run against build/vendor - still resolve. Derived from suggest via array_intersect_key rather than a hardcoded list, so it stays correct as the policy adds future optional deps.
  • MIGRATION.md: added a breaking-change entry mapping each demoted package to the trait(s) that need it. The two @javascript drivers are presented as interchangeable - install either lullabot/mink-selenium2-driver (Selenium/WebDriver) or dmore/behat-chrome-extension (selenium-less headless Chrome); both run the full @javascript suite and both are exercised by CI.
  • CONTRIBUTING.md: added a "Dependency policy" section stating that trait-specific packages go in require-dev + suggest, never in require, and that demotions are batched into major releases.
  • README.md: added an "Optional dependencies" section listing per-trait package requirements for consumers.

The demoted packages are safe to omit at runtime: dmore/behat-chrome-extension has zero code references (it is a Behat extension configured entirely in behat.yml), and lullabot/mink-selenium2-driver is only referenced in instanceof branch guards, which PHP evaluates as false against a missing class rather than fatally erroring. This mirrors the existing justinrainbow/json-schema precedent, which has been suggest-only all along.

Before / After

BEFORE

composer.json
└── require (7)
    ├── php
    ├── behat/behat
    ├── behat/mink
    ├── dmore/behat-chrome-extension
    ├── drupal/drupal-extension
    ├── lullabot/mink-selenium2-driver
    └── softcreatr/jsonpath
suggest (1)
└── justinrainbow/json-schema

fixture site (scripts/provision.sh)
└── require-dev = module's "require"            → trait deps came for free

AFTER

composer.json
├── require (3)
│   ├── php
│   ├── behat/behat
│   └── behat/mink
├── require-dev (+4)
│   ├── dmore/behat-chrome-extension
│   ├── drupal/drupal-extension
│   ├── lullabot/mink-selenium2-driver
│   └── softcreatr/jsonpath
└── suggest (5)
    ├── dmore/behat-chrome-extension
    ├── drupal/drupal-extension
    ├── justinrainbow/json-schema        (unchanged)
    ├── lullabot/mink-selenium2-driver
    └── softcreatr/jsonpath

fixture site (scripts/provision.sh)
└── require-dev = module's "require" + "suggest"  → trait deps pulled back in

Reclassified trait-specific Composer dependencies as optional: composer.json now keeps only php, behat/behat, and behat/mink in require, moves drupal/drupal-extension, lullabot/mink-selenium2-driver, dmore/behat-chrome-extension, and softcreatr/jsonpath to require-dev, and expands suggest with trait/step-specific guidance (while keeping the existing drupal/drupal-extension: <6 conflict unchanged).

Documented the change as a breaking dependency demotion in MIGRATION.md, added a “Dependency policy” section to CONTRIBUTING.md describing how require vs require-dev/suggest should be managed going forward, and updated README.md with an “Optional dependencies” section that instructs consumers to add the suggested packages needed for Drupal traits (drupal/drupal-extension), JsonTrait (softcreatr/jsonpath plus justinrainbow/json-schema), and @javascript scenarios (including a Mink driver). Updated scripts/provision.sh so the fixture-site Composer merge pulls in trait-scoped optional deps from require-dev + suggest.

CONTRIBUTING.md’s step-formatting guideline (e.g., avoiding regex-based step definition rules) remains intact; no Critical step-definition rule violations were found related to these documentation changes.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Trait-specific Composer dependencies were moved into require-dev and suggest, with matching policy, migration, and README updates. The provisioning script was also updated so the generated fixture composer configuration includes the suggested packages.

Changes

Dependency reclassification and docs

Layer / File(s) Summary
composer.json dependency split
composer.json
Keeps behat/mink in require, moves trait-specific packages into require-dev, and expands suggest entries for the optional packages.
Dependency policy and migration docs
CONTRIBUTING.md, MIGRATION.md, README.md
Adds dependency-placement rules, documents the package migration and entity cleanup changes, and adds optional dependency guidance for users.
Fixture composer merge
scripts/provision.sh
Merges trait-specific packages from the base package require-dev and suggest entries into the generated fixture require-dev list.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: Needs review

Poem

A rabbit nibbled on composer leaves,
Trimmed the hard deps and sorted the eaves,
Suggestions hopped in with a tidy thump,
Docs and migrations gave the burrow a bump,
Now fixtures run with a lighter spring breeze. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes match the issue by moving trait-specific packages to require-dev/suggest, keeping behat/behat and behat/mink required, and documenting the policy.
Out of Scope Changes check ✅ Passed The documentation and provisioning updates support the same dependency policy change and do not introduce unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: moving trait-specific Composer dependencies to optional status.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/690-composer-deps

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@composer.json`:
- Around line 52-57: The suggest entry for dmore/behat-chrome-extension is too
generic; update its description to name the actual consumer like the other
entries do. In composer.json, tighten the text around the `@javascript` Chrome
DevTools support so it points to the specific trait or step group that uses it,
making it clear when this package is needed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 218b628e-8cac-4ad8-9f79-7fd9194620f0

📥 Commits

Reviewing files that changed from the base of the PR and between fd2f627 and 4fd0f39.

📒 Files selected for processing (4)
  • CONTRIBUTING.md
  • MIGRATION.md
  • README.md
  • composer.json

Comment thread composer.json
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.29%. Comparing base (fd2f627) to head (49376d7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #691   +/-   ##
=======================================
  Coverage   97.29%   97.29%           
=======================================
  Files          52       52           
  Lines        4439     4439           
=======================================
  Hits         4319     4319           
  Misses        120      120           

☔ 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.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Jul 9, 2026
@AlexSkrypnyk AlexSkrypnyk merged commit 67a7598 into main Jul 9, 2026
16 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/690-composer-deps branch July 9, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs review Pull request needs a review from assigned developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review composer dependencies and reclassify optional ones into 'require-dev' and 'suggest'

1 participant