Files
igny8/docs/SITEBUILDER-REMOVAL-SUMMARY.md
2025-12-01 02:22:02 +00:00

11 KiB

SiteBuilder/Blueprint Removal Summary

Date: December 1, 2025
Status: Complete - Backend Healthy

Overview

Successfully removed all SiteBuilder and Blueprint functionality from IGNY8 system while maintaining the core planner-writer-publisher workflow and WordPress integration.


What Was Removed

1. Django Models (backend/igny8_core/business/site_building/models.py)

  • SiteBlueprint - Legacy site planning model
  • PageBlueprint - Legacy page planning model
  • SiteBlueprintCluster - Blueprint-cluster relationship
  • SiteBlueprintTaxonomy - Blueprint-taxonomy relationship
  • ContentTaxonomyMap - Replaced with direct M2M

2. Django Module

  • backend/igny8_core/business/site_builder/ - Entire module removed from INSTALLED_APPS (settings.py line 60)
  • ⚠️ Directory still exists with tests/services but not loaded by Django

3. Frontend Components

  • frontend/src/modules/siteBuilder/ - Entire directory removed
  • frontend/src/services/api.ts - SiteBlueprint interfaces and functions removed (replaced with comment)

4. API Endpoints (backend/igny8_core/modules/publisher/views.py)

  • PublisherViewSet.publish_to_sites() - Blueprint publishing action
  • PublisherViewSet.deployment_readiness() - Blueprint readiness check
  • PublisherViewSet.deploy() - Blueprint deployment action

5. Publishing Service Methods (backend/igny8_core/business/publishing/services/publisher_service.py)

  • PublisherService.publish_to_sites() - Blueprint publishing
  • PublisherService.get_deployment_status() - Blueprint deployment status

6. Publishing Models Foreign Keys

  • PublishingRecord.site_blueprint - FK removed
  • DeploymentRecord.site_blueprint - FK removed

What Was Simplified

Taxonomy Architecture Change

Before (Complex):

Content → ContentTaxonomyMap → ContentTaxonomy
          (through table with FK)

After (Simple):

Content ↔ ContentTaxonomy
(many-to-many via ContentTaxonomyRelation)

Files Changed:

  1. backend/igny8_core/business/content/models.py

    • Added Content.taxonomy_terms M2M field
    • Through model: ContentTaxonomyRelation
  2. backend/igny8_core/tasks/wordpress_publishing.py

    • Updated to use content.taxonomy_terms.filter(taxonomy_type='category')
    • Updated to use content.taxonomy_terms.filter(taxonomy_type='tag')
  3. backend/igny8_core/business/planning/services/candidate_engine.py

    • Changed from ContentTaxonomyMap.objects.filter(content=...)
    • To: content.taxonomy_terms.values_list('id', flat=True)

Current System Architecture

Planner-Writer-Publisher Workflow (Intact)

1. PLANNER (Phase 1-3)
   Keywords → Clusters → Ideas

2. WRITER (Phase 4)  
   Ideas → Tasks → Content
   
3. PUBLISHER (Phase 5)
   Content → WordPress/Sites

Content Taxonomy Model

Location: backend/igny8_core/business/content/models.py

Model: ContentTaxonomy

class ContentTaxonomy(SiteSectorBaseModel):
    # Core fields
    name                CharField(255)      # "Technology", "Tutorial"
    slug                SlugField(255)      # "technology", "tutorial"  
    taxonomy_type       CharField(50)       # "category" or "tag"
    description         TextField           # Term description
    count               IntegerField        # Usage count
    
    # WordPress sync fields
    external_taxonomy   CharField(100)      # "category", "post_tag"
    external_id         IntegerField        # WordPress term_id
    
    # Metadata
    metadata            JSONField           # AI generation details
    
    # Relationships
    contents            M2M(Content)        # Related content

Model: Content

