Split A1 category prompts canonically; retire attributes prompting

- Category enhance prompts (Sync A1 / seed-a1 / repair) now use the same
  three role sections as the rest of the platform: Title / Description /
  Meta. The retired "--- Attributes ---" role section is removed from the
  canonical template, the legacy-split overlay, and the web prompt editor;
  Category/Attrs stay as plain product-context lines (attribute extraction
  remains pipeline-level via AppendAttributeConstraints).
- Stored prompts still carrying an attributes section are detected by
  CategoryEnhancePromptNeedsRepair and rewritten on the next Sync.
- Legacy wp_product_categories.sql splits now also seed a default Slovenian
  metaTitle rule (dumps only carried <metaDescription>), so every A1
  category gets all four prompt areas: title formula, description
  sections, meta title, meta description.
- Role-sectioned prompts no longer imply the A1 SEO-omit cohort
  (CompanyOmitsSEOMeta): sectioned prompts are the canonical prompt-editor
  output for every tenant, and the sniff silently disabled SEO meta for
  any company that saved a category prompt.
- Verified locally: repair-category-prompts -apply updated 238 A1 +
  Platform Demo categories from scripts/seed/wp_product_categories.sql
  (216 legacy splits), idempotent on re-run, zero attributes sections
  left in DB.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-18 00:13:44 +02:00
co-authored by Claude Fable 5
parent 2a2b01bf59
commit b595398389
14 changed files with 127 additions and 115 deletions
+6 -24
View File
@@ -511,19 +511,17 @@ func CompanyOmitsSEOMetaID(companyID uuid.UUID) bool {
// CompanyOmitsSEOMetaLookup is the shared A1/Demo SEO-omit decision used by V1 process
// and catalog list/get/update. Matches hardcoded companies.id, A1 cohort (legacy id),
// Platform Demo by name, or A1-style --- Title --- / --- Description --- / --- Meta ---
// category prompts.
func CompanyOmitsSEOMetaLookup(companyID uuid.UUID, legacyID, name string, hasA1SectionPrompts bool) bool {
// or Platform Demo by name. Role-sectioned category prompts (--- Title --- / --- Meta ---)
// are the platform-wide canonical prompt shape now, so they no longer imply the A1
// cohort — sniffing them here made any tenant using the prompt editor lose SEO meta.
func CompanyOmitsSEOMetaLookup(companyID uuid.UUID, legacyID, name string) bool {
if CompanyOmitsSEOMetaID(companyID) {
return true
}
if billing.IsA1CohortCompany(legacyID, "") {
return true
}
if strings.EqualFold(strings.TrimSpace(name), "Platform Demo") {
return true
}
return hasA1SectionPrompts
return strings.EqualFold(strings.TrimSpace(name), "Platform Demo")
}
// CompanyOmitsSEOMeta is true when catalog/V1 process must omit meta_title /
@@ -543,23 +541,7 @@ func CompanyOmitsSEOMeta(ctx context.Context, pool *pgxpool.Pool, companyID uuid
if err != nil {
return false
}
if CompanyOmitsSEOMetaLookup(companyID, legacy, name, false) {
return true
}
var hasA1Prompts bool
err = pool.QueryRow(ctx, `
SELECT EXISTS (
SELECT 1 FROM categories
WHERE company_id = $1
AND prompt ILIKE '%--- Title ---%'
AND prompt ILIKE '%--- Description ---%'
AND prompt ILIKE '%--- Meta ---%'
LIMIT 1
)`, companyID).Scan(&hasA1Prompts)
if err != nil {
return false
}
return hasA1Prompts
return CompanyOmitsSEOMetaLookup(companyID, legacy, name)
}
// StripV1SEOMeta removes meta_title / meta_description keys (omit, not null).