-
Notifications
You must be signed in to change notification settings - Fork 53
Description
PDD-CLI Bug: Generates Handlers But Doesn't Wire Them Up to Runtime
PDD-CLI implements handler functions (Cloud Functions, API endpoints, event handlers) but doesn't register them with the runtime or export them properly. Handlers exist but are never called.
Why this matters: Generated features don't work because handlers aren't connected to triggers (HTTP requests, events, schedules).
Concrete Example
For a Cloud Function event handler:
# PDD generated handler (INCOMPLETE):
# handlers/crm_events.py
def crmActionEventHandler(event, context):
"""Handle CRM action scheduled events."""
action_id = event['attributes']['action_id']
execute_action(action_id)But not exported in main module:
# main.py (MISSING EXPORT)
# Existing exports
from handlers.user import handle_user_created
from handlers.data import process_data
# Missing: crmActionEventHandler not imported or exported!What went wrong: PDD created the handler function but didn't add it to main.py exports. Cloud Functions runtime can't find the handler, so events go unprocessed.
Impact: Feature completely non-functional - events trigger but handler never executes.
Why PDD Makes This Mistake
PDD-CLI currently:
- Generates implementation in isolation
- Doesn't update runtime registration/exports
- Treats handlers as standalone code
But it should:
- Automatically register handlers when generating them
- Update main module exports
- Update routing/event subscription configuration
How to Prevent This in PDD-CLI
What PDD should do differently:
-
Update exports when generating handlers:
# When generating handlers/crm_events.py, also update: # main.py from handlers.crm_events import crmActionEventHandler # Export for Cloud Functions __all__ = [ 'handle_user_created', 'process_data', 'crmActionEventHandler', # ← Auto-added ]
-
Update configuration files:
# functions.yaml functions: - name: crmActionEventHandler trigger: topic: crm-action-scheduled
-
Generate integration tests: Test that handler is properly wired up.
Example improvement:
Current: "Add CRM event handler"
→ Generate handlers/crm_events.py
→ Handler not exported
→ Events ignored (handler not called)
Improved: "Add CRM event handler"
→ Generate handlers/crm_events.py
→ Update main.py exports
→ Update Cloud Functions config
→ Generate integration test
→ Working end-to-end
Severity
P1 - High Priority
- Frequency: Low - affects serverless functions, event handlers
- Impact: High - features completely non-functional
- Detectability: Medium - handler exists but never runs
- Prevention cost: Low - track exports during generation
Category
incomplete-implementation
Related Issues
- Auto-fix skips fingerprint save causing incomplete metadata (sync_orchestration.py:1350) #430 - Missing environment configuration (similar "forgot to connect")
- Add failing tests for #430: auto-fix fingerprint skip bug #432 - Data models without extraction logic (incomplete pipeline)
- Add failing tests for #411: XSS in Mermaid tooltips #415 - Assumes OOP when using functional (related module structure issue)
For Contributors: Discovered when crmActionEventHandler was implemented but not exported in main.py, manually added in commit 34a651d5.