Friday, 1 May 2026

Autonomous QA — Architecture Diagram

⚡ Stage 6: Autonomous QA — Architecture

5-Layer Quality Gate Pipeline · Bedrock-Powered · Fully Autonomous

In my last two blogs we build the autonomus SDLC AI powered system , then we build the Auto-healing , and In this blow we will go through the desgin part of Autonomous QA — Architecture

STAGE 6 — AUTONOMOUS QA PIPELINE ๐Ÿ”” TRIGGER: PRCreatedEvent QaOrchestrationService listens → polls GitHub Pages LAYER 1 Structure Check JAVA ๐Ÿ“„ index.html exists ๐Ÿ”— No broken refs (JS/CSS/img) ๐Ÿ“ Valid file structure ๐Ÿ“ HTML5 valid ⚡ HTTP 200 OK Engine: StructureCheckService.java — Pure Java HttpClient + regex scanning — No AI — Deterministic rules PASS ✓ LAYER 2 Security Audit HYBRID ๐Ÿ”’ OWASP A01–A10 scan ๐Ÿ›ก️ XSS detection (inline JS) ๐Ÿ”‘ Credential exposure ๐Ÿšซ Open redirect ๐Ÿ“ฆ CSP headers Engine: SecurityAuditService.java — Static regex rules (fast) + Bedrock deep analysis (qa-security-review.txt) — OWASP Top 10 mapping ๐Ÿ›ก️ PASS ✓ LAYER 3 Functional E2E Tests BEDROCK ๐Ÿงช User flow simulation ๐Ÿ“‹ Form submit validation ๐Ÿ”€ Navigation paths ๐Ÿ” Auth flow check ⚠️ Error handling Engine: FunctionalTestService.java — Bedrock-simulated (qa-functional-test.txt) — AI reads HTML+JS, traces user journeys, reports failures ๐Ÿง  PASS ✓ LAYER 4 Accessibility Audit HYBRID ♿ WCAG 2.1 AA compliance ๐Ÿท️ ARIA labels & roles ๐ŸŽจ Contrast ratio ≥ 4.5:1 ⌨️ Keyboard nav ๐Ÿ“ฑ Responsive Engine: AccessibilityAuditService.java — Java rules (contrast calc, ARIA check) + Bedrock deep review (qa-accessibility-review.txt) ๐Ÿ‘️ PASS ✓ LAYER 5 Performance Audit BEDROCK ⚡ Asset size analysis ๐Ÿ–ผ️ Image optimization ๐Ÿ“ฆ Render-blocking resources ๐Ÿ’พ Caching headers ๐Ÿš€ Load strategy Engine: PerformanceAuditService.java — Bedrock-simulated (qa-performance-review.txt) — AI analyzes asset graph + render path ๐Ÿš€ ๐Ÿ“Š QA Report (HTML + JSON) QaReportBuilder → DB + /api/qa/{reqId} ๐Ÿ“ PR Description Updated GitHub API PATCH → QA badge + findings ๐Ÿ“ก SSE: QA_COMPLETE Real-time dashboard update via SSE SEQUENTIAL EXECUTION → Score P/F 0–10 0–10 0–10 0–10

๐Ÿ”” Trigger: PRCreatedEvent

The entire QA pipeline is event-driven. When CodeGenerationService creates a pull request on GitHub, Spring publishes a PRCreatedEvent. The QaOrchestrationService listens for this event via @EventListener and kicks off the QA pipeline asynchronously (@Async).

Activation Sequence

StepActionDetail
1Event receivedPRCreatedEvent(reqId, prUrl, pagesUrl) captured by listener
2Poll GitHub PagesHTTP GET to pagesUrl every 15s, up to 3 min timeout, waiting for HTTP 200
3Fetch all pagesHttpClient crawls all HTML/JS/CSS from the deployed Pages site
4Execute 5 layersSequential execution — each layer receives the fetched content + previous layer results
5Aggregate & reportQaReportBuilder compiles findings → DB save → PR update → SSE broadcast

Why Event-Driven?

  • Decoupled — Code generation doesn't wait for QA; QA runs independently
  • Non-blocking — User sees PR created immediately; QA results stream in via SSE
  • Retry-safe — If Pages isn't ready, polling handles the delay gracefully

Layer 1: Structure Check Pure Java

The fastest, cheapest gate. Pure deterministic Java rules — no AI, no network calls to Bedrock. Catches deployment-breaking issues in milliseconds.

What It Checks

CheckRuleSeverity on Fail
Entry point existsindex.html must exist at repo rootCRITICAL
Broken referencesEvery <script src>, <link href>, <img src> must resolve to existing fileCRITICAL
File structureAll HTML files reference-able from root; no orphaned pagesHIGH
HTML5 validity<!DOCTYPE html>, <html lang>, <meta charset> presentMEDIUM
HTTP 200GitHub Pages URL returns 200 statusCRITICAL

Engine Details

  • Service: StructureCheckService.java
  • Technique: Java HttpClient for live URL checks; regex-based HTML parsing for reference extraction
  • Scoring: Pass/Fail (binary) — any CRITICAL finding = layer fails, pipeline short-circuits with report
  • Performance: Completes in <2 seconds typically
  • Why first? If the site doesn't load or has broken refs, deeper analysis is pointless

Layer 2: Security Audit Hybrid

Two-pass security analysis modeled on OWASP Top 10. First pass: fast static regex rules catch known patterns. Second pass: Bedrock deep analysis for nuanced vulnerabilities that pattern matching misses.

Pass 1: Static Rules (Java)

RulePatternMaps to OWASP
Inline JavaScript detectiononclick=, javascript:, eval(A03: Injection / XSS
Credential exposurepassword in URL params, hardcoded tokens, localStorage for secretsA07: Auth Failures
Form action validationForms with method="GET" containing password fieldsA04: Insecure Design
Open redirectUnvalidated window.location assignments from URL paramsA01: Broken Access
Missing security headersNo CSP meta tag, no X-Frame-OptionsA05: Security Misconfig

Pass 2: Bedrock Deep Analysis

  • Prompt: qa-security-review.txt — sends full HTML+JS source to Bedrock
  • AI analyzes: Authentication flow logic, session management, data sanitization patterns, DOM manipulation safety, third-party script risks
  • Output: JSON array of findings with severity, owaspCategory, location, remediation

Scoring

  • Security Score: 0–10 scale (10 = no findings)
  • Each CRITICAL finding: −3 points. HIGH: −2. MEDIUM: −1. LOW: −0.5
  • Gate threshold: Advisory only (no blocking) — but CRITICAL findings highlighted in PR

Layer 3: Functional E2E Tests Bedrock AI

Since the generated apps are static GitHub Pages sites (HTML/CSS/JS only), traditional browser automation (Selenium/Playwright) is overkill. Instead, Bedrock AI reads the complete source code and mentally simulates user journeys — tracing event handlers, form submissions, navigation flows, and state management.

What Bedrock Simulates

JourneyWhat AI TracesExpected Behavior
Login flowForm submit handler → validation → redirect → session storageInvalid creds show error; valid creds redirect to home
NavigationAnchor hrefs, window.location, back/forward logicAll links navigate to existing pages; no dead ends
CRUD operationsDOM manipulation, localStorage read/write, event chainsAdd/edit/delete reflect in UI; data persists across page loads
Auth guardssessionStorage/localStorage checks on page loadUnauthenticated users redirected to login
Error handlingTry/catch blocks, error display elements, edge casesGraceful degradation; user-visible messages

Why Bedrock-Simulated vs. Real Browser?

  • No infrastructure: No Selenium grid, no headless Chrome, no Docker containers
  • Deeper analysis: AI understands intent, not just DOM state — catches logic errors a click-test would miss
  • Cost-effective: One Bedrock invocation covers dozens of simulated journeys
  • Trade-off: Cannot catch rendering bugs or CSS layout issues (Layer 4 partially covers this)

Scoring

  • Score: 0–10 (10 = all journeys pass)
  • AI returns structured JSON: { journey, steps[], result: "pass"|"fail", issue?, remediation? }

Layer 4: Accessibility Audit Hybrid

Ensures WCAG 2.1 Level AA compliance through a combination of deterministic Java checks (machine-verifiable criteria) and Bedrock analysis (human-judgment criteria that require understanding context).

Pass 1: Java Rules (Deterministic)

CheckImplementationWCAG Criterion
Image alt textRegex: every <img> must have non-empty alt1.1.1 Non-text Content
Form labelsEvery <input> has associated <label> or aria-label1.3.1 Info and Relationships
Color contrastParse CSS color/background-color; compute luminance ratio ≥ 4.5:11.4.3 Contrast (Minimum)
Heading hierarchyVerify h1h2h3 sequence; no skips1.3.1 Info and Relationships
Language attribute<html lang="..."> present3.1.1 Language of Page
Focus stylesCSS includes :focus rules; no outline: none without replacement2.4.7 Focus Visible

Pass 2: Bedrock Deep Review

  • Prompt: qa-accessibility-review.txt
  • AI evaluates: Semantic HTML usage, ARIA roles/states correctness, keyboard navigation completeness, screen reader experience, touch target sizing, cognitive load assessment
  • Key insight: Many WCAG criteria (e.g., "meaningful sequence", "consistent navigation") require human-level understanding that pure regex cannot provide

Scoring

  • Accessibility Score: 0–10 (weighted: Java checks 40%, Bedrock analysis 60%)
  • Maps each finding to specific WCAG Success Criterion with conformance level (A, AA, AAA)

Layer 5: Performance Audit Bedrock AI

Analyzes the asset graph and render path of the deployed site. Since these are static sites without server-side rendering, performance analysis focuses on client-side loading strategy, asset optimization, and perceived performance.

What Bedrock Analyzes

CategoryAnalysisCommon Findings
Asset sizeTotal page weight, individual file sizes, unminified detectionUnminified JS >50KB, oversized images
Render blocking<script> without defer/async, CSS in <head> load orderRender-blocking scripts in <head>
Image optimizationFormat analysis (PNG vs WebP), dimensions, lazy loadingMissing loading="lazy", no width/height
CachingAsset fingerprinting, cache-control headers, CDN usageNo cache busting on CSS/JS filenames
Critical render pathFirst paint blocking resources, inline critical CSS presenceAll CSS loaded before any content renders

Why Bedrock Instead of Lighthouse?

  • No headless Chrome needed: Lighthouse requires a browser runtime; Bedrock works from source alone
  • Context-aware: AI understands that a login page's performance profile differs from a dashboard
  • Actionable output: AI provides specific remediation steps, not just scores
  • Trade-off: Cannot measure actual FCP/LCP/CLS metrics — these require real rendering

Scoring

  • Performance Score: 0–10
  • Deductions: unminified assets (−2), render-blocking scripts (−1.5), no lazy loading (−1), missing cache strategy (−1)

๐Ÿ“Š Output: Report, PR Update & SSE Broadcast

After all 5 layers complete, QaReportBuilder aggregates findings into a unified report. Three outputs are generated simultaneously:

1. QA Report (Database + API)

  • DB entities: QaReport (one per run) + QaFinding (one per issue) stored via JPA
  • API endpoint: GET /api/qa/{reqId} returns JSON; GET /requirements/{reqId}/qa renders HTML view
  • Schema: Flyway V18__qa_tables.sqlqa_report (id, req_id, overall_score, security_score, accessibility_score, performance_score, functional_score, structure_pass, created_at) + qa_finding (id, report_id, layer, severity, category, description, location, remediation)

2. PR Description Patch

  • Mechanism: GitHub API PATCH /repos/{owner}/{repo}/pulls/{number}
  • Content: Appends QA badge (overall score with color), summary table of findings per layer, and critical findings with remediation steps
  • Advisory only: Does not block merge — provides visibility for human reviewer

3. SSE Broadcast

  • Event: QA_COMPLETE sent via PipelineStreamService
  • Payload: Overall score, per-layer scores, critical finding count
  • Dashboard: Real-time update on requirement detail page — QA section appears with expandable layer results

Composite Scoring

ComponentWeightRange
StructureGate (must pass)Pass / Fail
Security30%0–10
Functional30%0–10
Accessibility25%0–10
Performance15%0–10
Overall100%0–10

Thursday, 30 April 2026

Self-Healing Pipeline Architecture

In the last blog dicussed a Autonomus SDLC system , In this we make it autonomous in terms of error detection, classification, recovery, and KB-backed continuous improvement — zero human intervention from failure to resolution.

Solution for Self-Healing — 7 new files + V18 migration build on top of every existing component: PipelineLog checkpoints, WorkflowFailedEvent, KnowledgeBaseService RAG, KnowledgeFeedbackService S3 writes, BedrockClient fallback, KbMaintenanceAgent schedule pattern. No new infrastructure required.
L1 DETECT L2 CKPT L3 RECOVER L4 KB L5 LEARN LAYER 1 — Detection & Watchdog Pipeline Execution ProposalService · CodeGenerationService RepoAnalysisService · AgentLoopService Exception stepFailed() PipelineLog persisted (FAILED) SSE broadcast to all subscribers WorkflowFailedEvent requirementId · failedStep errorMessage · Spring ApplicationEvent PipelineHealthMonitor @Scheduled every 60s — scans FAILED reqs @Scheduled every 5min — scans HUNG reqs LAYER 2 — Checkpoint Ledger (V18 Migration) PipelineLog (Enhanced) step: String · stepOrder: int · status: enum + retry_count: int (V18 new) + recovery_session_id: varchar (V18 new) getLastCheckpoint(reqId) Finds last COMPLETED step order in PipelineLog e.g. story 3 done at order 113 → resume from order 114 (story 4) alreadyCompleted(reqId, stepKey) Checks PipelineLogRepository for COMPLETED status on step name Used in CodeGenerationService + ProposalService loops Prevents duplicate work: stories 1–3 skipped on resume, story 4 retried LAYER 3 — Recovery Engine: PipelineRecoveryService PipelineRecoveryService @EventListener(WorkflowFailedEvent) · @Async("jarvisTaskExecutor") retry guard: Set<String> recentlyAttempted + TTL (30 min) ErrorClassifier → RecoveryStrategy TRANSIENT_BEDROCK ThrottlingException · timeout · 503 → Exponential backoff (2s→4s→8s) + retry same step MALFORMED_AI_RESPONSE → Retry Bedrock with suffix "Respond ONLY with valid JSON" GIT_CONFLICT 422 · ref exists → Rename branch: {name}-retry-{N}, re-attempt push STALE_CLONE → Delete local dir + re-clone from remote JIRA_UNAVAILABLE → Skip JIRA calls, continue pipeline (non-critical) CONFIG_MISSING → Escalate to Teams · cannot auto-fix creds UNKNOWN → KB lookup first → if hit: apply past fix · else: retry once → escalate Max Retry Guard TRANSIENT: max 3 · MALFORMED: max 2 GIT: max 3 · UNKNOWN: max 1 After max: → PipelineRecoveryExhaustedEvent → Teams alert Checkpoint Resume 1. getLastCheckpoint(reqId) → stepOrder N 2. startDevelopment(reqId, resumeFromOrder=N) 3. CodeGenerationService story loop: if alreadyCompleted(reqId, "CODE_GEN_STORY_"+N) continue ← skip, no duplicate commit else → generate + commit (first time) 4. Pipeline continues naturally to PR creation New Event Records (v1.3) PipelineRecoveryRequestedEvent reqId · failedStep · errorMsg · attemptNumber PipelineRecoveredEvent reqId · recoveredStep · strategy · attemptsNeeded · durationMs PipelineRecoveryExhaustedEvent reqId · step · allStrategiesFailed → escalate All via Spring ApplicationEventPublisher — no new infra needed LAYER 4 — Knowledge Base Lookup (existing KnowledgeBaseService) resolveFromKB("pipeline failure step:"+step+" error:"+errorClass, reqId) Queries Bedrock KB · Retrieve API (k=20) · Metadata filter: type=pipeline-incident Score ≥ 0.80 → past fix found → apply documented strategy immediately (skip trial-and-error) KbIncidentMatch (value object) strategy: RecoveryStrategy · confidence: float backoffMs: int · maxRetries: int · notes: String (from incident.md frontmatter) KB lookup before retry LAYER 5 — Continuous Improvement: KbHealingFeedbackService Incident Document (S3 Upload) Path: s3://.../learnings/{reqId}/incidents/{ts}-{step}.md YAML frontmatter: type: pipeline-incident step · error-class · fix-strategy · attempts · duration Body: Error · Root Cause · Fix Applied · Prevention → KB sync → vector indexed → available for future RAG @EventListener Coverage WorkflowFailedEvent → write incident stub immediately PipelineRecoveredEvent → complete incident doc (fix worked) PipelineRecoveryExhaustedEvent → escalation doc (fix failed) All @Async("jarvisTaskExecutor") — non-blocking Guarded by isEnabled() — silent skip if KB/S3 not configured Continuous Improvement Loop 1st occurrence: default strategy (trial-and-error) 2nd occurrence: KB hit → apply pre-validated fix instantly Each cycle: incident doc → KnowledgeBaseService.startSync() KB continuously enriched with real production failure data → Recovery time decreases with every resolved incident ① Fail (0s) ② Detect (≤60s) ③ KB Lookup (1–2s) ④ Classify + Backoff (2–8s) ⑤ Resume from ckpt (0s overhead) ⑥ Recovery complete + KB written ⑦ Improved

Component Deep Dive

๐Ÿ” Layer 1 — PipelineHealthMonitor

Type: @Component with two @Scheduled jobs
Job 1 — Active Failures (every 60s): Queries all RequirementStatus.FAILED requirements updated in the last 2 hours that haven't been attempted in the last 30 minutes. Publishes PipelineRecoveryRequestedEvent.
Job 2 — Silent Hangs (every 5 min): Finds requirements in ANALYZING or IN_DEVELOPMENT with no PipelineLog update for more than 15 minutes. Synthesizes a WorkflowFailedEvent("TIMEOUT: no pipeline progress for 15m").
Guard: ConcurrentHashMap<String, Instant> recentlyAttempted — TTL 30 min prevents retry storms.

๐Ÿ“‹ Layer 2 — Checkpoint Ledger

V18 Migration adds: retry_count INT DEFAULT 0 and recovery_session_id VARCHAR(36) to pipeline_logs. Also adds recovery_attempt_count INT and last_recovery_at TIMESTAMP to requirements.
New repo method: findTopByRequirementIdAndStatusOrderByStepOrderDesc(reqId, COMPLETED) — returns last completed step.
Skip logic in loops: alreadyCompleted(reqId, "CODE_GEN_STORY_4") checks for a COMPLETED PipelineLog with that step name. On resume: stories 1–3 are skipped in microseconds, story 4 is retried from scratch.

⚙️ Layer 3 — PipelineRecoveryService

Entry point: @EventListener on WorkflowFailedEvent, @Async("jarvisTaskExecutor")
Flow: (1) Check retry guard → (2) Query KB for past fix → (3) ErrorClassifier.classify(step, errorMsg)RecoveryStrategy enum → (4) Apply strategy with backoff → (5) Validate success → (6) Publish PipelineRecoveredEvent or PipelineRecoveryExhaustedEvent
Max retries per strategy: TRANSIENT=3, MALFORMED=2, GIT_CONFLICT=3, STALE_CLONE=2, UNKNOWN=1
Reuses: BedrockClient.invokeWithFallback(), GitHubClient.createBranch(), existing clone/delete logic

๐Ÿง  Layer 4 — KB Lookup

Called before every recovery attempt: knowledgeBaseService.resolveFromKB("pipeline failure step:CODE_GEN_STORY error:TRANSIENT_BEDROCK", reqId)
Metadata filter: source-uri startsWith s3://.../learnings/.../incidents/
Threshold: confidence ≥ 0.80 → use documented strategy; < 0.80 → use default ErrorClassifier strategy
KbIncidentMatch parses frontmatter: fix-strategy, backoff-ms, max-retries → PipelineRecoveryService applies them directly
Zero new AWS resources — reuses existing KB ID, AOSS index, embeddings model

๐Ÿ“š Layer 5 — KbHealingFeedbackService

New class extending the existing S3 upload pattern from KnowledgeFeedbackService.
Listens to 3 events: WorkflowFailedEvent (stub), PipelineRecoveredEvent (complete), PipelineRecoveryExhaustedEvent (escalation).
Upload path: s3://.../learnings/{reqId}/incidents/{yyyyMMdd-HHmmss}-{step}.md
YAML frontmatter enables metadata filtering in KB: type: pipeline-incident, step, error-class, fix-strategy, resolved: true/false
After upload → knowledgeBaseService.startSync() → new incident indexed within ~30s

๐Ÿ—‚️ ErrorClassifier (standalone)

Pure utility class — no Spring dependencies, fully unit-testable.
classify(String step, String errorMessage) → RecoveryStrategy
Uses ordered regex/contains checks:
ThrottlingException|Rate exceeded|503 → TRANSIENT_BEDROCK
<|Unexpected character|parse error → MALFORMED_AI_RESPONSE
422|Reference already exists|already exists → GIT_CONFLICT
Remote mismatch|no commits|stale clone → STALE_CLONE
jira|401|403.*atlassian → JIRA_UNAVAILABLE
bucket|credentials|NoSuch.*Key → CONFIG_MISSING
fallthrough → UNKNOWN

Recovery Time Budget (TRANSIENT_BEDROCK Example)

0s   → CODE_GEN_STORY_4 throws ThrottlingException → stepFailed() persists PipelineLog
0s   → WorkflowFailedEvent published → KbHealingFeedbackService writes incident stub to S3
≤60s → PipelineHealthMonitor detects FAILED status → publishes PipelineRecoveryRequestedEvent
+1s  → PipelineRecoveryService.onRecovery() → KB lookup: "pipeline failure step:CODE_GEN_STORY error:TRANSIENT_BEDROCK"
+2s  → KB HIT (2nd+ occurrence): past incident found, confidence=0.87 → apply: 4s backoff, retry once
       OR KB MISS (1st occurrence): ErrorClassifier → TRANSIENT_BEDROCK → default 2s→4s→8s backoff
+4s  → getLastCheckpoint() → order 113 (story 3 done) → alreadyCompleted() checks stories 1–3 = skip
+5s  → Retry story 4 → Bedrock invoked → success
+8s  → Stories 5–8 continue normally → PR created → PipelineRecoveredEvent published
+9s  → KbHealingFeedbackService completes incident.md → knowledgeBaseService.startSync()
+40s → KB re-indexed → next ThrottlingException anywhere → instant KB-guided recovery

Design Principles

✓ Zero New Infrastructure

Reuses existing thread pool, KB, S3, SSE stream, PipelineLog. Flyway V18 is the only schema change. No Redis, no Kafka, no distributed lock manager needed.

✓ Idempotent Resume

alreadyCompleted() is the single guard. A story that succeeded before recovery will never be re-run, guaranteeing no duplicate commits or duplicate JIRA transitions.

✓ Self-Improving KB

Every incident enriches the KB. First failure is trial-and-error. Every subsequent identical failure is resolved instantly from the KB. Recovery time strictly decreases over time.

⚠️ Non-Blocking Side Effects

All KB writes, incident uploads, and sync triggers are @Async. A KB outage during recovery does NOT block the recovery itself — the pipeline resumes regardless.

⚠️ Guardrail: Max Retries

Strict per-strategy retry caps prevent runaway loops. After exhaustion: RequirementStatus.FAILED is set permanently, Teams alert sent, full incident logged. Human can restart manually.

๐Ÿ“ก Full Observability

Every recovery attempt creates a PipelineLog entry visible in the SSE pipeline viewer with step name RECOVERY_ATTEMPT_N. Users see healing happen in real time in the UI.

Tuesday, 28 April 2026

Autonomous SDLC Platform — AI-powered

Autonomous SDLC Platform Architecture

Tool Architecture

Autonomous SDLC Platform — AI-powered requirement analysis, solution proposal generation, intelligent code generation, and end-to-end delivery pipeline orchestration.

System Architecture Overview

Spring Boot monolith orchestrating AWS AI services, Git providers, and notification channels.

Browser (Thymeleaf + HTMX) Bootstrap 5 · Mermaid.js · SSE Spring Boot 3.3.5 · Java 21 Controllers (REST + MVC) RequirementController · AdminController 9 Services Proposal · CodeGen · RepoAnalysis 10 Application Events Async · ThreadPool(4/8) JPA + Flyway (V1–V13) 8 Entities · Spring Data Repositories JGit 6.10 + OkHttp 4.12 GitHub · Bitbucket · Clone · Push · PR SseEmitter Pipeline Streaming · Real-time status updates to browser H2 Database File: ./data/XXXXX Console: /h2-console ☁ AWS (eu-west-1) Amazon Bedrock Primary: nova-pro-v1:0 Fallback: nova-lite-v1:0 Temp: 0.2 · Max: 4096 tokens Bedrock Knowledge Base KB: XXXXXX (RAG) Titan Embeddings v2 DataSource: XXXXXX Amazon S3 XXXXX-repo-eu-XXXXXXX Prefix: repos/ 20 parallel upload threads OpenSearch Serverless Vector index for RAG KB backend store AWS STS + SSO Profile: PowerUserAccess-XXXXXXXXX GitHub · Bitbucket REST API · Clone · Push · PR Creation MS Teams Webhook notifications

☕ Runtime

Java 21 LTS on Spring Boot 3.3.5. Embedded Tomcat, Spring MVC, Spring Data JPA, Flyway migrations, async event bus.

java 21 spring boot 3.3.5

๐Ÿค– AI Engine

Amazon Bedrock with Nova Pro v1 (primary) and Nova Lite v1 (fallback). 5 prompt templates for analysis, options, cost estimation, code generation, and plan generation.

bedrock nova-pro

๐Ÿ“š RAG Pipeline

Bedrock Knowledge Base (XXXXXXX) backed by OpenSearch Serverless vector index. Titan Embeddings v2 for semantic code search.

RAG titan embeddings

๐Ÿ”€ Git Integration

JGit 6.10 for clone/commit/push. OkHttp 4.12 for GitHub & Bitbucket REST APIs. Auto PR creation with generated code.

jgit github bitbucket

๐Ÿ’พ Database

H2 in file mode (./data/XXXXX) with Flyway migrations V1–V13. 8 JPA entities. Web console at /h2-console.

h2 flyway

๐Ÿ–ฅ️ Frontend

Thymeleaf server-rendered templates. Bootstrap 5 UI, HTMX for dynamic updates, Mermaid.js for diagrams, Prism.js for syntax highlighting, SSE for live pipeline streaming.

thymeleaf htmx sse

Workflow Pipeline 18 States

End-to-end lifecycle from requirement submission to deployed code with Pull Request.

SUBMITTED ANALYZING_REQUIREMENT Bedrock: requirement-analysis.txt ANALYSIS_COMPLETE GENERATING_OPTIONS Bedrock: option-generation.txt OPTIONS_READY OPTION_SELECTED User picks 1 of 3 options ESTIMATING_COST Bedrock: cost-estimation.txt ⏳ PENDING_APPROVAL Admin review required ✓ APPROVED PLAN_GENERATION Bedrock: plan-generation.txt CLONING_REPO JGit clone + S3 upload INGESTING_TO_KB S3 → Knowledge Base sync ๐Ÿง  GENERATING_CODE Bedrock + RAG → Code CODE_GENERATED CREATING_PR Push branch + open PR ✅ COMPLETED PR ready for review Error & Terminal States REJECTED ANALYSIS_FAILED GENERATION_FAILED CODE_GEN_FAILED PR_FAILED CANCELLED

Status Transition Table

FromToTriggerService
SUBMITTEDANALYZING_REQUIREMENTAuto (on submit)RequirementService
ANALYZING_REQUIREMENTANALYSIS_COMPLETEBedrock response parsedProposalService
ANALYSIS_COMPLETEGENERATING_OPTIONSAuto (event-driven)ProposalService
GENERATING_OPTIONSOPTIONS_READY3 options storedProposalService
OPTIONS_READYOPTION_SELECTEDUser selects optionRequirementController
OPTION_SELECTEDESTIMATING_COSTAuto (event-driven)CostEstimationService
ESTIMATING_COSTPENDING_APPROVALCost estimate savedCostEstimationService
PENDING_APPROVALAPPROVEDAdmin approvalApprovalService
PENDING_APPROVALREJECTEDAdmin rejectionApprovalService
APPROVEDPLAN_GENERATIONAuto or manual triggerCodeGenerationService
PLAN_GENERATIONCLONING_REPOPlan generatedCodeGenerationService
CLONING_REPOINGESTING_TO_KBRepo cloned + S3 uploadedGitService + S3
INGESTING_TO_KBGENERATING_CODEKB ingestion completeKnowledgeBaseService
GENERATING_CODECODE_GENERATEDAll files generatedCodeGenerationService
CODE_GENERATEDCREATING_PRAutoGitService
CREATING_PRCOMPLETEDPR created successfullyGitService

Data Model 8 Entities

JPA entities with Flyway-managed schema (V1–V13). H2 file-mode database.

Requirement id : Long (PK) title : String description : String(5000) status : RequirementStatus (enum) priority : String repositoryUrl : String branch : String selectedOptionId : Long solutionType : String analysisResult : String(10000) createdAt / updatedAt : LocalDateTime submittedBy / platform : String pullRequestUrl : String SolutionOption id : Long (PK) requirement_id : Long (FK) optionNumber / name : Int / String description : String(5000) pros / cons : String(3000) estimatedEffort / complexity : String solutionType : String architectureDiagramMermaid : String(10000) dataFlowDiagramMermaid : String(10000) codeSnippetsJson / codeChangesJson : String(20000) 1:N CostEstimate id : Long (PK) requirement_id : Long (FK) estimatedHours : Double estimatedCost : Double breakdown : String(5000) assumptions : String(3000) confidence : String createdAt : LocalDateTime 1:1 ApprovalRecord id : Long (PK) requirement_id : Long (FK) approvedBy : String decision : String (APPROVED|REJECTED) comments : String(3000) approvedAt : LocalDateTime estimatedCost : String GeneratedCode id : Long (PK) requirement_id : Long (FK) filePath : String content : String(100000) language : String status : String generatedAt : LocalDateTime AuditLog id : Long (PK) requirementId : Long action : String details : String(5000) performedBy : String timestamp : LocalDateTime Notification id, requirementId, type, channel, message recipientUrl, sentAt, status ImplementationPlan id, requirementId, planContent(50000) generatedAt, status

Event-Driven Architecture 10 Events

Spring ApplicationEvents with @Async processing on ThreadPoolTaskExecutor (core=4, max=8).

Spring Event Bus Publishers RequirementService ProposalService CostEstimationService ApprovalService CodeGenerationService GitService Subscribers ProposalService CostEstimationService ApprovalService (auto) CodeGenerationService NotificationService AuditService All 10 Events RequirementSubmittedEvent AnalysisCompletedEvent OptionsGeneratedEvent OptionSelectedEvent CostEstimationDoneEvent ApprovalDecisionEvent PlanGeneratedEvent CodeGenerationDoneEvent PullRequestCreatedEvent RepoClonedEvent

AWS Services eu-west-1

All AWS services used, their configuration IDs, and how they connect.

๐Ÿง  Amazon Bedrock

Primary: eu.amazon.nova-pro-v1:0
Fallback: eu.amazon.nova-lite-v1:0
Config: temp=0.2, maxTokens=4096, topP=0.9
Used by: RequirementAnalysis, OptionGeneration, CostEstimation, PlanGeneration, CodeGeneration

5 prompt templates

๐Ÿ“š Bedrock Knowledge Base

KB ID: XXXXXXX
DataSource: XXXXXXX
Embeddings: Titan Embeddings v2
Backend: OpenSearch Serverless vector index
RAG: All 6 prompt templates enriched with KB context
Filtering: Metadata-scoped retrieval per requirement

rag vector search cross-req learning

๐Ÿ“ฆ Amazon S3

Bucket: XXXX-repo-eu-XXXXXXXXX
Prefix: repos/
Upload: 20 parallel threads
Purpose: Cloned repo storage → KB data source sync

parallel upload

๐Ÿ” AWS STS + SSO

Profile: PowerUserAccess-XXXXXXXXXXX
Region: eu-west-1
Auth chain: SSO → STS AssumeRole → Temporary credentials

iam

Prompt Templates

FileUsed ByPurpose
requirement-analysis.txtProposalServiceAnalyze requirement with RAG context, classify solution type, extract key entities
option-generation.txtProposalServiceGenerate 3 options with Mermaid diagrams, code snippets, RAG-enriched context
code-generation.txtCodeGenerationServiceGenerate code files using RAG-retrieved codebase patterns and conventions
self-review.txtCodeGenerationServiceAI code review with RAG context for consistency validation
mvp-breakdown.txtMvpBreakdownServiceGenerate MVP tree with RAG-informed story points and task granularity
test-generation.txtCodeGenerationServiceGenerate tests matching existing test patterns via RAG retrieval

Knowledge Base & RAG 8 Features

Retrieval-Augmented Generation — enriching every AI prompt with real codebase context from AWS Bedrock Knowledge Base.

Knowledge Base — RAG Data Flow DATA INGESTION ๐Ÿ”— Git Repository clone ๐Ÿ“ Local Clone upload ๐Ÿ“ฆ S3 Bucket repos/ + learnings/ ingest ๐Ÿง  Bedrock Knowledge Base Titan Embeddings v2 · OpenSearch k-NN ๐Ÿ“„ RAG Chunks RAG-ENRICHED PROMPTS (6 TEMPLATES) ๐Ÿ” Requirement Analysis ProposalService R ๐Ÿ’ก Option Generation ProposalService R ⚡ Code Generation CodeGenerationService R ๐Ÿ”Ž Self Review CodeGenerationService R ๐Ÿ“‹ MVP Breakdown MvpBreakdownService R ๐Ÿงช Test Generation CodeGenerationService R R = RAG Context Injected CROSS-REQUIREMENT LEARNING LOOP Completed Requirement PRCreatedEvent triggers ๐Ÿ”„ KnowledgeFeedbackService Build Markdown summary → upload to S3 ๐Ÿ“ฆ S3: learnings/ outcome.md per requirement re-sync METADATA FILTERING & ADMINISTRATION ๐ŸŽฏ Metadata Filtering x-amz-bedrock-kb-XXXXXXXX → scope per REQ-ID ๐Ÿ“Š KB Admin Dashboard /kb-admin · sync trigger · test retrieval · status ๐Ÿ”Œ KB REST API GET /api/kb/status · POST /api/kb/sync · GET /api/kb/retrieve

All 8 KB Enhancements — Detailed Breakdown

RAG Enabled by Default

Config: XXX.rag.enabled flipped from falsetrue

The entire RAG pipeline — S3 upload → KB ingestion → vector retrieval → prompt injection — was already implemented but gated behind a disabled feature flag. Enabling it activates the full pipeline: every new requirement now has its cloned repository uploaded to S3, synced to KB, and used for vector-searched code retrieval during AI analysis.

File: application.ymlXXXX.rag.enabled: ${XXXX_RAG_ENABLED:true}

configuration

RAG in Code Generation

The code-generation.txt prompt now includes a {{RAG_CONTEXT}} section. Before generating code, the system retrieves existing code patterns, import styles, error handling conventions, and file structures from the KB. This ensures generated code follows the project's existing conventions rather than generic best practices.

Flow: KB retrieve → inject as "Relevant Code from Knowledge Base" → Bedrock generates consistent code

Files: code-generation.txt, BedrockPromptBuilder.buildCodeGenerationPrompt(), CodeGenerationService

code gen prompt enrichment

RAG in MVP Breakdown

The mvp-breakdown.txt prompt is now enriched with retrieved code from the KB. When generating the MVP tree (user stories → tasks → subtasks), the AI can see the actual codebase complexity, which results in more accurate story point estimates, better task-to-file mapping, and correct identification of affected files.

Flow: KnowledgeBaseService.retrieveAsContext() → inject into mvp-breakdown prompt → more accurate planning

Files: mvp-breakdown.txt, BedrockPromptBuilder.buildMvpBreakdownPrompt(), MvpBreakdownService

planning story points

RAG in Test Generation

The test-generation.txt prompt now receives codebase context via RAG. The AI retrieves existing test files to learn the project's test framework choice (JUnit 5, Mockito, etc.), naming conventions (shouldDoX_whenY), assertion styles, and mock patterns. Generated tests then match the project's existing test suite.

Flow: Retrieve existing test files via KB → inject test patterns → Bedrock generates consistent tests

Files: test-generation.txt, BedrockPromptBuilder.buildTestGenerationPrompt()

testing consistency

RAG in Self-Review

The self-review.txt prompt is enriched with real codebase patterns retrieved from the KB. When the AI reviews its own generated code, it can now compare against the actual project's patterns — catching inconsistencies like different error handling approaches, wrong import styles, or missing patterns that other files in the project use.

Flow: Retrieve codebase patterns → compare against generated code → catch deviations and security issues

Files: self-review.txt, BedrockPromptBuilder.buildSelfReviewPrompt()

quality gate pattern matching

RAG Wired into All Services

Every service that calls Bedrock now has KnowledgeBaseService injected as a dependency. Before each AI invocation, the service calls knowledgeBaseService.retrieveAsContext(query, reqId) to fetch relevant code chunks, which are then passed to the prompt builder's ragContext parameter.

ServiceKB Method CalledWhen
ProposalServiceretrieveAsContext()Each analysis + option generation round
MvpBreakdownServiceretrieveAsContext()Before MVP tree generation
CodeGenerationServiceretrieveAsContext()Before code generation (Phase 2)
dependency injection service layer

Cross-Requirement Learning

When a requirement reaches the PR_CREATED stage (pipeline completion), the new KnowledgeFeedbackService automatically captures the entire decision trail — requirement description, selected solution option, approach, risk assessment, affected files, and MVP breakdown — as a structured Markdown document and uploads it to S3 under the learnings/ prefix.

After upload, it triggers a KB re-sync job so the learning gets indexed. On future requirements, the KB can now retrieve past decisions: "For a similar feature last month, the team chose approach X with Y story points and Z files were affected."

PR Created PRCreatedEvent Build Summary option + approach + MVPs S3 Upload learnings/REQ-X/ ๐Ÿง  KB Re-Sync indexed for future RAG

File: KnowledgeFeedbackService.java — listens for PRCreatedEvent, uploads to S3, triggers KB sync

feedback loop continuous learning

KB Admin Dashboard

A new admin page at /kb-admin provides full visibility into the Knowledge Base health. The dashboard includes three status cards (KB connection, S3 storage, cross-requirement learning), a RAG integration map showing all 6 enriched prompts, manual sync trigger, and a live RAG query tester that lets admins search the KB and inspect retrieved chunks with relevance scores.

ComponentEndpointPurpose
Dashboard PageGET /kb-adminStatus cards + RAG map + sync controls + query tester
Status APIGET /api/kb/statusJSON: { enabled, feedbackEnabled }
Manual SyncPOST /api/kb/syncTrigger KB data source ingestion job
Test RetrievalGET /api/kb/retrieve?query=...Test RAG query, returns chunks with scores
Upload FeedbackPOST /api/kb/feedback/{reqId}Manually trigger learning upload for a requirement

Files: KbAdminWebController.java, KbApiController.java, kb-admin.html

admin ui diagnostics

Metadata Filtering in Retrieval

KB retrieval now scopes vector search to the specific requirement's S3 prefix using the x-amz-bedrock-kb-source-uri metadata field. When analyzing requirement REQ-ABC123, only code chunks from that requirement's repository are returned — preventing cross-contamination when multiple repositories are indexed in the same KB.

Filter: startsWith("s3://bucket/repos/REQ-ABC123/") — falls back gracefully to unfiltered if not supported.

File: KnowledgeBaseService.retrieve()

vector search scoped retrieval

RAG Integration Summary

Prompt TemplateServiceRAG StatusWhat RAG Provides
requirement-analysis.txtProposalService● ActiveRelevant code to assess requirement against codebase
option-generation.txtProposalService● ActiveCode patterns for accurate solution proposal generation
code-generation.txtCodeGenerationService● ActiveExisting conventions for consistent code output
self-review.txtCodeGenerationService● ActiveProject patterns to catch inconsistencies in generated code
mvp-breakdown.txtMvpBreakdownService● ActiveCode complexity context for accurate story points
test-generation.txtCodeGenerationService● ActiveExisting test patterns for framework-consistent tests

Service Layer 9 Services

Internal services with their responsibilities and key methods.

ServiceResponsibilityKey MethodsPublishes
RequirementService CRUD for requirements, submission trigger submitRequirement(), getAll(), getById() RequirementSubmittedEvent
ProposalService Bedrock analysis + option generation, JSON parsing analyzeRequirement(), generateOptions(), parseAndStoreOptions() AnalysisCompletedEvent, OptionsGeneratedEvent
CostEstimationService AI cost/effort estimation per selected option estimateCost() CostEstimationDoneEvent
ApprovalService Admin approve/reject workflow approve(), reject() ApprovalDecisionEvent
CodeGenerationService Full pipeline: plan → clone → ingest → generate → PR generatePlan(), triggerFullPipeline(), generateCode() PlanGeneratedEvent, CodeGenerationDoneEvent
GitService JGit clone/push, GitHub/Bitbucket REST API, PR creation cloneRepo(), pushBranch(), createPullRequest() RepoClonedEvent, PullRequestCreatedEvent
RepoAnalysisService S3 upload of cloned repos, KB data source ingestion uploadToS3(), triggerIngestion(), waitForIngestion()
NotificationService MS Teams webhook notifications on status changes sendNotification(), formatTeamsCard()
AuditService Immutable audit trail for all requirement actions logAction(), getAuditTrail()

API Endpoints REST + MVC

All HTTP endpoints exposed by the application.

RequirementController

MethodPathDescription
GET/Dashboard — lists all requirements
GET/requirements/newNew requirement form
POST/requirementsSubmit new requirement
GET/requirements/{id}Requirement detail page
GET/requirements/{id}/compareCompare 3 solution options side-by-side
POST/requirements/{id}/select-optionSelect preferred option
GET/requirements/{id}/pipeline-statusSSE stream — real-time pipeline updates
GET/requirements/{id}/generated-codeView generated code files

AdminController

MethodPathDescription
GET/admin/pendingList pending approval requests
POST/admin/{id}/approveApprove requirement (triggers code pipeline)
POST/admin/{id}/rejectReject requirement with reason

API REST Endpoints

MethodPathDescription
POST/api/requirementsJSON API — submit requirement programmatically
GET/api/requirements/{id}/statusJSON API — get current status
POST/api/requirements/{id}/generate-planTrigger plan generation
POST/api/requirements/{id}/generate-codeTrigger code generation pipeline

Frontend Stack Server-Rendered

Thymeleaf templates with progressive enhancement via HTMX and SSE.

๐Ÿ“„ layout.html

Master layout with Bootstrap 5.3, Mermaid.js v10, Prism.js v1.29 (8 languages + line-numbers), dark mode support.

thymeleaf layout

๐Ÿ“‹ list.html

Dashboard view — requirement cards with status badges, priority indicators, quick actions.

dashboard

➕ form.html

New requirement submission form with repo URL, branch, priority, description fields.

submission

๐Ÿ” detail.html

Requirement detail with status stepper, analysis results, admin approve/reject buttons, audit trail, Mermaid diagrams.

detail view

⚖️ compare.html

Side-by-side comparison of 3 AI options. Solution type badge, architecture/data-flow diagrams, expandable code snippets with syntax highlighting, diff view for code changes.

option comparison

๐Ÿ”„ pipeline.html

Real-time SSE pipeline viewer. Step-by-step progress with animated indicators for each pipeline stage.

sse streaming

๐Ÿ’ป generated-code.html

Generated code file viewer with syntax highlighting and copy-to-clipboard.

code viewer

✅ admin-pending.html

Admin approval queue — pending requirements with cost estimates, approve/reject actions.

admin panel

JavaScript Libraries

LibraryVersionPurpose
Bootstrap5.3.xUI framework, responsive grid, components
HTMX1.9.xPartial page updates, AJAX replacement without JS
Mermaid.js10.xArchitecture & data flow diagram rendering
Prism.js1.29Syntax highlighting (Java, JS, TS, Python, YAML, Bash, JSON, XML)
EventSource (SSE)NativeReal-time pipeline status streaming

Technology Stack Full Inventory

Backend

TechnologyVersionPurpose
Java21 LTSRuntime platform
Spring Boot3.3.5Application framework
Spring Data JPA3.3.xDatabase access layer
Flyway10.xDatabase migration (V1–V13)
H22.xEmbedded database (file mode)
JGit6.10Git operations (clone, commit, push)
OkHttp4.12HTTP client for GitHub/Bitbucket APIs
AWS SDK v22.xBedrock, S3, STS, KB client
Jackson2.xJSON serialization/deserialization
Thymeleaf3.xServer-side HTML template engine
Maven3.xBuild & dependency management

Flyway Migration History

VersionDescription
V1Create requirements table
V2Create solution_options table
V3Create cost_estimates table
V4Create approval_records table
V5Create generated_code table
V6Create audit_log table
V7Create notifications table
V8Add analysis fields to requirements
V9Add pull_request_url to requirements
V10Add platform/submittedBy to requirements
V11Create implementation_plans table
V12Add solution_type to requirements
V13Add diagrams & code changes to solution_options
V14Create mvp_milestones, user_stories, story_tasks tables

Project Structure

src/main/java/com/XXXX/
├── Application.java          # Main entry point
├── config/
│   ├── AsyncConfig.java             # ThreadPoolTaskExecutor (core=4, max=8)
│   ├── AwsConfig.java               # Bedrock, S3, STS clients
│   └── WebConfig.java               # CORS, static resources
├── controller/
│   ├── RequirementController.java   # MVC + REST endpoints
│   └── AdminController.java         # Admin approval endpoints
├── model/
│   ├── Requirement.java             # Core entity (18 statuses)
│   ├── RequirementStatus.java       # Enum: 18 states
│   ├── SolutionOption.java          # AI-generated options with diagrams
│   ├── CostEstimate.java            # Cost/effort estimation
│   ├── ApprovalRecord.java          # Approval decisions
│   ├── GeneratedCode.java           # Generated code files
│   ├── AuditLog.java                # Audit trail entries
│   ├── ImplementationPlan.java      # Detailed plan content
│   └── Notification.java            # Notification records
├── repository/                       # Spring Data JPA repositories
├── service/
│   ├── RequirementService.java
│   ├── ProposalService.java
│   ├── CostEstimationService.java
│   ├── ApprovalService.java
│   ├── CodeGenerationService.java
│   ├── GitService.java
│   ├── RepoAnalysisService.java
│   ├── NotificationService.java
│   └── AuditService.java
└── event/                            # 10 ApplicationEvent classes

src/main/resources/
├── application.yml                   # All configuration
├── db/migration/                     # V1–V13 Flyway SQL
├── prompts/                          # 5 Bedrock prompt templates
├── static/                           # CSS, JS assets
└── templates/                        # Thymeleaf HTML templates
    ├── layout.html
    └── requirements/
        ├── list.html, form.html
        ├── detail.html, compare.html
        ├── pipeline.html
        ├── generated-code.html
        └── admin-pending.html

XXXXXX Autonomous SDLC Platform — Architecture Documentation

Generated April 2026 · Java 21 · Spring Boot 3.3.5 · AWS Bedrock