Architecture: How to validate generated platform output before it reaches ...
Documentation for Sessions
ποΈ Architecture: How to validate generated platform output before it reaches ...
Date: 2026-02-28
Time: 21:38:43 UTC
Session: gspace1-156.2
Agent: backend
Confidence: 92%
Status: β
Documented
π Decision Context
Question:
How to validate generated platform output before it reaches users?
Task: Not specified
π― Decision Made
Chosen:
BlueprintValidatorService + ConvergenceLoopService in backend-ai-api. Validator checks all 25 widget types, page structure, config completeness, placeholder text. Loop iterates validateβrepair up to 15 times with stall detection (4 consecutive no-progress), using MCPBridgeService to call Claude for repairs.
Options Considered:
- No alternatives documented
π Reasoning
ROOT CAUSE: Generated output had ZERO validation. Widgets could have empty configs, pages could be missing required fields, placeholder text like 'TODO' could pass through to users. gmodules1 solved this with a convergence loop (1,831 lines) that catches 90%+ of issues. We ported the pattern but adapted it for our widget-based architecture instead of their code-based one. The validator checks type-specific configs (heading needs text, table needs columns+data, button needs text). The loop tracks persistent errors (3+ iterations β try different strategy) and regressions (new errors β revert). Exit conditions prevent infinite loops. Repair function wired to MCPBridgeService.executeTask() which calls Claude Code CLI with the system-integrate-repair.prompt.md template.
π Files Involved
APIs/backend-ai-api/src/app/workflow/phase-executor/blueprint-validator.service.tsAPIs/backend-ai-api/src/app/workflow/phase-executor/convergence-loop.service.tsAPIs/backend-ai-api/src/app/workflow/phase-executor/phase-executor.service.ts
π Related
- Decision ID:
dev_1772314723638_a0v77py - Session: 156
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation