Auto-detect compatible versions of core/CMS and enable lenient mode by default
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3574639. -->
Reported by: [littlepixiez](https://www.drupal.org/user/2568718)
Related to !3
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>When the Drupal version was left empty, the workflow fell back to "latest version" behaviour. This was unreliable because some test modules are not compatible with newer Drupal CMS majors (for example CMS 2.x). This caused avoidable install and test failures.</p>
<p>Additionally, QA testing often requires testing incompatible module combinations (e.g., AI 2.0.x with ai_context 1.0.x which requires AI ^1.3), but lenient mode had to be manually enabled and had a critical bug preventing it from working.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ol>
<li>Implement intelligent version resolution that auto-detects the highest compatible Drupal CMS/Core version based on module requirements</li>
<li>Make lenient mode the default (<code>DP_FORCE_DEPENDENCIES=1</code>) to allow incompatible version combinations for QA testing</li>
<li>Fix the lenient plugin activation bug that prevented it from working</li>
<li>Implement CMS core-extraction to bypass drupal_cms_ai constraints</li>
<li>Update browser extension to reflect new defaults and improve UX</li>
</ol>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<ul>
<li>[x] Implement compatibility-based CMS version resolver</li>
<li>[x] Wire resolver into workflow path when <code>DP_VERSION</code> is empty</li>
<li>[x] Fix/enhance lenient plugin</li>
<li>[x] Implement CMS core-extraction logic to bypass drupal_cms_ai constraints</li>
<li>[x] Make lenient mode the default (<code>DP_FORCE_DEPENDENCIES=1</code>)</li>
<li>[x] Add automated tests for:
<ul>
<li>ai_context with auto-detect AI version (resolves to AI 1.x)</li>
<li>Force AI 2.0.x without lenient mode (expected failure)</li>
<li>Force AI 2.0.x with lenient mode (succeeds)</li>
</ul>
</li>
<li>[x] Update browser extension:
<ul>
<li>Remove DP_FORCE_DEPENDENCIES checkbox</li>
<li>Update placeholders to "Auto-detect compatible version"</li>
<li>Update help text to explain auto-detection</li>
<li>Improve link colours for accessibility (just a nice-to-have whilst we are getting another review)</li>
</ul>
</li>
<li>[x] Update workflow documentation:
<ul>
<li>README.md with lenient mode section</li>
<li>Troubleshooting guide with lenient mode debugging</li>
<li>AI lenient plugin README with comprehensive documentation</li>
</ul>
</li>
</ul>
<h3 id="summary-api-changes">API changes</h3>
<p><strong>Environment Variables:</strong></p>
<ul>
<li><code>DP_FORCE_DEPENDENCIES</code> - Default changed from <code>0</code> to <code>1</code></li>
<li><code>DP_VERSION</code> - Empty now triggers auto-detection (not "latest")</li>
</ul>
<p>No external API changes - Internal workflow behaviour only.</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>None.</p>
issue