Repository navigation
fix: store no errored row in a scope deleted while its batch was with the provider - #16
Merged
JDCyllene merged 1 commit intoOct 16, 2026
Conversation
… the provider A run whose scope is deleted and purged during a provider call stops before its next batch, but a failure of that call stored errored rows for every key never sent, under the deleted code: a scope created again under it found them, and purge-scopes no longer saw the code. The failure path now checks the scope before creating a row.
5 tasks done
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
A run whose scope is deleted, and purged, while a batch is with the provider stops before its next batch. But when that very call failed,
SuggestionGenerator::storeFailures()stored an errored suggestion for every key the run had not sent yet, under the deleted code. A scope created again under that code then found errored suggestions nobody asked it for, andcyllene:ai-translation:purge-scopesno longer saw the code to remove them.The failure path now checks the scope before creating a row: a scope that is gone gets no new errored row. The rows reserved before the call are handled as before (a purge has deleted them; otherwise they record the failure), and the run is journaled as a failure as before.
docs/public-contract.md(what a generation run guarantees) anddocs/concepts/scopes.mdsay so.TranslationAiServiceTest::testAProviderFailureAfterTheScopeIsDeletedLeavesNoNewRowInItdeletes the scope during the first call, which then fails: 20 rows (the reserved batch) instead of 25. It fails without the change.Found while adopting
ScopePurgerin the Sylius plugin (CylleneDigital/SyliusAiTranslationPlugin#8), whose record on a deleted channel mentions this case until the plugin requires the release carrying this fix.Points to watch
vendor/bin/phpunit): 692 testsvendor/bin/phpstan analyse,vendor/bin/php-cs-fixer check)UPGRADE.mdis up to date if the public contract changes: everythingdocs/public-contract.mdlists, method signatures included - nothing breaks: one guarantee is added to what a generation run promises, no signature changesdocs/adr/- none: a fix within record 0025 (a deleted scope is purged, its journal kept)If the pull request touches the entity mapping
It does not.
If the pull request touches a provider bridge
It does not.