-
Notifications
You must be signed in to change notification settings - Fork 53
Description
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_NAMEWhat 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:
- Identify required environment variables in generated code
- Update
.env.examplewith new variables and documentation - Add to README/docs what configuration is needed
How to Prevent This in PDD-CLI
What PDD should do differently:
-
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
-
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
-
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
- Add failing tests for issue #392: pdd change KeyError at Step 5 #433 - Handlers not wired up to runtime (similar "forgot to connect" issue)
- Add failing tests for #430: auto-fix fingerprint skip bug #432 - Data models without extraction logic (incomplete implementation)
For Contributors: Discovered when email sending feature crashed with missing BREVO_SENDER_EMAIL and BREVO_SENDER_NAME configuration, fixed in commit 34a651d5.