Skip to content

PDD-CLI Bug: Generates Handlers But Doesn't Wire Them Up to Runtime #586

@jiaminc-cmu

Description

@jiaminc-cmu

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:

  1. Automatically register handlers when generating them
  2. Update main module exports
  3. Update routing/event subscription configuration

How to Prevent This in PDD-CLI

What PDD should do differently:

  1. 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
    ]
  2. Update configuration files:

    # functions.yaml
    functions:
      - name: crmActionEventHandler
        trigger:
          topic: crm-action-scheduled
  3. 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


For Contributors: Discovered when crmActionEventHandler was implemented but not exported in main.py, manually added in commit 34a651d5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions