CMAP Validation Suite
Invoke: /validate or say "validate solution", "CMAP validation", "pre-deployment check"
Pre-deployment validation for CMAP agentic suite across Microsoft 365, Power Platform, and Azure. Now with full Microsoft Copilot Studio VS Code extension and Power Platform Solution Checker parity. CRITICAL: Includes workflow RootComponent validation to prevent "type 29 not declared" import errors. NEW v7.10: Metadata Labels validation catches missing OptionSet displaynames before import fails.
Validation Coverage (500+ Rules, 18 Validators)
| Category | Rules | Reference |
|---|---|---|
| Package Structure | 25+ | platform-validation-rules.md |
| Solution Structure | 55+ | platform-validation-rules.md |
| Naming Conventions | 85+ | platform-validation-rules.md |
| GUID/Dependencies | 35+ | platform-validation-rules.md |
| Security | 35+ | platform-validation-rules.md |
| CMAP Governance | 60+ | cmap-governance-rules.md |
| File Quality | 10+ | error-codes.md (FQ codes) |
| Naming Consistency | 10+ | error-codes.md (NC codes) |
| Orphan Detection | 10+ | error-codes.md (OF codes) |
| YAML Schema | 20+ | error-codes.md (YS codes) |
| Power Fx Formulas | 15+ | error-codes.md (PF codes) |
| Web Resources | 25+ | error-codes.md (WR codes) |
| Topic Limits | 5+ | error-codes.md (TL codes) |
| Connectors | 15+ | error-codes.md (CN codes) |
| Agent Chaining | 5+ | error-codes.md (AC codes) |
| Workflow RootComponents | 10+ | error-codes.md (WF codes) |
| Solution Structure | 10+ | error-codes.md (SS codes) |
| Metadata Labels | 25+ | v6-learned-patterns.md (ML codes) |
Quick Start
# Full suite validation (18 validators, 500+ rules) python scripts/validate_cmap_suite.py /path/to/deployment/ --include-governance # NEW - Metadata Labels validation (catches missing OptionSet displaynames) python scripts/validate_metadata_labels.py solution.zip python scripts/validate_metadata_labels.py customizations.xml python scripts/validate_metadata_labels.py /path/to/solution/folder/ # NEW - Auto-fix missing metadata labels python scripts/fix_metadata_labels.py solution.zip python scripts/fix_metadata_labels.py customizations.xml # Individual validators - CMAP Governance python scripts/validate_copilot_instructions.py instructions.txt python scripts/validate_kb_compliance.py /path/to/kb/ python scripts/validate_seed_data.py seed_data.json schema.json python scripts/validate_docx_quality.py document.docx python scripts/audit_file_versions.py /path/to/deployment/ python scripts/validate_file_quality.py /path/to/project/ python scripts/validate_naming_consistency.py /path/to/deployment/ python scripts/validate_orphaned_files.py /path/to/deployment/ # Individual validators - MS Extension Parity python scripts/validate_yaml_schema.py /path/to/deployment/ python scripts/validate_powerfx.py /path/to/deployment/ python scripts/validate_web_resources.py /path/to/deployment/ python scripts/validate_topic_limits.py /path/to/deployment/ python scripts/validate_connectors.py /path/to/deployment/ python scripts/validate_agent_chaining.py /path/to/deployment/ # CRITICAL - Workflow RootComponent validation (prevents import failures) python scripts/validate_workflow_rootcomponents.py solution.zip # CRITICAL - Solution Structure validation (catches empty Entities, sync issues) python scripts/validate_solution_structure.py solution.zip
⚠️ CRITICAL: ML001 Missing OptionSet DisplayNames
This is the cause of "Option set display name not specified" import failures.
The Problem (v7.0.17 Failure)
Failed to create entity with logical name ca_frameworks... Option set display name for id: a177e3ab-cdff-f011-8406-6045bd09ffcc, objectcolumn: DisplayName and labelTypeCode: OptionSet not specified
Required Structure (from working v6)
Every <optionset> MUST have:
<optionset Name="ca_framework_statecode">
<OptionSetType>state</OptionSetType>
<IntroducedVersion>1.0</IntroducedVersion>
<IsCustomizable>1</IsCustomizable>
<displaynames> <!-- REQUIRED -->
<displayname description="Status" languagecode="1033" /> <!-- REQUIRED -->
</displaynames>
<states>
<state value="0" defaultstatus="1" invariantname="Active">
<labels> <!-- REQUIRED -->
<label description="Active" languagecode="1033" /> <!-- REQUIRED -->
</labels>
</state>
</states>
</optionset>
Quick Fix
# Validate python scripts/validate_metadata_labels.py solution.zip # Auto-fix python scripts/fix_metadata_labels.py solution.zip # Creates: solution_fixed.zip
Why This Happens
- •New choice fields added without proper labels in the maker portal
- •Solution export corruption
- •Manual XML editing that removes required elements
- •AI code generation that omits localization requirements
Prevention
Run validate_metadata_labels.py before every import attempt.
Validation Workflow
1. Package Structure Validation
Run FIRST - catches blocking issues before detailed validation.
Critical Checks:
- •Archive format:
.zipor.cabonly - •Max size: 95 MB (hard limit)
- •Files at root level (NO wrapper folder)
- •Required root files:
[Content_Types].xml,customizations.xml,solution.xml - •Folder case sensitivity:
CanvasApps/notcanvasapps/
2. Metadata Labels Validation (NEW)
Run SECOND - catches OptionSet/displayname issues.
Critical Checks:
- •Every
<optionset>has<displaynames>with at least one<displayname> - •Every
<displayname>has non-emptydescriptionandlanguagecode="1033" - •Every
<option>,<state>,<status>has<labels>with English label - •Attribute displaynames present (warning only)
3. Entity.xml Validation
Root cause of most import failures.
✅ CORRECT:
<Name LocalizedName="Client" OriginalName="Client">eap_Client</n>
❌ INVALID (causes failure):
<n>eap_capability_impl</n>
4. Copilot Studio Validation
See cmap-governance-rules.md for full details.
Core Instructions Requirements:
- •Plain text only (no markdown)
- •7,500-7,999 characters
- •Must include RAG language (KB search instructions)
- •Must include self-referential learning (session history references)
- •No periods in topic names
5. CMAP Governance Validation
See cmap-governance-rules.md for full details.
Error Code Reference
Error Code Prefixes:
| Prefix | Category |
|---|---|
| CI | Copilot Instructions |
| SR | 6-Rule Compliance |
| SD | Seed Data |
| VC | Version Control |
| DQ | Document Quality |
| FQ | File Quality |
| NC | Naming Consistency |
| OF | Orphaned Files |
| YS | YAML Schema |
| PF | Power Fx |
| WR | Web Resources |
| TL | Topic Limits |
| CN | Connectors |
| AC | Agent Chaining |
| WF | Workflow RootComponents |
| SS | Solution Structure |
| ML | Metadata Labels (NEW) |
| PK | Package Structure |
| DV | Dataverse |
| SP | SharePoint |
| AZ | Azure |
Metadata Labels Error Codes (ML)
| Code | Severity | Description |
|---|---|---|
| ML001 | ERROR | OptionSet missing <displaynames> element |
| ML002 | ERROR | OptionSet <displaynames> empty |
| ML003 | ERROR | <displayname> missing 'description' attribute |
| ML004 | ERROR | <displayname> has empty 'description' |
| ML005 | ERROR | <displayname> missing 'languagecode' |
| ML010 | ERROR | Option missing <labels> element |
| ML011 | ERROR | Option <labels> empty |
| ML012 | WARNING | <label> missing 'description' |
| ML013 | ERROR | State missing <labels> element |
| ML014 | ERROR | Status missing <labels> element |
| ML020 | WARNING | Attribute missing <displaynames> |
| ML021 | WARNING | Attribute <displaynames> empty |
| ML030 | WARNING | Entity missing <LocalizedNames> |
| ML040 | ERROR | Missing English (1033) label |
| ML041 | WARNING | Duplicate languagecode |
| ML050 | WARNING | Invalid OptionSetType value |
| ML051 | ERROR | OptionSet missing 'Name' attribute |
| ML052 | ERROR | Option missing 'value' attribute |
Common Fixes
| Issue | Quick Fix |
|---|---|
| Missing OptionSet displaynames (ML001) | Run scripts/fix_metadata_labels.py solution.zip |
| Missing option labels (ML010-014) | Run scripts/fix_metadata_labels.py solution.zip |
| Entity.xml invalid | Run scripts/fix_entity_xml.py solution.zip |
| Folder case wrong | Rename to exact case: CanvasApps/, Workflows/ |
| Instructions too long | Target 7,700-7,800 chars |
| Missing RAG language | Add "Search your knowledge base before responding" |
| Stale file references | Run scripts/audit_file_versions.py |
| Corrupted characters | Run scripts/fix_docx_encoding.py |
| Empty/stub files | Complete implementation or remove unused files |
| Entity name mismatch | Align folder name, schema name, and OriginalName |
| Missing LocalizedName/OriginalName (DV071/DV072) | Run scripts/fix_name_attributes.py <solution_dir> |
| Folder format (empty customizations.xml) | Run scripts/fix_empty_entities.py <solution_dir> |
| Hybrid format (Entities/ + customizations.xml) | VALID - No action needed |
| Orphaned entity folder | Add to solution.xml RootComponents or remove |
| Orphaned KB file | Connect to agent knowledge source or remove |
| Workflow not declared (type 29) | Add <RootComponent type="29" id="{guid}" schemaName="name" /> to solution.xml |
| Empty Entities section (SS001) | Run scripts/fix_empty_entities.py solution.zip |
| Invalid OwnershipTypeMask (SS008) | Replace OrganizationOwned with OrgOwned |
V6 Learned Patterns
See v6-learned-patterns.md for:
- •Complete OptionSet structure templates
- •State/Status/Picklist patterns
- •Attribute displayname requirements
- •Entity-level metadata patterns
- •OptionSet naming conventions
- •Language code requirements
Version History
- •v1.0 - Initial Power Platform solution validator
- •v2.0 - Expanded to full CMAP suite
- •v2.1 - Added naming conventions, 200+ rules
- •v3.0 - Package structure, Entity.xml, GUID validation, 280+ rules
- •v3.1 - CMAP Governance: 6-Rule KB, Copilot instructions, seed data validation, version control, document quality, 340+ rules
- •v7.09 - Renamed to CMAP Validation, added /validate invoke, master orchestrator script
- •v7.09.1 - Added file quality (FQ), naming consistency (NC), orphan detection (OF), 370+ rules
- •v7.09.2 - MS Extension Parity: YAML schema, Power Fx, web resources, topic limits, connectors, agent chaining, 455+ rules, 15 validators
- •v7.09.3 - CRITICAL: Workflow RootComponent validation (WF), 465+ rules, 16 validators
- •v7.09.4 - CRITICAL: Solution Structure validation (SS), 475+ rules, 17 validators
- •v7.10.0 - Metadata Labels validation (ML) - learned from v6 working solution, catches missing OptionSet displaynames, 500+ rules, 18 validators