Skip to content

[#2851] Removed the starter content model when neither demo nor search custom module is selected. - #2857

Closed
AlexSkrypnyk wants to merge 2 commits into
2.xfrom
feature/2851-demo-recipe-cleanup
Closed

[#2851] Removed the starter content model when neither demo nor search custom module is selected.#2857
AlexSkrypnyk wants to merge 2 commits into
2.xfrom
feature/2851-demo-recipe-cleanup

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Jul 29, 2026

Copy link
Copy Markdown
Member

Closes #2851

Summary

The page content model - the recipes/page/ recipe plus the CreateContentModelDeployStep that applies it - was unfenced in the installer, so it survived into every generated project regardless of which custom modules were selected. Its sibling in the same directory, EnableDevelopmentModulesDeployStep, was already fenced with the demo token, so the content model was the odd one out. The CustomModules handler now removes both recipes/page/ and CreateContentModelDeployStep.php outright, but only when neither the demo nor the search custom module is selected, not on demo alone as the originating issue frames it: the search custom module's web/modules/custom/ys_search/ys_search.deploy.php attaches the editorial workflow to the node/page bundle, and saving that workflow against a missing bundle entity throws LogicException: Missing bundle entity from EntityType::getBundleConfigDependency() in Drupal core; tests/behat/features/search.feature also creates and indexes page content, and that feature is removed only when the Solr service is deselected, never by the demo selection alone. Gating the removal on demo alone would break the deploy and the BDD suite for every project that keeps Search and drops Demo, so this deviation from the issue's stated scope is called out here for a reviewer to weigh in on.

Changes

  • CustomModules::process() now removes the recipes/page directory and the CreateContentModelDeployStep.php file outright with File::remove() when neither self::DEMO nor self::SEARCH is in the selected modules, matching how whole custom module directories are already removed elsewhere in the same method - per the installer guide, whole-file removal uses File::remove() and fences are reserved for partial edits.
  • Added one new fence token, CONTENT_MODEL, for the single partial edit this change needs: the !recipes/page allow-list line in the root .gitignore, wrapped in #;< CONTENT_MODEL / #;> CONTENT_MODEL. Documented in the token table in .vortex/installer/CLAUDE.md.
  • Extracted the six-entry module location glob, previously duplicated three times across the base/demo/search removal blocks, into a moduleLocations(string $suffix) helper, now used four times including the new content-model removal block.
  • Reworded the CreateContentModelDeployStep docblock so it no longer describes itself in terms of the demo modules that call it.
  • Added a custom_modules_base_only installer scenario (base selected, demo and search both deselected) - the only case where the deploy step file must be deleted while its own module survives, which the existing custom_modules_none scenario cannot prove because it deletes the base module directory wholesale.
  • Strengthened the custom_modules_no_demo scenario's assertions to confirm the content model survives when Search is kept alongside a demo deselection, and the custom_modules_none scenario's assertions to confirm it is gone; custom_modules_no_demo's generated fixture output is deliberately left unchanged, since it asserts against already-correct behaviour and is the regression guard for the search coupling.
  • SutTrait now asserts recipes/page/recipe.yml and CreateContentModelDeployStep.php are both present in a full install.
  • Regenerated fixtures for custom_modules_base_only (new) and custom_modules_none, plus hosting_acquia, hosting_project_name___acquia and names, which carry copies of the reworded CreateContentModelDeployStep docblock.

Before / After

Both recipes/page/ and CreateContentModelDeployStep.php move together in every row below - either both survive or both are removed.

BEFORE - unfenced, shipped regardless of module selection
  Demo + Search  .......... kept
  Search only    .......... kept
  Demo only      .......... kept
  Neither        .......... kept   (orphaned: no remaining module references the page bundle)

AFTER - gated on the CONTENT_MODEL fence, tied to demo OR search
  Demo + Search  .......... kept
  Search only    .......... kept
  Demo only      .......... kept
  Neither        .......... removed

Summary by CodeRabbit

  • New Features

    • Installer selections now preserve starter content-model files when the demo or search modules are enabled.
    • Starter content-model setup is retained for non-production deployments.
  • Bug Fixes

    • Removing all optional custom modules now also removes related starter content-model recipes and deployment setup.
    • Installer output and generated ignore rules now accurately reflect the selected modules.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Custom module processing now centralizes module path matching and conditionally removes the content model token, recipe, ignore rule, and deploy step when demo and search are absent. Tests verify retention and removal scenarios, and documentation reflects the starter content model.

Changes

Content model cleanup

Layer / File(s) Summary
Centralize custom module path resolution
.vortex/installer/src/Prompts/Handlers/CustomModules.php
Custom module removal branches use a shared helper for ordered location patterns.
Conditionally retain or remove content model artifacts
.vortex/installer/src/Prompts/Handlers/CustomModules.php, .gitignore, .vortex/installer/CLAUDE.md, web/modules/custom/ys_base/..., .vortex/installer/tests/..., .vortex/tests/...
The content model token and related files are removed when demo and search are both absent; tests verify retained and removed scenarios, while documentation and comments describe the starter content model.

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

Sequence Diagram(s)

sequenceDiagram
  participant CustomModulesProcess
  participant File
  participant InstallerFiles
  CustomModulesProcess->>File: findMatchingPath(moduleLocations(suffix))
  CustomModulesProcess->>InstallerFiles: remove CONTENT_MODEL token
  CustomModulesProcess->>InstallerFiles: delete recipes/page and CreateContentModelDeployStep.php
Loading

Possibly related PRs

Suggested labels: Needs review, A4

Poem

I’m a rabbit with a tidy nest,
Tokens tucked and files addressed.
Demo hops in, the page stays near;
Demo hops out, the path is clear.
Tests thump softly: all is right! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The page recipe and deploy step are still retained when demo is off but search is on, so #2851's direct acceptance isn't fully met. Remove the page recipe and deploy step whenever demo is deselected, or update #2851 to explicitly exempt the Search-dependent case.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: gating content-model removal on demo and search selection.
Out of Scope Changes check ✅ Passed All modified files support the installer/content-model change, and no unrelated feature work is evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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/2851-demo-recipe-cleanup

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

@AlexSkrypnyk AlexSkrypnyk added the A1 Board worker 1 label Jul 29, 2026

@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 @.vortex/installer/src/Prompts/Handlers/CustomModules.php:
- Around line 129-135: Ensure the custom module selection flow preserves a
deploy-step implementation when Base is unselected but dependent Demo/Search
modules remain selected. Update the logic around the CUSTOM_MODULE_BASE removal
in the relevant handler to make Base mandatory for those dependent modules, or
relocate/provide CreateContentModelDeployStep.php within a retained module so
the retained recipes/page deployment path still has a step to execute.
🪄 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: 4e1d0cd1-c510-4b97-bffa-517c9df327f6

📥 Commits

Reviewing files that changed from the base of the PR and between c7f7b0e and 7ab0e0d.

⛔ Files ignored due to path filters (45)
  • .vortex/installer/tests/Fixtures/handler_process/_baseline/web/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/.gitignore is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/-recipe.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_form_display.node.page.default.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_view_display.node.page.default.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-core.entity_view_display.node.page.teaser.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-field.field.node.page.body.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-field.storage.node.body.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/recipes/page/config/-node.type.page.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/tests/behat/features/-counter.feature is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/tests/behat/features/-pages.feature is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_base/src/Plugin/DeployStep/-CreateContentModelDeployStep.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_base/src/Plugin/DeployStep/EnableDevelopmentModulesDeployStep.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.deploy.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.info.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.libraries.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/-sw_demo.module is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/config/install/-views.view.sw_demo_pages.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/css/-sw_demo.css is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/js/-sw_demo.js is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/js/tests/-sw_demo.test.js is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/src/Plugin/Block/-CounterBlock.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/src/Plugin/GeneratedContent/Node/-Page.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/templates/-sw-demo-counter-block.html.twig is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/FunctionalJavascript/-CounterBlockTest.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/Kernel/-CounterBlockTest.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_demo/tests/src/Unit/-CounterBlockTest.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.deploy.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.info.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/-sw_search.install is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-search_api.index.content.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-search_api.server.solr.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/config/install/-views.view.search.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_base_only/web/modules/custom/sw_search/src/Plugin/DeployStep/-RebuildSearchIndex.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_none/.gitignore is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/-recipe.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_form_display.node.page.default.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_view_display.node.page.default.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-core.entity_view_display.node.page.teaser.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-field.field.node.page.body.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-field.storage.node.body.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/custom_modules_none/recipes/page/config/-node.type.page.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/docroot/modules/custom/sw_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/names/web/modules/custom/the_force_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (6)
  • .gitignore
  • .vortex/installer/CLAUDE.md
  • .vortex/installer/src/Prompts/Handlers/CustomModules.php
  • .vortex/installer/tests/Functional/Handlers/CustomModulesHandlerProcessTest.php
  • .vortex/tests/phpunit/Traits/SutTrait.php
  • web/modules/custom/ys_base/src/Plugin/DeployStep/CreateContentModelDeployStep.php

Comment thread .vortex/installer/src/Prompts/Handlers/CustomModules.php
@github-actions

Copy link
Copy Markdown

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   100.00% (153/153)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

1 similar comment
@AlexSkrypnyk

Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   100.00% (153/153)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.06%. Comparing base (c7f7b0e) to head (7ab0e0d).

Additional details and impacted files
@@            Coverage Diff             @@
##              2.x    #2857      +/-   ##
==========================================
- Coverage   88.08%   88.06%   -0.02%     
==========================================
  Files          98       98              
  Lines        5379     5370       -9     
  Branches        3        3              
==========================================
- Hits         4738     4729       -9     
  Misses        641      641              

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

@github-actions

Copy link
Copy Markdown

📖 Documentation preview for this pull request has been deployed to Netlify:

https://6a6964ec637bef0382ba59fe--vortex-docs.netlify.app

This preview is rebuilt on every commit and is not the production documentation site.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Jul 29, 2026
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex 1.x Jul 29, 2026
@AlexSkrypnyk
AlexSkrypnyk deleted the feature/2851-demo-recipe-cleanup branch July 29, 2026 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A1 Board worker 1 Needs review Pull request needs a review from assigned developers

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

1 participant