Skip to content

[IMP] Initialise structure#3

Open
karan-bosamiya-simform wants to merge 1 commit into
mainfrom
imp-init-structure
Open

[IMP] Initialise structure#3
karan-bosamiya-simform wants to merge 1 commit into
mainfrom
imp-init-structure

Conversation

@karan-bosamiya-simform

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 4, 2026 05:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Initial repository/backend scaffolding for ProjectOS, including FastAPI app wiring, core infrastructure helpers (DB/Redis/Chroma/config/security), OAuth-based auth endpoints, and “Phase 1 frozen” stub contracts for AI + RAG services, plus a detailed developer setup README.

Changes:

  • Added a comprehensive developer setup guide and baseline backend dependency set.
  • Introduced FastAPI app factory/router registration and core runtime utilities (config, DB engine, Redis, vector store, security helpers).
  • Added initial auth models/schemas and a GitHub OAuth login + refresh-token flow, alongside stubbed v1 API routers and frozen AI/RAG service contracts.

Reviewed changes

Copilot reviewed 27 out of 35 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
README.md Adds end-to-end local dev setup + env var guidance (needs alignment with actual security/config behavior).
backend/requirements.txt Establishes initial Python dependencies for FastAPI + async DB + auth + vector store.
backend/app/services/ai_service.py Defines “frozen” Phase 1 AI service contract (stubbed).
backend/app/services/rag_service.py Defines “frozen” Phase 1 RAG contract + types (stubbed).
backend/app/schemas/rag.py Adds shared Pydantic types for RAG contracts.
backend/app/schemas/auth.py Adds auth response/request schemas for API endpoints.
backend/app/models/user.py Adds User + RefreshToken ORM models for OAuth + refresh flow.
backend/app/main.py Creates FastAPI app, lifespan pings, CORS, and router registration.
backend/app/core/config.py Centralizes env-driven settings (currently mismatched with README and Phase 1 expectations).
backend/app/core/security.py Implements token encryption + JWT helpers (encryption implementation mismatched with documented AES-256-GCM).
backend/app/core/database.py Adds async SQLAlchemy engine/session factory.
backend/app/core/redis_client.py Adds async Redis client factory/ping.
backend/app/core/vector_store.py Adds Chroma persistent client + collection helper.
backend/app/core/deps.py Adds DB/user dependencies + auth header parsing.
backend/app/core/exceptions.py Adds domain exception hierarchy.
backend/app/api/v1/auth.py Implements GitHub OAuth login/callback + refresh flow (includes critical redirect encoding bug and refresh scaling concern).
backend/app/api/v1/health.py Adds /health endpoint.
backend/app/api/v1/{projects,requirements,stories,sprints,meetings,risks,knowledge,chat,webhooks}.py Adds Phase 1 router scaffolds (empty).
backend/app/ai/prompts.py Adds versioned prompt template skeleton.
backend/app/**/init.py Adds package markers for module structure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# All Claude calls go through AIService.call_claude() — never instantiate
# anthropic.Anthropic() directly. This keeps retry/backoff, cost logging,
# and prompt caching in one place (§8.1, NFR-OBS-2, NFR-SCALE-4).
ANTHROPIC_API_KEY: str
# Voyage AI: purpose-built code-embedding model (voyage-code-2).
# Used exclusively for code chunks — gives meaningfully better retrieval
# quality over general-purpose embedders for function/class-level search (§11.2).
VOYAGE_API_KEY: str
# ChromaDB runs embedded in the FastAPI process — zero ops, no separate service.
# This path is volume-mounted in Docker so vectors survive container restarts.
# Upgrade path to HttpClient mode (separate service) is a one-line config swap (ADR-4).
CHROMA_PERSIST_PATH: str = "/data/chromadb"
Comment on lines +88 to +94
# ── Observability ─────────────────────────────────────────────────────────
# LOG_FORMAT: "json" in production (structured for log aggregators),
# "text" locally for human-readable dev output.
# LOG_PROMPTS: set True locally to see full Claude prompts in logs.
# NEVER set True on the demo host — prompts may contain user data (NFR-SEC-6).
LOG_FORMAT: str = "json"
LOG_PROMPTS: bool = False
Comment on lines +59 to +62
# Fernet/AES-256-GCM key for encrypting PATs stored in integrations.encrypted_credentials.
# Must be exactly 32 URL-safe chars — generate with:
# python3 -c "import secrets; print(secrets.token_urlsafe(32)[:32])"
TOKEN_ENCRYPTION_KEY: str
Comment thread backend/app/core/deps.py
Comment on lines +6 to +8
from fastapi.security import OAuth2PasswordBearer
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
Comment thread backend/app/core/deps.py
from app.core.security import decode_access_token
from app.models.user import User

oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/v1/auth/github/callback", auto_error=False)
Comment thread README.md
Comment on lines +213 to +214
# TOKEN_ENCRYPTION_KEY — must be exactly 32 bytes for Fernet/AES-256
python3 -c "import secrets; print(secrets.token_urlsafe(32)[:32])"
Comment thread README.md
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=15
REFRESH_TOKEN_EXPIRE_DAYS=7
TOKEN_ENCRYPTION_KEY=<output of second command — exactly 32 chars>
Comment thread README.md
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=15
REFRESH_TOKEN_EXPIRE_DAYS=7
TOKEN_ENCRYPTION_KEY= # generate: python3 -c "import secrets; print(secrets.token_urlsafe(32)[:32])"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants