Repository navigation
perf: read the entries of a page of suggestions at once, and require the engine 1.4.2 - #10
Merged
JDCyllene merged 1 commit intoOct 16, 2026
Conversation
…the engine 1.4.2 The review of each suggestion shows its entry's current value, read once per catalogue, locale and channel of the page: two queries per catalogue. The suggestions controller now hands the page to the review extension, which reads it with OverrideReader::getTranslationsForCatalogues(): two queries per locale and channel the page holds. A page of 14 suggestions in 7 catalogues and 2 locales goes from 37 queries to 17. The engine 1.4.2 no longer leaves errored suggestions under the code of a channel deleted while its batch was with the provider: the constraint follows, and the installation guide drops that case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this pull request does
SuggestionReviewExtension::prefetch()), which reads it withOverrideReader::getTranslationsForCatalogues(): two queries per locale and channel the page holds, whatever the number of catalogues. The pager keeps the page it loaded, which the grid then renders: no query is added. A row rendered outside that page still reads its own catalogue, as before.^1.4.2: since that release, a run whose channel is deleted while a batch is with the provider leaves no errored suggestion under the deleted code when that call fails (fix: store no errored row in a scope deleted while its batch was with the provider AiTranslationBundle#16). The installation guide drops that case; the README, the support policy,CONTRIBUTING.md,CLAUDE.mdand the comment of theOldest supported enginejob follow the constraint. Record 0025, accepted, still names the case among its consequences: true of the engine it was decided on, and records are not edited.Measured on the test application, with Doctrine's debug middleware: a page of 14 suggestions in 7 catalogues and 2 locales goes from 37 queries to 17, the reads of overrides from 25 to 5.
tests/Integration/Twig/SuggestionReviewExtensionTest.phpchecks that a page of five catalogues costs what a page of one costs, that its rows then cost nothing, that each locale and channel of the page is read once, and that the prefetch shows each row what reading it alone shows (own, inherited and channel values, a key no file has).How it was checked, on Sylius 2.3 and PHP 8.4 against MariaDB:
composer validate --strict,lint:container,lint:twig,lint:yaml, PHPStan and ECS, PHPUnit (155 tests) and the 46 Behat scenarios,@javascriptincluded.Points to watch
vendor/bin/phpunit,vendor/bin/behat --strict)UPGRADE.mdis up to date if the public surface changes (routes, Twig hooks, templates, role, menu entry, services aliased over the engine) - nothing changes: the review extension and the controller are internal, and their Twig function is unchangeddocs/adr/- noneIf the pull request needs a newer engine
cyllene-digital/ai-translation-bundle1.4.2, for the fix above. The constraint is raised incomposer.json.