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
+18 -3
View File
@@ -8,7 +8,7 @@ import (
func TestCategoryEnhanceHasRoleSections(t *testing.T) {
t.Parallel()
if !CategoryEnhanceHasRoleSections(CategoryEnhanceUserTemplate) {
t.Fatal("canonical CategoryEnhanceUserTemplate must have title/description/meta/attributes sections")
t.Fatal("canonical CategoryEnhanceUserTemplate must have title/description/meta sections")
}
if CategoryEnhanceHasRoleSections("legacy HTML prompt") {
t.Fatal("unstructured prompt must not report role sections")
@@ -16,6 +16,18 @@ func TestCategoryEnhanceHasRoleSections(t *testing.T) {
if CategoryEnhanceHasRoleSections("--- Title ---\nonly title") {
t.Fatal("partial sections must not pass")
}
// Old stored prompts with an attributes section still count as sectioned
// (repair rewrites them via CategoryEnhancePromptNeedsRepair).
old := "--- Title ---\nx\n--- Description ---\ny\n--- Meta ---\nz\n--- Attributes ---\na\n--- End Attributes ---"
if !CategoryEnhanceHasRoleSections(old) {
t.Fatal("old attributes-bearing prompt must still report role sections")
}
if !CategoryEnhancePromptNeedsRepair(old) {
t.Fatal("old attributes-bearing prompt must need repair (attributes section retired)")
}
if CategoryEnhancePromptNeedsRepair(CategoryEnhanceUserTemplate) {
t.Fatal("canonical template must not need repair")
}
}
func TestCategoryPromptRolesOrder(t *testing.T) {
@@ -38,14 +50,17 @@ func TestCategoryEnhanceUserTemplateRoleMarkers(t *testing.T) {
SectionTitleStart, SectionTitleEnd,
SectionDescriptionStart, SectionDescriptionEnd,
SectionMetaStart, SectionMetaEnd,
SectionAttributesStart, SectionAttributesEnd,
} {
if !strings.Contains(tpl, marker) {
t.Fatalf("template missing %q", marker)
}
}
// Attribute prompting is retired from category prompts (pipeline-level only).
if strings.Contains(tpl, SectionAttributesStart) || strings.Contains(strings.ToLower(tpl), "role: attributes") {
t.Fatal("template must not carry an attributes role section")
}
lower := strings.ToLower(tpl)
for _, role := range []string{"role: title", "role: description", "role: meta", "role: attributes"} {
for _, role := range []string{"role: title", "role: description", "role: meta"} {
if !strings.Contains(lower, role) {
t.Fatalf("template missing %q", role)
}