Skip to content

Phase 2: Multi-Store/Locale + Enrichment Status Flags#53

Closed
DavidLambauer wants to merge 27 commits intomage-os-lab:mainfrom
DavidLambauer:feature/phase2-multistore-enrichment-flags
Closed

Phase 2: Multi-Store/Locale + Enrichment Status Flags#53
DavidLambauer wants to merge 27 commits intomage-os-lab:mainfrom
DavidLambauer:feature/phase2-multistore-enrichment-flags

Conversation

@DavidLambauer
Copy link
Copy Markdown
Contributor

Summary

Depends on: #52 (Phase 1: Housekeeping + Configurable Attributes)

Multi-Store/Locale (#12) Details

The enrichment pipeline now carries store context end-to-end:

  • Request DTO gained a storeId field (defaults to 0 for backward compatibility with in-flight queue messages)
  • Publisher accepts and passes storeId to queue messages
  • Consumer sets the correct store scope before loading the product and enriching
  • SaveAfter observer passes the product's store ID to the publisher
  • MassEnrich controller passes the current admin store scope to the publisher
  • Config::getSystemPrompt() detects the store's locale (general/locale/code) and prepends "Respond in {Language}." to the system prompt for non-English locales (42 languages supported)

Enrichment Status Flags (#48) Details

A new mageos_catalogai_enrichment_log DB table tracks enrichment status per product/attribute/store with a unique constraint on (entity_id, attribute_code, store_id).

  • EnrichmentLog model with status constants: generated, pending_review, modified
  • EnrichmentLogger service provides log(), markModified(), getStatus(), and getStatusesForProduct()
  • Enricher writes a log entry after each successful AI generation
  • SaveBefore observer detects manual edits to previously enriched attributes and marks them as modified
  • UI modifier adds a CSS class (mageos-catalogai-enriched-field) to enriched fields on the product edit form for future visual indicators

Test plan

  • Run setup:upgrade — should create the mageos_catalogai_enrichment_log table
  • Run setup:di:compile — should complete without errors
  • Verify enrichment still works on default store (backward compatible)
  • Configure a non-English store (e.g., French locale), enrich a product — verify AI output is in the store's language
  • Mass enrich products from the admin grid — verify store scope is passed
  • After AI enrichment, check the mageos_catalogai_enrichment_log table for generated status entries
  • Manually edit an AI-generated field and save — verify log status changes to modified
  • Open product edit form — verify enriched fields have the mageos-catalogai-enriched-field CSS class

Phased roadmap covering all 12 open issues: configurable attributes,
multi-store/locale, prompt rules engine, review workflow, and
structured attribute extraction.
Detailed task-by-task plan for housekeeping (mage-os-lab#22, mage-os-lab#23, mage-os-lab#25) and
configurable attributes (mage-os-lab#27) with TDD steps, exact file paths,
and code snippets.
Multi-store/locale (mage-os-lab#12) and enrichment status flags (mage-os-lab#48):
14 tasks covering store-scoped enrichment, locale-aware prompts,
enrichment log table, and admin UI status indicators.
@DavidLambauer
Copy link
Copy Markdown
Contributor Author

Superseded by #62, which is the locale half of this PR cleanly rebased onto the post-merge main. The #48 enrichment-flags half is covered by @rhoerr's #51 (already merged).

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.

[FEATURE] Translate open ai output based on locale of selected store scope Feat: Flag product attributes that are enriched, on product edit

1 participant