[IMP] Initialise structure#3
Open
karan-bosamiya-simform wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
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 on lines
+6
to
+8
| from fastapi.security import OAuth2PasswordBearer | ||
| from sqlalchemy import select | ||
| from sqlalchemy.ext.asyncio import AsyncSession |
| 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 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])" |
| JWT_ALGORITHM=HS256 | ||
| ACCESS_TOKEN_EXPIRE_MINUTES=15 | ||
| REFRESH_TOKEN_EXPIRE_DAYS=7 | ||
| TOKEN_ENCRYPTION_KEY=<output of second command — exactly 32 chars> |
| 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])" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.