Skip to content

Conversation

@Chris53897
Copy link
Contributor

@Chris53897 Chris53897 commented Nov 1, 2025

#401

first try with
https://github.com/GromNaN/symfony-config-xml-to-php

After the merge of #407 CI is green now.

Summary by CodeRabbit

  • Chores
    • Switched service configuration to a new format for improved maintainability.
    • Service registrations, public aliases and deprecation notices preserved to avoid breaking existing integrations.
    • Console commands, event/listener integration, and indexing/settings updater remain available and functional.

@coderabbitai
Copy link

coderabbitai bot commented Nov 1, 2025

Walkthrough

Services previously declared in XML (config/services.xml) were migrated to a PHP service file (config/services.php); the XML file was removed and the DI loader in MeilisearchExtension was updated from XmlFileLoader to PhpFileLoader to load the new PHP config.

Changes

Cohort / File(s) Summary
Removed XML configuration
config/services.xml
Deleted: entire Symfony DI XML configuration for the Meilisearch bundle (all service definitions, aliases, tags, console command registrations, normalizer registration, and deprecation notices).
Added PHP configuration
config/services.php
Added: PHP-based DI configuration that declares services (meilisearch.engine, meilisearch.service, meilisearch.client, meilisearch.settings_updater, Meilisearch\Bundle\Services\UnixTimestampNormalizer), registers console commands (multiple Meilisearch\Bundle\Command\* services with console.command tags), and creates aliases (including deprecated aliases like search.service, search.client, search.search_indexer_subscriber) and class/service aliases.
Extension loader change
src/DependencyInjection/MeilisearchExtension.php
Replaced XmlFileLoader with PhpFileLoader and switched the loaded resource from services.xml to services.php.

Sequence Diagram(s)

sequenceDiagram
  participant Ext as MeilisearchExtension::load
  participant LoaderOld as XmlFileLoader
  participant LoaderNew as PhpFileLoader
  participant Container as Service Container

  rect rgba(200,230,255,0.4)
    Ext->>LoaderOld: (before) load('config/services.xml')
    LoaderOld->>Container: parse XML -> register services/aliases/tags
  end

  rect rgba(200,255,220,0.4)
    Ext->>LoaderNew: (after) load('config/services.php')
    LoaderNew->>Container: execute PHP file -> register services/aliases/tags
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify parity between XML and PHP declarations (service args, visibility, lazy, public, tags).
  • Confirm deprecated aliases include correct deprecation messages and public visibility.
  • Check console command service tags and command names/descriptions.
  • Inspect meilisearch.client wiring (lazy, constructor args) and normalizer registration.

Poem

🐰 I hopped from XML fields to PHP plains,
Wove services, aliases, and tagged commands' chains,
Loader switched tracks, container sings anew,
Small change, same rhythm — a tidy rabbit's view. 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feature/switch to php based configs' clearly and concisely summarizes the main change: converting XML-based service configuration to PHP-based configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.38%. Comparing base (78968db) to head (deb6127).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #406   +/-   ##
=======================================
  Coverage   88.38%   88.38%           
=======================================
  Files          20       20           
  Lines         878      878           
=======================================
  Hits          776      776           
  Misses        102      102           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17d4948 and 4052b9b.

📒 Files selected for processing (4)
  • .github/workflows/tests.yml (1 hunks)
  • config/services.php (1 hunks)
  • config/services.xml (0 hunks)
  • src/DependencyInjection/MeilisearchExtension.php (1 hunks)
💤 Files with no reviewable changes (1)
  • config/services.xml
🧰 Additional context used
🧬 Code graph analysis (1)
config/services.php (5)
src/Engine.php (1)
  • Engine (10-143)
src/Services/MeilisearchService.php (1)
  • MeilisearchService (23-394)
src/EventListener/DoctrineEventSubscriber.php (1)
  • DoctrineEventSubscriber (10-33)
src/Services/SettingsUpdater.php (1)
  • SettingsUpdater (17-79)
src/Services/UnixTimestampNormalizer.php (1)
  • UnixTimestampNormalizer (9-33)
🔇 Additional comments (1)
src/DependencyInjection/MeilisearchExtension.php (1)

21-22: LGTM! Clean migration from XML to PHP-based configuration.

The switch from XmlFileLoader to PhpFileLoader and from services.xml to services.php is correct and aligns with the PR objective.

Comment on lines 14 to 15
env:
fail-fast: true
fail-fast: false
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: fail-fast is in the wrong location and will not work.

The fail-fast setting is a strategy-level configuration option, not an environment variable. Placing it under env: will have no effect on the CI behavior.

Move it under the strategy: block of the integration-tests job:

-env:
-  fail-fast: false
-
 jobs:
   integration-tests:
     # Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
     # Will still run for each push to bump-meilisearch-v*
     if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
     runs-on: ubuntu-latest
     services:
       meilisearch:
         image: getmeili/meilisearch:latest
         ports:
           - '7700:7700'
         env:
           MEILI_MASTER_KEY: masterKey
           MEILI_NO_ANALYTICS: true
     strategy:
+      fail-fast: false
       matrix:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