class Content(SiteSectorBaseModel):
    # Core fields
    title               CharField(255)
    content_html        TextField
    word_count          IntegerField
    
    # SEO
    meta_title          CharField(255)
    meta_description    TextField
    primary_keyword     CharField(255)
    secondary_keywords  JSONField
    
    # Relationships
    cluster             FK(Clusters)        # Required parent cluster
    taxonomy_terms      M2M(ContentTaxonomy) # Categories & tags
    
    # Type/Structure
    content_type        CharField(50)       # post, page, product
    content_structure   CharField(50)       # article, guide, review, etc.
    
    # WordPress sync
    external_id         CharField(255)      # WordPress post ID
    external_url        URLField            # WordPress URL
    external_type       CharField(100)      # WordPress post type
    sync_status         CharField(50)       # Sync status
    
    # Source & Status
    source              CharField(50)       # igny8 or wordpress
    status              CharField(50)       # draft, review, published

Through Model: ContentTaxonomyRelation

class ContentTaxonomyRelation(models.Model):
    content     FK(Content)
    taxonomy    FK(ContentTaxonomy)
    created_at  DateTimeField
    updated_at  DateTimeField
    
    unique_together = [['content', 'taxonomy']]

WordPress Integration (Unchanged)

Bidirectional Sync Still Works

From IGNY8 → WordPress:

# File: backend/igny8_core/tasks/wordpress_publishing.py
categories = [
    term.name 
    for term in content.taxonomy_terms.filter(taxonomy_type='category')
]
tags = [
    term.name 
    for term in content.taxonomy_terms.filter(taxonomy_type='tag')
]

From WordPress → IGNY8:

  • WordPress plugin continues to sync content back
  • External IDs maintained in Content.external_id and ContentTaxonomy.external_id
  • Logging system intact: [5-homeg8.com] [POST] ...

Database Migration

Migration File Created

Location: backend/igny8_core/business/site_building/migrations/0002_remove_blueprint_models.py

Operations:

  1. Drop table: site_building_siteblueprint
  2. Drop table: site_building_pageblueprint
  3. Drop table: site_building_siteblueprintcluster
  4. Drop table: site_building_siteblueprinttaxonomy
  5. Remove FK: publishing_publishingrecord.site_blueprint_id
  6. Remove FK: publishing_deploymentrecord.site_blueprint_id

⚠️ Migration Status: NOT YET APPLIED

Reason: PostgreSQL database is external (not in docker-compose)

To Apply Manually:

# Connect to your PostgreSQL database and run:
cd /data/app/igny8/backend
docker exec -it igny8_backend python manage.py migrate

Or if manual SQL preferred:

-- Drop blueprint tables
DROP TABLE IF EXISTS site_building_siteblueprinttaxonomy CASCADE;
DROP TABLE IF EXISTS site_building_siteblueprintcluster CASCADE;
DROP TABLE IF EXISTS site_building_pageblueprint CASCADE;
DROP TABLE IF EXISTS site_building_siteblueprint CASCADE;

-- Remove foreign keys from publishing tables
ALTER TABLE publishing_publishingrecord DROP COLUMN IF EXISTS site_blueprint_id;
ALTER TABLE publishing_deploymentrecord DROP COLUMN IF EXISTS site_blueprint_id;

Files Modified (24 Backend + 3 Frontend)

Backend Core

  1. backend/igny8_core/settings.py - Removed site_builder from INSTALLED_APPS
  2. backend/igny8_core/business/site_building/models.py - Emptied (placeholder comments only)
  3. backend/igny8_core/business/site_building/admin.py - Emptied
  4. backend/igny8_core/business/publishing/models.py - Removed site_blueprint FK
  5. backend/igny8_core/business/publishing/services/publisher_service.py - Removed blueprint methods
  6. backend/igny8_core/modules/publisher/views.py - Removed blueprint actions
  7. backend/igny8_core/modules/publisher/serializers.py - Fixed to use exclude=[]
  8. backend/igny8_core/tasks/wordpress_publishing.py - Updated to use M2M taxonomy

