Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches: ["**"]
pull_request:

jobs:
backend-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
cd backend
pip install -r requirements.txt
- name: Syntax check
run: |
python -m compileall backend/app

frontend-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
cd frontend
npm ci
- name: Lint
run: |
cd frontend
npm run lint
- name: Build
run: |
cd frontend
npm run build
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Node
node_modules/
.next/
out/

# Python
__pycache__/
*.pyc
.venv/

# Env
.env

# OS
.DS_Store
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Developer Trust & Code Reliability Platform

A full-stack platform for commit risk analysis, trust scoring, explainable AI, CI insights, and governance-oriented merge control.

## Monorepo Structure

```text
frontend/ # Next.js 14 dashboard UI
backend/ # FastAPI service with analytics endpoints
ai-engine/ # Risk scoring logic and model stubs
ci/ # CI/CD support assets
database/ # SQL schema
cloud/ # Cloud integration notes
docs/ # Architecture, roadmap, API catalog
.github/ # GitHub Actions workflows
```

## Advanced Features Implemented

- Predictive risk scoring before CI starts
- What-if commit simulation endpoint for pre-merge planning
- Explainable AI reason panel for risk changes
- Code ownership + blast radius endpoint and UI
- Trust-based merge gate evaluation + policy endpoints and UI
- Role-based dashboards (Developer, Manager, Admin)
- Research comparison endpoint (before vs after Trust Loop)
- Semester CSV report export endpoint
- CI time/cost optimization insights
- Simulated webhook ingestion endpoint for new commits

## Quick Start

### Backend

```bash
cd backend
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
```

### Frontend

```bash
cd frontend
npm install
npm run dev
```

Set `NEXT_PUBLIC_API_BASE_URL=http://localhost:8000` in `frontend/.env.local`.
8 changes: 8 additions & 0 deletions ai-engine/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# AI Engine

This module contains scoring logic prototypes and placeholders for model training.

## Planned Upgrades
- Train a calibrated failure predictor from commit + CI metadata.
- Add SHAP-based feature attributions for richer explainability.
- Export model as a service used by FastAPI.
18 changes: 18 additions & 0 deletions ai-engine/risk_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Standalone risk model stub for experimentation."""

from dataclasses import dataclass


@dataclass
class Features:
files_changed: int
modules_impacted: int
tests_touched: bool
historical_failure_rate: float


def predict_failure_probability(features: Features) -> float:
score = 0.02 * features.files_changed + 0.06 * features.modules_impacted
score += 0.21 if not features.tests_touched else 0.0
score += 0.35 * features.historical_failure_rate
return max(0.01, min(round(score, 3), 0.97))
Empty file added backend/app/__init__.py
Empty file.
44 changes: 44 additions & 0 deletions backend/app/data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from app.schemas import Commit

COMMITS: list[Commit] = [
Commit(
id="cmt-101",
author="Ayesha",
message="Refactor auth middleware and token parser",
files_changed=11,
modules_impacted=4,
tests_touched=False,
historical_failure_rate=0.42,
),
Commit(
id="cmt-102",
author="Rahul",
message="Fix flaky checkout flow assertions",
files_changed=3,
modules_impacted=1,
tests_touched=True,
historical_failure_rate=0.18,
),
Commit(
id="cmt-103",
author="Mei",
message="Add caching for analytics endpoint",
files_changed=7,
modules_impacted=3,
tests_touched=True,
historical_failure_rate=0.27,
),
]

DEPENDENCY_GRAPH = {
"auth": ["api-gateway", "session", "billing"],
"checkout": ["cart", "payments", "inventory", "pricing"],
"analytics": ["warehouse", "dashboard"],
}

RESEARCH_BASELINE = {
"avg_risk_before": 68.4,
"avg_risk_after": 44.2,
"trust_gain_percent": 23.1,
"deployment_failure_drop_percent": 31.6,
}
Loading
Loading