Skip to content

Add PRD JSON validation to catch syntax errors early#9

Open
brooksy4503 wants to merge 2 commits intoiannuttall:mainfrom
brooksy4503:main
Open

Add PRD JSON validation to catch syntax errors early#9
brooksy4503 wants to merge 2 commits intoiannuttall:mainfrom
brooksy4503:main

Conversation

@brooksy4503
Copy link
Copy Markdown
Contributor

Summary

  • Validates PRD JSON immediately after agent generation
  • Exits with clear error message if JSON is invalid
  • Prevents silent failures during build phase
  • Catches common LLM syntax errors like mismatched brackets

Problem

When LLMs generate PRD JSON files, they occasionally make syntax errors (e.g., using } instead of ] for array closure). This causes a cryptic error message during the build phase: "Could not parse stories from PRD", making it hard to debug.

Solution

Added JSON validation in loop.sh immediately after the agent generates the PRD. If invalid JSON is detected:

  1. Shows the exact JSON parsing error with line/column number
  2. Exits with a clear "ERROR: PRD JSON is invalid" message
  3. Prevents proceeding to build phase with bad data

Testing

  • Verified validation catches the original PRD syntax error (line 68: } instead of ])
  • Valid PRD files pass with success message
  • Invalid PRD files show detailed error output

- Validate PRD JSON after agent generation in loop.sh
- Exit with clear error message if JSON is invalid
- Prevents silent failures during build phase
- Catches common LLM syntax errors like mismatched brackets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant