Enterprise Demo Fixtures Validation Scripts
This directory contains scripts for validating and managing enterprise demo fixtures for the Bakery AI platform.
Scripts Overview
1. validate_enterprise_demo_fixtures.py
Main Validation Script
Validates all cross-references between JSON fixtures for enterprise demo sessions. Checks that all referenced IDs exist and are consistent across files.
Features:
- Validates user-tenant relationships
- Validates parent-child tenant relationships
- Validates product-tenant and product-user relationships
- Validates ingredient-tenant and ingredient-user relationships
- Validates recipe-tenant and recipe-product relationships
- Validates supplier-tenant relationships
- Checks UUID format validity
- Detects duplicate IDs
Usage:
python scripts/validate_enterprise_demo_fixtures.py
2. fix_inventory_user_references.py
Fix Script for Missing User References
Replaces missing user ID c1a2b3c4-d5e6-47a8-b9c0-d1e2f3a4b5c6 with the production director user ID ae38accc-1ad4-410d-adbc-a55630908924 in all inventory.json files.
Usage:
python scripts/fix_inventory_user_references.py
3. generate_child_auth_files.py
Child Auth Files Generator
Creates auth.json files for each child tenant with appropriate users (manager and staff).
Usage:
python scripts/generate_child_auth_files.py
4. demo_fixtures_summary.py
Summary Report Generator
Provides a comprehensive summary of the enterprise demo fixtures status including file sizes, entity counts, and totals.
Usage:
python scripts/demo_fixtures_summary.py
5. comprehensive_demo_validation.py
Comprehensive Validation Runner
Runs all validation checks and provides a complete report. This is the recommended script to run for full validation.
Usage:
python scripts/comprehensive_demo_validation.py
Validation Process
Step 1: Run Comprehensive Validation
python scripts/comprehensive_demo_validation.py
This script will:
- Run the main validation to check all cross-references
- Generate a summary report
- Provide a final status report
Step 2: Review Results
The validation will output:
- ✅ Success: All cross-references are valid
- ❌ Failure: Lists specific issues that need to be fixed
Step 3: Fix Issues (if any)
If validation fails, you may need to run specific fix scripts:
# Fix missing user references in inventory
python scripts/fix_inventory_user_references.py
# Generate missing auth files for children
python scripts/generate_child_auth_files.py
Step 4: Re-run Validation
After fixing issues, run the comprehensive validation again:
python scripts/comprehensive_demo_validation.py
Current Status
✅ All validation checks are passing!
The enterprise demo fixtures are ready for use with:
- 6 Tenants (1 parent + 5 children)
- 25 Users (15 parent + 10 children)
- 45 Ingredients (25 parent + 20 children)
- 4 Recipes (parent only)
- 6 Suppliers (parent only)
All cross-references have been validated and no missing IDs or broken relationships were detected.
Fixture Structure
shared/demo/fixtures/enterprise/
├── parent/
│ ├── 01-tenant.json # Parent tenant and children definitions
│ ├── 02-auth.json # Parent tenant users
│ ├── 03-inventory.json # Parent inventory (ingredients, products)
│ ├── 04-recipes.json # Parent recipes
│ ├── 05-suppliers.json # Parent suppliers
│ ├── 06-production.json # Parent production data
│ ├── 07-procurement.json # Parent procurement data
│ ├── 08-orders.json # Parent orders
│ ├── 09-sales.json # Parent sales data
│ ├── 10-forecasting.json # Parent forecasting data
│ └── 11-orchestrator.json # Parent orchestrator data
│
└── children/
├── A0000000-0000-4000-a000-000000000001/ # Madrid - Salamanca
├── B0000000-0000-4000-a000-000000000001/ # Barcelona - Eixample
├── C0000000-0000-4000-a000-000000000001/ # Valencia - Ruzafa
├── D0000000-0000-4000-a000-000000000001/ # Seville - Triana
└── E0000000-0000-4000-a000-000000000001/ # Bilbao - Casco Viejo
Key Relationships Validated
- User-Tenant: Users belong to specific tenants
- Parent-Child: Parent tenant has 5 child locations
- Ingredient-Tenant: Ingredients are associated with tenants
- Ingredient-User: Ingredients are created by users
- Recipe-Tenant: Recipes belong to tenants
- Recipe-Product: Recipes produce specific products
- Supplier-Tenant: Suppliers are associated with tenants
Requirements
- Python 3.7+
- No additional dependencies required
Maintenance
To add new validation checks:
- Add new relationship processing in
validate_enterprise_demo_fixtures.py - Add corresponding validation logic
- Update the summary script if needed
Troubleshooting
If validation fails:
- Check the specific error messages
- Verify the referenced IDs exist in the appropriate files
- Run the specific fix scripts if available
- Manually correct any remaining issues
- Re-run validation