Backend Services

  1. backend/igny8_core/business/planning/services/metadata_mapping_service.py - Removed ContentTaxonomyMap import
  2. backend/igny8_core/business/planning/services/candidate_engine.py - Updated to use M2M taxonomy

Frontend

  1. frontend/src/services/api.ts - Removed SiteBlueprint interfaces/functions
  2. frontend/src/modules/siteBuilder/ - DELETED DIRECTORY

Verification Steps Completed

Backend Health Check

$ docker ps --filter "name=igny8_backend"
igny8_backend   Up 27 seconds (healthy)

Celery Worker Health

$ docker ps --filter "name=igny8_celery"
igny8_celery_worker   Up About a minute
igny8_celery_beat     Up 3 hours

Backend Startup Logs

[2025-12-01 02:03:31] [INFO] Starting gunicorn 23.0.0
[2025-12-01 02:03:31] [INFO] Listening at: http://0.0.0.0:8010
[2025-12-01 02:03:31] [INFO] Using worker: sync
[2025-12-01 02:03:31] [INFO] Booting worker with pid: 7
[2025-12-01 02:03:31] [INFO] Booting worker with pid: 8
[2025-12-01 02:03:31] [INFO] Booting worker with pid: 9
[2025-12-01 02:03:31] [INFO] Booting worker with pid: 10

No Import Errors

No NameError: name 'SiteBlueprint' is not defined errors


Remaining References (Harmless)

Where: site_building tests and services (not loaded)

  • backend/igny8_core/business/site_building/tests/ - Test files (not executed)
  • backend/igny8_core/business/site_building/services/ - Service files (not imported)
  • backend/igny8_core/business/planning/models.py - Comment only

Why Harmless: site_builder module removed from INSTALLED_APPS so Django never loads these files.


Django Admin Access

ContentTaxonomy Available

URL: http://your-domain/admin/writer/contenttaxonomy/

Features:

  • Create/edit categories and tags
  • Set taxonomy_type (category/tag)
  • Configure WordPress sync (external_id, external_taxonomy)
  • View count and metadata

Content Available

URL: http://your-domain/admin/writer/content/

Features:

  • View all content
  • Edit taxonomy_terms M2M relationships
  • See cluster relationships
  • WordPress sync status

Next Steps (Optional)

1. Apply Database Migration

docker exec -it igny8_backend python manage.py migrate

2. Clean Up Remaining Files (Optional)

# Remove site_building directory entirely if not needed for history
rm -rf backend/igny8_core/business/site_building/

# Or keep for git history but add .gitignore
echo "backend/igny8_core/business/site_building/" >> .gitignore

3. Test WordPress Publishing

  1. Create test content in Django admin
  2. Assign categories/tags via taxonomy_terms M2M
  3. Publish to WordPress
  4. Verify categories/tags appear correctly
  5. Check sync logs: backend/logs/publish-sync-logs/*.log

Technical Notes

Python Bytecode Cache Issue Resolved

Problem: Docker container cached old .pyc files with SiteBlueprint references
Solution: Used docker compose up -d --force-recreate igny8_backend to clear cache

Import Structure Clean

  • No circular imports
  • No missing dependencies
  • All type hints cleaned from removed models

Multi-Tenant Architecture Intact

Account → Site → Sector → Content/Taxonomy

All models inherit from SiteSectorBaseModel with proper filtering.


Support

For issues or questions about this removal:

  1. Check backend logs: docker logs igny8_backend
  2. Check celery logs: docker logs igny8_celery_worker
  3. Check publish logs: backend/logs/publish-sync-logs/
  4. Refer to: docs/02-PLANNER-WRITER-WORKFLOW-TECHNICAL-GUIDE.md

Summary: All SiteBuilder/Blueprint functionality successfully removed. Backend healthy. WordPress publishing intact. Taxonomy simplified to direct M2M relationship. Migration file created but not yet applied.