env:
fail-fast: true
fail-fast: false
jobs:
integration-tests:
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
# Will still run for each push to bump-meilisearch-v*
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
runs-on: ubuntu-latest
services:
meilisearch:
image: getmeili/meilisearch:latest
ports:
- '7700:7700'
env:
MEILI_MASTER_KEY: masterKey
MEILI_NO_ANALYTICS: true
strategy:
fail-fast: false
matrix:
🤖 Prompt for AI Agents
.github/workflows/tests.yml around lines 14 to 15: the fail-fast setting is
incorrectly placed under env: (so it’s treated as an environment variable and
has no effect); remove fail-fast from the env section and add fail-fast: false
under the strategy: block of the integration-tests job (at the same indentation
level as matrix:), ensuring it is a strategy-level key rather than an env
variable.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
config/services.php (1)

7-7: Consider removing unused variable.

The $parameters variable is defined but never used in this configuration file.

Apply this diff if parameters are not needed:

 return static function(ContainerConfigurator $container) {
     $services = $container->services();
-    $parameters = $container->parameters();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4052b9b and 0423778.

📒 Files selected for processing (1)
  • config/services.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
config/services.php (5)
src/Engine.php (1)
  • Engine (10-143)
src/Services/MeilisearchService.php (1)
  • MeilisearchService (23-394)
src/EventListener/DoctrineEventSubscriber.php (1)
  • DoctrineEventSubscriber (10-33)
src/Services/SettingsUpdater.php (1)
  • SettingsUpdater (17-79)
src/Services/UnixTimestampNormalizer.php (1)
  • UnixTimestampNormalizer (9-33)
🔇 Additional comments (10)
config/services.php (10)

9-12: LGTM!

The Engine service definition correctly matches the constructor signature and the class alias provides convenient access.


14-21: LGTM!

The MeilisearchService definition correctly matches the constructor signature with all required abstract arguments properly defined. The previous syntax issue on line 17 has been resolved.


23-25: LGTM!

The deprecated alias provides backward compatibility with appropriate deprecation messaging.


27-29: LGTM!

The DoctrineEventSubscriber service definition correctly matches the constructor signature.


34-44: LGTM!

The Client service definition uses lazy loading appropriately and clearly documents abstract arguments to be defined by the extension.


46-51: LGTM!

The client aliases are properly configured for backward compatibility and class-based dependency injection. The previous duplicate alias issue has been resolved.


53-53: LGTM!

The class alias enables convenient dependency injection using the interface type.


55-62: LGTM!

The SettingsUpdater service definition correctly matches the constructor signature, and the class alias enables type-based dependency injection.


64-97: LGTM!

The console command services are properly configured with appropriate dependencies and tags. The command names include convenient aliases (e.g., meili:clear) and helpful descriptions.


99-100: LGTM!

The UnixTimestampNormalizer is correctly registered as a serializer normalizer with appropriate tagging.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
config/services.php (1)

44-45: Add public modifier for consistency.

The deprecated alias should be marked as ->public() to match the main service visibility and maintain consistency with other deprecated aliases in this file (lines 36-38, 59-61).

Apply this diff:

     $services->alias('search.search_indexer_subscriber', 'meilisearch.search_indexer_subscriber')
+        ->public()
         ->deprecate('meilisearch/search-bundle', '0.14', 'The "%alias_id%" service alias is deprecated. Use "meilisearch.search_indexer_subscriber" instead.');
🧹 Nitpick comments (1)
config/services.php (1)

66-66: Add public modifier for API consistency.

The SearchService::class alias should be marked as ->public() to match the target service visibility and maintain consistency with the pattern established by the Client::class alias at lines 63-64, where the class alias is public when its target service is public.

Apply this diff:

-    $services->alias(SearchService::class, 'meilisearch.service');
+    $services->alias(SearchService::class, 'meilisearch.service')
+        ->public();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0423778 and 39d97d5.

📒 Files selected for processing (1)
  • config/services.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
config/services.php (5)
src/Engine.php (1)
  • Engine (10-143)
src/EventListener/DoctrineEventSubscriber.php (1)
  • DoctrineEventSubscriber (10-33)
src/Services/MeilisearchService.php (1)
  • MeilisearchService (23-394)
src/Services/SettingsUpdater.php (1)
  • SettingsUpdater (17-79)
src/Services/UnixTimestampNormalizer.php (1)
  • UnixTimestampNormalizer (9-33)
🔇 Additional comments (7)
config/services.php (7)

5-16: LGTM! All classes properly imported.

All referenced classes are correctly imported at the top of the file.


22-25: LGTM! Engine service correctly configured.

The service definition and arguments match the Engine constructor requirements.


27-38: LGTM! MeilisearchService correctly wired.

The service arguments correctly match the constructor signature, using abstract placeholders for values to be provided by the extension. The deprecated alias properly maintains public visibility.


47-64: LGTM! Client service properly configured.

The client service definition uses appropriate abstract arguments for values to be provided by the extension, and the deprecated alias plus class alias both maintain public visibility correctly.


68-75: LGTM! SettingsUpdater service correctly configured.

The service arguments correctly match the constructor signature, and the visibility consistency between the service and its alias is maintained.


77-110: LGTM! Console commands properly configured.

All console commands are correctly registered with appropriate service dependencies and console.command tags. The command names, descriptions, and arguments align well with their expected functionality.


112-113: LGTM! Normalizer correctly registered.

The UnixTimestampNormalizer is properly configured with the serializer.normalizer tag for integration with Symfony's serializer component.

@norkunas
Copy link
Collaborator

Can you rebase?

@norkunas norkunas merged commit 58dfca1 into meilisearch:main Nov 11, 2025
27 checks passed
@norkunas
Copy link
Collaborator

Thank you @Chris53897

@Chris53897 Chris53897 deleted the feature/switch-to-php-based-configs branch November 11, 2025 08:46
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.

3 participants