#!/usr/bin/env python3 """ Load complex architectural decomposition tasks into tasks.json """ import json from pathlib import Path # СЛОЖНЫЕ ЗАДАЧИ ДЛЯ ДЕКОМПОЗИЦИИ # Каждый Architect получит эти задачи и должен разбить их на подзадачи ARCHITECT_TASKS = [ { "task_id": "Decomp/001", "title": "URL Shortener Service (bit.ly clone)", "difficulty": "Hard", "description": "Design a production-ready URL shortener service like bit.ly or tinyurl.com", "requirements": [ "Generate short codes (6-8 characters) from long URLs", "Handle redirects with HTTP 301/302", "Custom alias support (users can choose their short code)", "QR code generation for short URLs", "Link expiration with TTL", "Analytics: click count, timestamp, user-agent, geo-location" ], "non_functional": [ "10M URLs in database", "100K requests/second throughput", "99.9% availability", "<50ms p95 latency for redirects", "Handle duplicate URL detection" ], "constraints": [ "Base62 encoding for short codes", "No external dependencies for core logic", "Must handle hash collisions gracefully" ], "considerations": [ "How to generate unique short codes at scale?", "How to handle hash collisions?", "Database schema design (SQL vs NoSQL)?", "Caching strategy (Redis)?", "Rate limiting for abuse prevention?" ] }, { "task_id": "Decomp/002", "title": "Real-Time Chat Service (Discord/Slack clone)", "difficulty": "Hard", "description": "Design a real-time messaging platform supporting multiple channels and online presence", "requirements": [ "Real-time message delivery using WebSockets", "Multiple channels/servers per user", "Message history with pagination", "User online/offline status", "Direct messages (DM) between users", "Message reactions and emojis", "File attachments (images, documents)", "Message search functionality" ], "non_functional": [ "100K concurrent connections", "<100ms message delivery latency", "99.95% availability", "Persistent message storage" ], "constraints": [ "Message ordering must be preserved", "Handle network reconnection gracefully", "Support both WebSocket and HTTP fallback" ], "considerations": [ "Message broker choice (Kafka vs RabbitMQ)?", "How to handle user presence across devices?", "Message storage optimization (hot vs cold data)?", "Scaling WebSocket connections?" ] }, { "task_id": "Decomp/003", "title": "Distributed Task Queue (Celery/RQ clone)", "difficulty": "Hard", "description": "Build a distributed task execution system with worker pools and result storage", "requirements": [ "Task scheduling with priorities", "Retrying failed tasks with exponential backoff", "Task chaining and workflows (DAG)", "Periodic/cron-like tasks", "Task result storage and retrieval", "Worker health monitoring and auto-recovery", "Task cancellation support", "Rate limiting per task type" ], "non_functional": [ "1M tasks/day throughput", "Horizontal scaling of workers", "Fault tolerance (broker/worker failures)", "<1s task scheduling latency" ], "constraints": [ "At-least-once delivery semantics", "No duplicate task execution", "Support both sync and async task execution" ], "considerations": [ "Message broker choice (Redis vs RabbitMQ vs Kafka)?", "Task serialization format?", "How to handle long-running tasks?", "Worker scaling strategy?", "Dead letter queue handling?" ] }, { "task_id": "Decomp/004", "title": "E-Commerce Order Processing System", "difficulty": "Hard", "description": "Design a robust order processing pipeline handling inventory, payments, and fulfillment", "requirements": [ "Shopping cart management", "Inventory reservation and locking", "Payment integration (multiple providers)", "Order status workflow (pending→paid→shipped→delivered)", "Shipping label generation", "Order cancellation and refund handling", "Notification system (email/SMS)", "Order history and analytics" ], "non_functional": [ "Handle 10K orders/minute peak", "Exactly-once inventory deduction", "Payment transaction consistency", "<200ms checkout flow latency" ], "constraints": [ "ACID properties for order-inventory operations", "Idempotent payment processing", "Handle payment failures gracefully" ], "considerations": [ "How to prevent race conditions in inventory?", "Distributed transaction pattern (Saga vs 2PC)?", "Payment provider fallback strategy?", "Order event sourcing for audit trail?" ] }, { "task_id": "Decomp/005", "title": "Distributed File Storage System (S3 clone)", "difficulty": "Hard", "description": "Design a scalable object storage service with durability and availability guarantees", "requirements": [ "File upload/download with chunking", "Bucket-based organization", "Access control (ACLs, presigned URLs)", "File versioning", "Multi-part upload for large files", "Automatic replication across nodes", "Data integrity verification (checksums)", "Lifecycle policies (expiration, archival)" ], "non_functional": [ "99.999999999% durability (11 9's)", "99.99% availability", "Petabyte-scale storage", "Unlimited file size support", "<100ms upload latency p95" ], "constraints": [ "Eventually consistent metadata", "Strong consistency for reads-after-writes", "No single point of failure" ], "considerations": [ "Erasure coding vs replication?", "Consistent hashing for data distribution?", "How to handle node failures?", "Metadata database design?", "Storage backend (local filesystem vs object storage)?" ] } ] def load_tasks(): """Load tasks into tasks.json""" ai_coder_dir = Path(__file__).parent.parent tasks_file = ai_coder_dir / "tasks.json" with open(tasks_file, 'w') as f: json.dump({"tasks": ARCHITECT_TASKS}, f, indent=2) print(f"✅ Loaded {len(ARCHITECT_TASKS)} tasks to {tasks_file}") print(f"📁 Tasks will be decomposed into: {ai_coder_dir / 'subtasks/'}") if __name__ == "__main__": load_tasks()