feat: bulk generation for product descriptions (P0 #2)#9
Merged
Conversation
- BulkJob DAL entity (frosh_ai_bulk_job) + migration
- BulkGenerateMessage (AsyncMessageInterface) + BulkGenerateHandler
- POST /api/_action/frosh-ai/product/bulk-generate + GET /api/_action/frosh-ai/bulk-job/{jobId}
- FeatureId::BulkGeneration + featureBulkGeneration config flag (en/de)
- Unit tests for handler (success, partial failure, missing job)
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
Adds queue-based bulk generation of product descriptions — P0 roadmap item #2, the final P0 item. Generates descriptions for many products at once via Shopware's message bus, reusing
ProductDescriptionGenerator. This is the feature merchants ask for most (single-product modals don't scale to catalogs).How it works
POST /api/_action/frosh-ai/product/bulk-generatewith{productIds, tone?, language?, maxWords?}→ gates master +FeatureId::BulkGeneration+ provider availability → creates afrosh_ai_bulk_jobrow (statusqueued) → dispatchesBulkGenerateMessageonto the message bus → returns{jobId, total}.BulkGenerateHandler(async) processes each product: loads it, callsProductDescriptionGenerator, writes the description back viaproduct.repositoryupdate, and persists progress (processed/succeeded/failed/errors) after every item. Per-item try/catch means one bad product never kills the batch.GET /api/_action/frosh-ai/bulk-job/{jobId}returns live status + counts + errors.Changes
frosh_ai_bulk_jobDAL entity (src/Entity/BulkJob/): Definition + Entity + Collection, all ApiAware, mirrorsUsageLogpattern. Fields: type, status, total/processed/succeeded/failed, entityIds/errors/context (JSON).Migration1783887000CreateBulkJob— creates the table (BINARY id PK, JSON cols, indexes on status + created_at).BulkGenerateMessage(implements ShopwareAsyncMessageInterface) +BulkGenerateHandler(#[AsMessageHandler], autoconfigured likeCleanupUsageLogsHandler).BulkGenerateController(enqueue + status endpoints).FeatureId::BulkGeneration+featureBulkGenerationconfig checkbox (en + de-DE).Tests
BulkGenerateHandlerTest(3 tests): full success (writes descriptions, marks completed), partial failure (error recorded, job still completes), missing job skipped. UpdatedFeatureFlagsTest(8→9 flags).116 tests / 461 assertions, green — locally and in the
frosh-ai-devcontainer (Shopware 6.7 / PHP 8.3).Notes
Admin UI (a "bulk generate" action on the product grid + a progress modal polling the status endpoint) is a deliberate follow-up — this lands the engine + API + flag + tests. Requires a running message-queue worker (
bin/console messenger:consume async) as with any Shopware async task.