Repository navigation
feat: adopt ai-translation-bundle 1.4 - #8
Merged
Merged
Conversation
- require ^1.4.1; - read the inherited value of a reverted hand edit with getInheritedValue(); - read the overrides of every catalogue of a view at once (getTranslationsForCatalogues()); - declare the locales of each channel (ScopeLocalesProviderInterface): an import skips an entry in a locale its channel does not offer; - record 0024, superseding 0022: the guard against double billing is now in the engine's contract; - document the translation files cache pool and the refusal of a run for a deleted channel.
…m a failure Found reviewing the adoption of the bundle 1.4: - outside a request, the channels are kept one second at most: the engine checks the channel of a run before each chunk, and a list kept for the whole Messenger message hid a channel deleted during the run; - a row the engine reserved before calling the provider shows a "Sent to the provider" badge instead of "Generation failed", and no failure in the review modal; - a hand edit reads the inherited value once; - the cost of a view is counted again, on the real engine: the number of catalogues does not change it; - record 0024 and the docs say what a refused run leaves, when the parsed files pool needs emptying, and what a replaced or decorated scope provider must implement.
Found reviewing the previous fix: - the review modal shows a "Sent to the provider" notice for a reserved row, where it showed nothing; the row keeps the engine's error for when its run was killed; - the "Generation failed" filter help says it keeps the reserved rows too; - the channel list computes its expiry once; - the query count of a view is measured after a warm-up call; - record 0024 no longer copies the engine's guarantees, and names its cost and the synchronous transport; the docs word the parsed files pool, a parent language at an import and an unguarded run as the engine does.
- a reserved row is also settled by hand in the review modal, not only by "Retry errors"; - record 0024 says the channel is checked when a run starts too; - the filter help keeps to what the filter keeps; - the review modal's in-flight notice is checked by the functional test, and the query count test loses a warm-up call that warmed nothing.
Once Sylius has committed a channel's deletion, the engine's ScopePurger removes its overrides, suggestions and prompt context; the generation journal stays. A purge that fails is logged, and purge-scopes catches it later, with what channels deleted another way left behind. ADR 0025 supersedes 0023.
…decision - The purge runs after the host's post_delete listeners, catches the failures of a purge only (an \Exception, not an \Error) and logs them neutrally; a test deletes a channel through Sylius' grid. - The review modal works with an overridden template that lacks the in-flight target; a reserved row's approve button says its value is still to come, and its help that a decision taken now stands. - A Behat scenario opens the review of a reserved row. - The docs say what a bulk deletion, Sylius' API, a large channel and a synchronous transport do, and ADR 0025 says who may delete a channel.
… as they behave - The docs say that a purge failing during its flush in a bulk deletion ends on an error page, that a channel created again under a code finds what was left under it, and that deleting a channel needs no role of the plugin. - Without the in-flight target, the review modal shows the row's error as before; a test pins the purge after the host's listeners. - The approval flashes name a row still with the provider.
5 tasks done
… reading their priority Symfony 7.4 and 8 type getListenerPriority() differently, which PHPStan refuses on one or the other: a probe listener at -1000 runs before the purge, which must come last.
5 tasks done
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
Adopts what
cyllene-digital/ai-translation-bundle1.2.0 to 1.4.1 bring to the plugin, and fixes what the upgrade revealed. No migration, no mapping change.^1.4.1: the README, the installation guide, the support policy,CONTRIBUTING.mdand the comment of theOldest supported enginejob follow.OverrideReader::getInheritedValue(): it gives both the baseline and, on a revert, where the entry goes back to. A revert no longer reads the whole catalogue.OverrideReader::getTranslationsForCatalogues()): two queries for the browsed locale, whatever the number of catalogues, where each catalogue took two of its own.ScopeLocalesProviderInterface): an import now skips, and names in its preview, an entry in a locale its channel does not offer. Stored, it would never be served nor shown. A parent language is offered (frfor a channel infr_FR); a channel without a locale restricts nothing.ChannelRegistrynow keeps the channels one second at most; within a request, nothing changes.ScopePurger, 1.3.0): once Sylius has committed the deletion, onsylius.channel.post_deleteafter the host's own listeners, its overrides, suggestions and prompt context are purged; the generation journal stays. A purge that fails is logged and the deletion goes through;cyllene:ai-translation:purge-scopescatches what it left, and what a channel deleted another way (a script, Sylius' API, SQL) keeps. Record 0025 supersedes 0023.translation_files_cachepool and when to empty it, what a run refused or stopped for a deleted channel leaves, keeping the engine's transport asynchronous, and what a replaced or decorated scope provider must implement.The unit
TranslationViewFactoryTestgoes: it stubbed the manager interface, and the grouped read is a method ofOverrideReader, a final class no unit test can build.tests/Integration/View/TranslationViewFactoryTest.phpcounts the queries of a view on the real engine instead (Doctrine's debug middleware), and fails on a return to the per-catalogue read (13 queries instead of 3 on the test application).CatalogueRowsTestchecks that each catalogue keeps its own overrides and inherited values.Left as they are:
How it was checked, on Sylius 2.3 and PHP 8.4 against MariaDB:
composer validate --strict,lint:container,lint:twig,lint:yaml,doctrine:schema:validate, PHPStan and ECS, PHPUnit (152 tests) and the 46 Behat scenarios,@javascriptincluded. Each new test was checked to fail without the change it covers: the import test withoutScopeLocalesProviderInterface, the in-flight tests with the templates and the Stimulus controller as they were, the query count test with the per-catalogue read, the channel deletion tests with the listener unwired or at the default priority.Also tried on a development shop with a real provider and worker: a channel deleted during a 15-chunk run stops it before its next chunk; a worker killed during a call leaves "Sent to the provider" rows that "Retry errors" fills; an import line in a locale its channel does not offer is skipped; deleting a channel from the admin purges its overrides and suggestions and keeps its journal. On a synthetic catalogue of 5,026 keys in 26 catalogues, the full view costs 3 queries instead of 53.
For a host upgrading
Nothing to change:
UPGRADE.mdlists breaks only, and nothing of the public surface breaks. Worth knowing:bin/console cyllene:ai-translation:purge-scopeslists them,--forcepurges them;admin/suggestion/content/review_modal.html.twigkeeps working; adding theinFlighttarget block of the plugin's template gives it the "Sent to the provider" notice;OverrideReader, no longer throughTranslationManagerInterface::getTranslationsForCatalogue(): a host decorating that method no longer sees this screen go through it.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 breaks: the channel scope provider implements one more engine interface, whichdocs/architecture/public-contract.mdnow names for a host replacing or decorating it.admin/suggestion/grid/field/suggested.html.twig,admin/suggestion/grid/_review_trigger.html.twigandadmin/suggestion/content/review_modal.html.twigchange: a theme that overrides them keeps working, without the "Sent to the provider" badge and noticedocs/adr/- 0024, superseding 0022, and 0025, superseding 0023If the pull request needs a newer engine
cyllene-digital/ai-translation-bundle1.4.1:getInheritedValue()and the guarantees of a generation run are in its contract since 1.2.0,getTranslationsForCatalogues()andScopeLocalesProviderInterfacesince 1.3.0, the cache pool since 1.4.0, and 1.4.1 fixes the events of concurrent writes. The constraint is raised incomposer.json.