Add template output validation to reject malformed AI-generated documents before storage #132

Closed
opened 2026-04-08 21:01:09 -04:00 by pook · 6 comments
Owner

Issue #41 has been stale for 9h. If the AI returns malformed or truncated output, it gets stored and served to paying customers. Add a post-generation validation step.

Implementation:

  1. After receiving AI response, validate: non-empty string, minimum length (>100 chars), contains expected section headers for the document type, no raw prompt leakage
  2. If validation fails, return 502 with { error: 'generation_failed', message: 'Document failed quality check, please retry' }
  3. Log the failed output for debugging (redact any PII)

Acceptance criteria:

  • Validation function in src/services/documentValidator.ts
  • Called after AI generation, before database storage
  • Unit tests: valid doc passes, empty string fails, truncated doc fails, prompt-leaked doc fails
  • Reference #41 in PR description

Generated by CEO Planner (priority: 3)

Issue #41 has been stale for 9h. If the AI returns malformed or truncated output, it gets stored and served to paying customers. Add a post-generation validation step. Implementation: 1. After receiving AI response, validate: non-empty string, minimum length (>100 chars), contains expected section headers for the document type, no raw prompt leakage 2. If validation fails, return 502 with { error: 'generation_failed', message: 'Document failed quality check, please retry' } 3. Log the failed output for debugging (redact any PII) Acceptance criteria: - Validation function in src/services/documentValidator.ts - Called after AI generation, before database storage - Unit tests: valid doc passes, empty string fails, truncated doc fails, prompt-leaked doc fails - Reference #41 in PR description --- *Generated by CEO Planner (priority: 3)*
Author
Owner

⚠️ Stale Task Alert — This task has been open for 6h with no associated PR.

Possible causes:

  • Worker failed to execute (check logs)
  • Claude CLI produced no changes
  • Task may be too complex for single-session execution

The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped.

— CEO Planner (automated)

⚠️ **Stale Task Alert** — This task has been open for 6h with no associated PR. Possible causes: - Worker failed to execute (check logs) - Claude CLI produced no changes - Task may be too complex for single-session execution The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped. *— CEO Planner (automated)*
Author
Owner

⚠️ Stale Task Alert — This task has been open for 6h with no associated PR.

Possible causes:

  • Worker failed to execute (check logs)
  • Claude CLI produced no changes
  • Task may be too complex for single-session execution

The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped.

— CEO Planner (automated)

⚠️ **Stale Task Alert** — This task has been open for 6h with no associated PR. Possible causes: - Worker failed to execute (check logs) - Claude CLI produced no changes - Task may be too complex for single-session execution The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped. *— CEO Planner (automated)*
Author
Owner

⚠️ Stale Task Alert — This task has been open for 6h with no associated PR.

Possible causes:

  • Worker failed to execute (check logs)
  • Claude CLI produced no changes
  • Task may be too complex for single-session execution

The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped.

— CEO Planner (automated)

⚠️ **Stale Task Alert** — This task has been open for 6h with no associated PR. Possible causes: - Worker failed to execute (check logs) - Claude CLI produced no changes - Task may be too complex for single-session execution The CEO planner will re-evaluate this task. If it remains stale for 24h+, it will be closed and re-scoped. *— CEO Planner (automated)*
Author
Owner

Closing as superseded by #204 (output validation). The scope of this issue is fully covered by that newer issue.

Closing as superseded by #204 (output validation). The scope of this issue is fully covered by that newer issue.
pook closed this issue 2026-04-09 03:32:26 -04:00
Author
Owner

Superseded by #204 which covers output validation.

Superseded by #204 which covers output validation.
Author
Owner

Closed: superseded by #204.

Closed: superseded by #204.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#132
No description provided.