Skip to content

new changes #1

Open
DevJay067 wants to merge 3 commits into
prathamesh-6099:mainfrom
DevJay067:feature/production-updates
Open

new changes #1
DevJay067 wants to merge 3 commits into
prathamesh-6099:mainfrom
DevJay067:feature/production-updates

Conversation

@DevJay067

Copy link
Copy Markdown
Collaborator

Proposed Changes
Backend Fixes
[MODIFY]
config.py
Add import logging and create a module logger instead of bare print() statements
Add a LOCAL_DEV flag to detect dev mode
Add REPORTS_DIR for local PDF storage (uses project-local ./reports_out/ instead of /tmp/)
[MODIFY]
main.py
Replace print() with logging.info()
Fix CORS: add wildcard * pattern support for development (only wildcards don't work in allow_origins with allow_credentials=True)
Add a list_audits endpoint so the dashboard can fetch real data
Add structured logging config at startup
[MODIFY]
routers/audit.py
Critical: Fix _execute_audit — wrap in asyncio.run() or make the background task synchronous, or use asyncio.ensure_future() at the endpoint level
Add proper logging instead of print-based tracebacks
Add a GET /api/audit/list endpoint for the dashboard
[MODIFY]
routers/report.py
Fix the Windows path check (C: detection → use os.path.isabs)
Add logging
[MODIFY]
services/report_generator.py
Fix upload_pdf_to_gcs: use tempfile.gettempdir() or a project-local dir instead of hard-coded /tmp/
Make the local path cross-platform (Windows compatible)
[MODIFY]
services/probe_runner.py
Add logging for probe execution
Add error handling for individual probe failures (so one bad probe doesn't crash the entire audit)
Add timeout handling for target LLM calls
[MODIFY]
services/firebase_client.py
Add logging
Add error handling around Firestore operations
[MODIFY]
services/stats.py
Add logging
Handle edge cases (zero-length arrays, NaN values)
[NEW]
backend/.env
Create a .env file with placeholder values for local development (keys left blank for user to fill)
Frontend Fixes
[MODIFY]
app/audit/[id]/page.tsx
Critical: Fix stale closure in polling — use a useRef for status or refactor to proper polling with cleanup
Fix unsafe access status?.progress.total → status?.progress?.total
[MODIFY]
app/dashboard/page.tsx
Wire up to real API — add listAudits() call and replace placeholder data
[MODIFY]
lib/api.ts
Add a listAudits() function
Add error retry logic for transient failures
Add request abort controller for cleanup
[MODIFY]
next.config.ts
Fix: use ESM export default instead of module.exports
[MODIFY]
tailwind.config.ts
Fix: use ESM export default instead of module.exports
[NEW]
postcss.config.mjs
Create PostCSS config required by Tailwind CSS
[NEW]
frontend/.env.local
Create .env.local pointing to http://localhost:8000 for backend URL
Verification Plan
Automated Tests
Start backend: cd backend && python -m uvicorn main:app --reload --port 8000
Start frontend: cd frontend && npm install && npm run dev
Hit http://localhost:8000/health — expect {"status": "healthy"}
Hit http://localhost:3000 — expect landing page renders
Check browser console for errors on all pages
Manual Verification
Navigate to /dashboard, /audit/new, and confirm no runtime crashes
Check backend logs for structured output (no bare print calls)

- Update backend config.py with production settings

- Update requirements.txt dependencies

- Fix frontend tsconfig.json

- Add .gitignore to exclude __pycache__ and build artifacts

- Remove tracked __pycache__ and .tsbuildinfo files
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