ln-310-story-validator

Story Validator with Penalty Points - State Diagram

Overview

graph TD Start([Start: Validate Story]) --> Phase1 subgraph Phase1 [Phase 1: Discovery & Loading] P1A[Auto-discover config
Team ID from kanban_board.md] P1A --> P1B[Load Story metadata
ID, title, status, labels] P1B --> P1C[Load Tasks metadata
3-8 implementation tasks expected] end Phase1 --> Phase2 subgraph Phase2 [Phase 2: Research & Audit] P2A[Domain Extraction
Scan Story for patterns] P2A --> P2B{Patterns
detected?} P2B -->|Yes| P2C[Delegate to ln-002
Create guides/manuals/ADRs] P2B -->|No| P2D[MCP Ref fallback
Query standards directly] P2C --> P2E[Calculate Penalty Points
17 criteria evaluation] P2D --> P2E P2E --> P2F[Build Fix Plan
List violations + fixes] end Phase2 --> Phase3 subgraph Phase3 [Phase 3: Audit Results & Fix Plan] P3A[Display Penalty Points table
Criterion | Severity | Points] P3A --> P3B{Plan Mode
active?} P3B -->|Yes| P3C[WAIT for user approval
Show fix plan] P3B -->|No| P3D[Proceed immediately] P3C --> P3D end Phase3 --> Phase4 subgraph Phase4 [Phase 4: Auto-Fix 17 Criteria in 6 Groups] P4A[Group 1: Structural #1-#4
Story + Tasks structure] P4A --> P4B[Group 2: Standards #5
RFC/OWASP compliance FIRST] P4B --> P4C[Group 3: Solution #6
Library versions] P4C --> P4D[Group 4: Workflow #7-#13
Test Strategy, Docs, Size
YAGNI, KISS, Task Order] P4D --> P4E[Group 5: Quality #14-#15
Docs complete, No hardcoded] P4E --> P4F[Group 6: Traceability #16-#17
Story-Task align, AC coverage] P4F --> P4G[Penalty Points = 0] end Phase4 --> Phase5 subgraph Phase5 [Phase 5: Approve & Notify] P5A[Story + Tasks -> Todo
Update Linear status] P5A --> P5B[Update kanban_board.md
Add APPROVED marker] P5B --> P5C[Add Linear comment
Penalty table + fixes + docs] P5C --> P5D[Display summary table
Before -> 0 After] end Phase5 --> End([End: Story Approved
Penalty Points = 0]) classDef discovery fill:#E3F2FD,stroke:#1976D2,stroke-width:2px classDef research fill:#FFF3E0,stroke:#E65100,stroke-width:2px classDef decision fill:#FFF9C4,stroke:#F57C00,stroke-width:2px classDef fix fill:#E8F5E9,stroke:#388E3C,stroke-width:2px classDef approve fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px class P1A,P1B,P1C discovery class P2A,P2B,P2C,P2D,P2E,P2F research class P3A,P3B,P3C,P3D decision class P4A,P4B,P4C,P4D,P4E,P4F,P4G fix class P5A,P5B,P5C,P5D approve

Penalty Points System

Severity Points Description
CRITICAL 10 RFC/OWASP/Security violations
HIGH 5 Outdated libraries, architecture issues
MEDIUM 3 Best practices violations
LOW 1 Structural/cosmetic issues