Skip to content

PDD-CLI Bug: Generates Feature Code Without Required Environment Configuration #583

@jiaminc-cmu

Description

@jiaminc-cmu

PDD-CLI Bug: Generates Feature Code Without Required Environment Configuration

PDD-CLI implements features that require environment variables or configuration settings, but doesn't generate the required .env entries or configuration files. Features fail at runtime due to missing configuration.

Why this matters: Generated features crash immediately with "missing environment variable" errors.

Concrete Example

For an email sending feature:

# PDD generated feature (INCOMPLETE):
# email_service.py
import brevo

def send_email(to: str, subject: str, body: str):
    client = brevo.Client(api_key=os.getenv('BREVO_API_KEY'))
    client.send(
        to=to,
        from_email=os.getenv('BREVO_SENDER_EMAIL'),  # ← Not in .env!
        from_name=os.getenv('BREVO_SENDER_NAME'),    # ← Not in .env!
        subject=subject,
        html=body
    )

But .env file has no configuration:

# .env (MISSING REQUIRED VARS)
BREVO_API_KEY=xxx
# Missing: BREVO_SENDER_EMAIL
# Missing: BREVO_SENDER_NAME

What went wrong: PDD implemented email sending but didn't add the required sender configuration to .env.example or document what values are needed.

Impact: Runtime error: KeyError: 'BREVO_SENDER_EMAIL' or emails fail silently with missing sender info.

Why PDD Makes This Mistake

PDD-CLI currently:

  • Generates feature code in isolation
  • Doesn't track environment dependencies
  • Doesn't update configuration files

But it should:

  1. Identify required environment variables in generated code
  2. Update .env.example with new variables and documentation
  3. Add to README/docs what configuration is needed

How to Prevent This in PDD-CLI

What PDD should do differently:

  1. Generate complete configuration:

    # When generating email_service.py, also update:
    
    # .env.example
    BREVO_API_KEY=your_api_key_here
    BREVO_SENDER_EMAIL=noreply@example.com
    BREVO_SENDER_NAME=Your App Name
  2. Document configuration requirements:

    # README.md
    ## Email Configuration
    Set the following environment variables:
    - `BREVO_API_KEY`: API key from Brevo dashboard
    - `BREVO_SENDER_EMAIL`: Verified sender email address
    - `BREVO_SENDER_NAME`: Display name for sender
  3. Validate configuration at startup: Generate validation code that checks required vars exist.

Example improvement:

Current: "Add email feature"
       → Generate email_service.py
       → Missing .env configuration
       → Runtime failures

Improved: "Add email feature"
        → Generate email_service.py
        → Update .env.example with BREVO_* vars
        → Add config validation in startup
        → Document in README
        → Complete, working feature

Severity

P1 - High Priority

  • Frequency: Medium - affects features needing external services
  • Impact: High - features completely broken until manually configured
  • Detectability: High - immediate runtime errors
  • Prevention cost: Low - track env vars during generation

Category

incomplete-implementation

Related Issues


For Contributors: Discovered when email sending feature crashed with missing BREVO_SENDER_EMAIL and BREVO_SENDER_NAME configuration, fixed 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