## Summary
- **Fix CI build failure**: Auth0Client crashes during Next.js
prerendering when env vars aren't set. Returns a no-op stub (`getSession
→ null`) when domain is missing — semantically correct for static
generation
- **Lazy-load markdown libs (~260kb)**: ReactMarkdown, remarkGfm, and
react-syntax-highlighter were eagerly imported in monaco-diff-viewer but
only rendered when user expands "Generated Tests". Extracted into a
dynamic component
- **Parallelize repo detail query**: `getRepositoryById` ran the
activity count sequentially after the repo lookup. Since `repoId` is
already available, all three queries now run in parallel
## Test plan
- [ ] CI `build` check passes (was failing since #2598)
- [ ] Trace page still renders generated tests correctly when expanded
- [ ] Repository detail page loads correctly with activity status
## Summary
Adds a line-by-line performance profiler visualization to the webapp,
allowing users to compare execution times between original and optimized
code.
## Changes
### New Line Profiler View
- **`LineProfilerView.tsx`**: Side-by-side comparison component showing:
- Line-by-line execution times with heat map visualization
- Syntax highlighting using `prism-react-renderer`
- Collapsible function blocks
- Light/dark mode support
- Heat legend (cold → hot based on % time)
- **`lineProfilerParser.ts`**: Parser utilities for line profiler data:
- `parseLineProfilerResults()` - parses markdown table output from
Python's line_profiler
- `formatTime()` - converts timer units to human-readable format (ns,
µs, ms, s)
- `getHeatLevel()` - determines heat coloring based on % time
- **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for
the profiler view
### API Changes
- **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR
description when profiler data exists
- **`github-app.ts`**: Removes line profiler data from metadata when PR
is closed/merged
- **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line
profiler data in staging
- **`staging-storage-strategy.ts`**: Interface updates for line profiler
fields
### Webapp Integration
- **`page.tsx`**: Added "Performance Profile" button (only visible when
profiler data exists)
- **`action.ts`**: Sends line profiler data when creating PR from webapp
Fixes CF-1018
https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.movhttps://github.com/HeshamHM28/my-best-repo/pull/21
linked to https://github.com/codeflash-ai/codeflash/pull/1139
---------
Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
## Summary
- Remove the hardcoded check that blocked PR suggestions for roboflow
repositories
- Remove the corresponding unit test that validated the roboflow
restriction
Fixes CF-967
samples https://github.com/codeflash-ai/my-best-repo/pull/461
## Summary
- Fix review comment creation to properly handle single-line changes by
only
using `line` parameter (without `start_line`)
- Fix condition to allow single-line hunks where `oldStart === oldEnd`
(changed from `<` to `<=`)
Fixes CF-690
Pull Request Checklist
Description
- Description of PR:
Privacy Mode Feature for Pro Users
This PR introduces a Privacy Mode feature that allows paid users
(Pro/Enterprise) to control how their code is stored during the
optimization review process.
Key Changes:
1. Privacy Mode Toggle in Sidebar
- Added a new toggle in the dashboard sidebar for Privacy Mode
- Only available for Pro/Enterprise users (disabled with upgrade prompt
for free users)
- Persists user preference in database with localStorage fallback for
fast UI
2. Storage Strategy Based on Privacy Setting
- Privacy Mode ON: Code is stored exclusively in GitHub branches (never
cached in database)
- Privacy Mode OFF: Code is temporarily cached in database for faster
loading, cleaned up when PR is created
3. Database Changes
- Added privacy_mode boolean field to users table (default: false)
- Added staging_storage_type field to track storage method
4. API Updates
- cf-api now checks user's privacy mode when determining storage
strategy
- StagingStorageStrategyFactory considers privacy mode alongside tier
eligibility
- Added getUserPrivacyMode, setUserPrivacyMode, and isUserPaid functions
User Experience
- Free users see the toggle disabled with "Upgrade to Pro" messaging
- Tooltip explains the trade-off: privacy vs. loading speed
- Toggle state syncs between localStorage (for instant UI) and database
(for persistence)
Storage Flow
User Request → Check Privacy Mode
├─ Privacy ON + Paid + Valid Repo → Git Branch Storage (GitHub only)
└─ Privacy OFF or Free → Plain Text Storage (Database cache)
---------
Co-authored-by: ali <mohammed18200118@gmail.com>
Co-authored-by: Mohamed Ashraf <ashraf@codeflash.ai>
- Introduced a helper function to parse speedup values consistently across both endpoints.
- Enhanced the update logic to check for existing data before adding new optimization details, preserving staging data.
- Updated the `updateOptimizationEvent` function to accept `prCommentFields` for more granular updates based on provided data.
Fixes CF-764
Description:
This PR checks if the optimization is medium. If yes, it creates a
staging PR; if not, it creates a dependent PR.
How to test:
1. Open Insomnia.
2. Try hitting the “Suggest PR” endpoint with medium and high
optimizationReview.
• For high, it should create a dependent PR.
• For medium, it should create a staging PR and comment on the original
PR.https://github.com/codeflash-ai/my-best-repo/pull/437#issuecomment-3518024107
---------
Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
## Organization Feature
This PR introduces a new **Organization** feature that allows users to:
- Create organizations and add members
- Manage repositories within organizations
- Allow organization members to access and view shared repository data
---
## How to Test
### 1. Setup
- Apply the latest **database migrations**.
- Build the **common** package, then **pack** and **install** it in
both:
- `cf-webapp`
- `cf-api`
### 2. Create an Organization
- You can create an organization **manually** in the database, **or**
- Use the **GitHub webhook** to add it automatically.
### 3. Test Scenarios
Prepare the following:
- **Two users:**
- **User A** – has access to the organization and its repositories.
- **User B** – a regular user.
- **Two repositories:**
- One under the **organization**.
- One under **User A’s personal account**.
### 4. Verification Steps
1. Log in to **cf-webapp** as **User A**.
2. Confirm both the **personal account** and **organization** appear.
3. Try optimizing code and ensure **statistics** display correctly.
4. Switch between **personal** and **organization** accounts to verify
data accuracy.
5. From the **personal account**:
- Open a specific repository.
- Add a new member by **GitHub username**.
- Log in as that member (**User B**) and verify access.
6. From the **organization**:
- Add members to the organization by **GitHub username**.
- Log in as the added member and confirm they have access to
organization repositories.
- Update the member’s **role** and ensure changes are applied correctly.
---
---------
Co-authored-by: ali <mohammed18200118@gmail.com>
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
- Added source parameter to track request origin to bypass approval
logic for source === "webapp"
- Also I saw that we have `dependencies.requiresApproval(owner, repo)`
so I used it
---------
Co-authored-by: Mohamed Ashraf <mohamedashrraf222@gmail.com>
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
At the moment, show it only for single hunk existing PR comments.
Changes made in a way to ensure ease in adding for new PRs too. Details
of optimization hidden from user at the moment.
---------
Co-authored-by: HeshamHM28 <HeshamMohamedFathy@outlook.com>
1. Allowed refresh token by adding scope permission and using
getAccessToken with force refresh.
2. Fixed approval and save logic by checking if the user is a member of
a repo.
3. Mapped errors correctly by creating type templates.
How to Test:
1. Manually add the user as a member of a repository.
2. Log in with this user and check if you can approve or save code and
access the repository.
---------
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>