Skip to content

perf: read the entries of a page of suggestions at once, and require the engine 1.4.2 - #10

Merged
JDCyllene merged 1 commit into
CylleneDigital:mainfrom
JDCyllene:perf/group-the-review-reads
Oct 16, 2026
Merged

JDCyllene merged 1 commit into
CylleneDigital:mainfrom
JDCyllene:perf/group-the-review-reads

Conversation

@JDCyllene

Copy link
Copy Markdown
Member

What this pull request does

  • The suggestions screen reads the entries of its page at once. Each row shows its entry's current value (its own override, an inherited one or the file value), read on the first row of each catalogue, locale and channel: two queries per catalogue of the page. The controller now hands the page it built to the review extension (SuggestionReviewExtension::prefetch()), which reads it with OverrideReader::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.
  • The constraint goes to ^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.md and the comment of the Oldest supported engine job 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.php checks 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, @javascript included.

Points to watch

  • Tests pass (vendor/bin/phpunit, vendor/bin/behat --strict)
  • PHPStan and ECS are green
  • UPGRADE.md is 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 unchanged
  • A decision taken or reversed has its record in docs/adr/ - none
  • No API key, customer data or pre-production URL appears in the code, the tests or this description

If the pull request needs a newer engine

cyllene-digital/ai-translation-bundle 1.4.2, for the fix above. The constraint is raised in composer.json.

…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.
@JDCyllene
JDCyllene requested a review from a team as a code owner October 16, 2026 06:50
@JDCyllene
JDCyllene merged commit ef04b65 into CylleneDigital:main Oct 16, 2026
18 checks passed
@JDCyllene
JDCyllene deleted the perf/group-the-review-reads branch October 16, 2026 07:17
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.

1 participant