# TF-09 — Form Naming Convention Validator

| | |
|---|---|
| **Feature** | Automated validation of SFAE object names against the official naming convention |
| **Test Page** | TBD (web tool to be built) |
| **Status** | 📋 Backlog |
| **Last Verified** | — |
| **Ref** | [`naming-conventions.md`](../PDD/naming-conventions.md) §1–5 |

---

## What We're Testing

A naming convention validator tool that:
1. Accepts any SFAE object name as input
2. Parses it against the official pattern: `[Country/Dept]| [Campaign]-[ObjectType][Number][Variant]--[Language] | [Title]`
3. Returns: ✅ valid / ⚠️ minor issues / ❌ invalid — with specific reasons
4. Suggests a corrected name when the input is non-compliant

---

## Acceptance Criteria (for build)

- [ ] Validates country/dept code against known list (`DE`, `ES`, `CH`, `AU`, `NL`, `DM`, `GC`, etc.)
- [ ] Validates object type code against the type table (`eC`, `em`, `FP`, `FH`, `Ls`, `Ld`, `SR`, `EP`, `AR`, `DC`, `R`, `Q`, `k`)
- [ ] Validates language code suffix (`--en`, `--de`, `--all`, etc.)
- [ ] Detects missing `|` separators
- [ ] Detects missing `--language` suffix
- [ ] Detects reversed order (e.g. language before type code)
- [ ] Handles layout template names (`LTF#-pro`, `LTP#-stg`, etc.)
- [ ] Returns suggested compliant name when repairable

---

## Test Cases (for when tool is built)

| Input Name | Expected Result | Reason |
|---|---|---|
| `DE\| C54-FH1--all - Registration Form` | ✅ Valid | Correct pattern |
| `DE\| C54-FH1 - Registration Form` | ⚠️ Minor | Missing `--language` suffix |
| `C54-FH1--all - Registration Form` | ❌ Invalid | Missing country prefix |
| `DE\| C54-XX1--en - Some Form` | ❌ Invalid | `XX` is not a valid type code |
| `LTF4-pro\| FORM MLANG` | ✅ Valid | Layout template pattern |
| `DM\| C54-eC10A--en \| Autoresponder /vA:LongTexts` | ✅ Valid | Full email pattern with variant |
| `DE\| Generic Contact Form` | ❌ Invalid | No campaign code, no type code |
| `ES \| Formulario contacto web` | ❌ Invalid | No campaign, no type, space before pipe |

---

## Implementation Notes

- Can be built as a JS module served at `/tools/naming-validator.html`
- Should integrate with `forms-inventory.md` — run validator over the full inventory to surface renames needed
- Consider exporting as a Claude tool for the SFAE agent to use programmatically
