Commit graph

1505 commits

Author SHA1 Message Date
aseembits93
9c4c7126a4 cleaning up 2026-01-14 19:01:43 -08:00
aseembits93
9d9bf41858 cleaning up 2026-01-14 18:53:04 -08:00
Kevin Turcios
69b55cd319
fix: preserve nested functions in test instrumentation (#2246)
# Pull Request Checklist

## Description
- [ ] **Description of PR**: Clear and concise description of what this
PR accomplishes
- [ ] **Breaking Changes**: Document any breaking changes (if
applicable)
- [ ] **Related Issues**: Link to any related issues or tickets

## Testing
- [ ] **Test cases Attached**: All relevant test cases have been
added/updated
- [ ] **Manual Testing**: Manual testing completed for the changes

## Monitoring & Debugging
- [ ] **Logging in place**: Appropriate logging has been added for
debugging user issues
- [ ] **Sentry will be able to catch errors**: Error handling ensures
Sentry can capture and report errors
- [ ] **Avoid Dev based/Prisma logging**: No development-only or
Prisma-specific logging in production code

## Configuration
- [ ] **Env variables newly added**: Any new environment variables are
documented in .env.example file or mentioned in description
---

## Additional Notes
<!-- Add any additional context, screenshots, or notes for reviewers
here -->
2026-01-14 21:19:24 -05:00
Kevin Turcios
dd0354883f
Handle optional filename in response (#2245)
# Pull Request Checklist

## Description
- [ ] **Description of PR**: Clear and concise description of what this
PR accomplishes
- [ ] **Breaking Changes**: Document any breaking changes (if
applicable)
- [ ] **Related Issues**: Link to any related issues or tickets

## Testing
- [ ] **Test cases Attached**: All relevant test cases have been
added/updated
- [ ] **Manual Testing**: Manual testing completed for the changes

## Monitoring & Debugging
- [ ] **Logging in place**: Appropriate logging has been added for
debugging user issues
- [ ] **Sentry will be able to catch errors**: Error handling ensures
Sentry can capture and report errors
- [ ] **Avoid Dev based/Prisma logging**: No development-only or
Prisma-specific logging in production code

## Configuration
- [ ] **Env variables newly added**: Any new environment variables are
documented in .env.example file or mentioned in description
---

## Additional Notes
<!-- Add any additional context, screenshots, or notes for reviewers
here -->
2026-01-14 20:49:09 -05:00
Kevin Turcios
ca62d68955
fix: prompt adjustment for testgen (#2242)
## Summary
- Preserve nested functions in test instrumentation (skip instrumenting
calls inside nested function definitions)
- Prevent LLM from embedding markdown code fences in generated tests
(updated system prompts)
- Handle optional filename in python code blocks (e.g.,
`\`\`\`python:filename.py`)

## Test plan
- [x] Unit tests added for nested function preservation
- [x] Unit test for optional filename parsing
- [ ] Manual testing with generated tests
2026-01-14 20:27:43 -05:00
Kevin Turcios
286e76a9f0
fix: Improve symbol resolution for test generation (#2241)
## Summary
- Include private symbols when resolving undefined names in generated
tests
- Resolve symbols imported by source module in generated tests  
- Add fallback for symbols referenced but not defined in source snippet
- Ensure LocalDefinitionRemover only removes top-level definitions
(preserves nested classes/functions)
- Performance optimization for `get_symbols_from_source_code` function

## Test plan
- [x] Unit tests added for all new functionality
- [ ] Manual testing with generated tests

---------

Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
2026-01-14 20:16:51 -05:00
Aseem Saxena
930382731d
Merge branch 'main' into testgen-jit 2026-01-14 12:03:08 -08:00
Aseem Saxena
521900af83 bug fix and latest instrumentaiton 2026-01-13 02:04:15 +00:00
Kevin Turcios
aa544dc74a
log out trace_id for debugging (#2235)
# Pull Request Checklist

## Description
- [ ] **Description of PR**: Clear and concise description of what this
PR accomplishes
- [ ] **Breaking Changes**: Document any breaking changes (if
applicable)
- [ ] **Related Issues**: Link to any related issues or tickets

## Testing
- [ ] **Test cases Attached**: All relevant test cases have been
added/updated
- [ ] **Manual Testing**: Manual testing completed for the changes

## Monitoring & Debugging
- [ ] **Logging in place**: Appropriate logging has been added for
debugging user issues
- [ ] **Sentry will be able to catch errors**: Error handling ensures
Sentry can capture and report errors
- [ ] **Avoid Dev based/Prisma logging**: No development-only or
Prisma-specific logging in production code

## Configuration
- [ ] **Env variables newly added**: Any new environment variables are
documented in .env.example file or mentioned in description
---

## Additional Notes
<!-- Add any additional context, screenshots, or notes for reviewers
here -->
2026-01-12 20:34:36 -05:00
Kevin Turcios
d20c49ada1
CF-991 improve exception reporting for the aiservice (#2223)
# Pull Request Checklist

## Description
- [ ] **Description of PR**: Clear and concise description of what this
PR accomplishes
- [ ] **Breaking Changes**: Document any breaking changes (if
applicable)
- [ ] **Related Issues**: Link to any related issues or tickets

## Testing
- [ ] **Test cases Attached**: All relevant test cases have been
added/updated
- [ ] **Manual Testing**: Manual testing completed for the changes

## Monitoring & Debugging
- [ ] **Logging in place**: Appropriate logging has been added for
debugging user issues
- [ ] **Sentry will be able to catch errors**: Error handling ensures
Sentry can capture and report errors
- [ ] **Avoid Dev based/Prisma logging**: No development-only or
Prisma-specific logging in production code

## Configuration
- [ ] **Env variables newly added**: Any new environment variables are
documented in .env.example file or mentioned in description
---

## Additional Notes
<!-- Add any additional context, screenshots, or notes for reviewers
here -->

---------

Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
2026-01-12 20:18:00 -05:00
aseembits93
7101d9c449 no need to normalize code 2026-01-12 15:59:43 -08:00
aseembits93
c58618beb5 fix for 3.12.3 2026-01-12 15:34:36 -08:00
aseembits93
4ff64cc7e8 existing tests should be fixed now 2026-01-12 15:17:26 -08:00
aseembits93
a6032c2359 need to fix existing tests 2026-01-12 14:44:10 -08:00
aseembits93
bc6a767e41 unrelated ty check fixes 2026-01-12 12:50:56 -08:00
aseembits93
0534e3d3b5 consistent quotes 2026-01-12 12:32:35 -08:00
aseembits93
80fda18800 fix tests 2026-01-12 12:15:16 -08:00
Kevin Turcios
f2f4ea88fa
Merge branch 'main' into gpu-sync-instrumentation 2026-01-10 02:56:27 -05:00
Kevin Turcios
1e1820d27a
feat: add ty type checker to pre-k hooks (#2213)
Adds a local pre-commit hook for ty type checker since there's no
official pre-commit hook available yet (tracked in astral-sh/ty#269).
2026-01-09 22:36:53 -05:00
Aseem Saxena
c2782f3d2a handle submodule imports 2026-01-09 18:46:15 -08:00
Aseem Saxena
e5ad4efd0a double quote to single 2026-01-09 15:45:19 -08:00
Aseem Saxena
282ed2bea0 double quote to single 2026-01-09 15:42:27 -08:00
Aseem Saxena
e8cc522296 prek fix 2026-01-09 15:37:57 -08:00
Aseem Saxena
5379db9c4a
Merge branch 'main' into gpu-sync-instrumentation 2026-01-09 15:32:39 -08:00
Aseem Saxena
2348566f6b working the same as cli with more tests 2026-01-09 15:22:57 -08:00
Aseem Saxena
75bd21d0c2 working the same as cli 2026-01-09 14:48:01 -08:00
Sarthak Agarwal
7bef00afa3
delete the package causing issue (#2220)
Co-authored-by: Kevin Turcios <106575910+KRRT7@users.noreply.github.com>
2026-01-10 01:05:06 +05:30
Sarthak Agarwal
50fbd275d5
add backward compatibility (#2217)
# Pull Request Checklist

## Description
- [ ] **Description of PR**: Clear and concise description of what this
PR accomplishes
- [ ] **Breaking Changes**: Document any breaking changes (if
applicable)
- [ ] **Related Issues**: Link to any related issues or tickets

## Testing
- [ ] **Test cases Attached**: All relevant test cases have been
added/updated
- [ ] **Manual Testing**: Manual testing completed for the changes

## Monitoring & Debugging
- [ ] **Logging in place**: Appropriate logging has been added for
debugging user issues
- [ ] **Sentry will be able to catch errors**: Error handling ensures
Sentry can capture and report errors
- [ ] **Avoid Dev based/Prisma logging**: No development-only or
Prisma-specific logging in production code

## Configuration
- [ ] **Env variables newly added**: Any new environment variables are
documented in .env.example file or mentioned in description
---

## Additional Notes
<!-- Add any additional context, screenshots, or notes for reviewers
here -->
2026-01-10 00:31:11 +05:30
Kevin Turcios
93519bbcbe
Merge branch 'main' into update-prompts-mini-5 2026-01-09 01:56:37 -05:00
Kevin Turcios
8afe66c376
Merge branch 'main' into gpt-5-mini 2026-01-09 01:37:19 -05:00
Kevin Turcios
fe039a1502 fix prod crashes 2026-01-09 00:49:55 -05:00
Kevin Turcios
3c8408d73b
Merge branch 'gpt-5-mini' into update-prompts-mini-5 2026-01-09 00:35:39 -05:00
Kevin Turcios
2f7a400b73
Merge branch 'main' into gpt-5-mini 2026-01-09 00:32:11 -05:00
Sarthak Agarwal
8fbe21bffa
fix review prompt v1 (#2124)
Co-authored-by: Kevin Turcios <106575910+KRRT7@users.noreply.github.com>
2026-01-09 10:56:12 +05:30
Kevin Turcios
3449bba20d gpt-5-mini
gpt-5-mini is misinterpreting the template format in execute_user_prompt.md. When it sees:

  # function to test
  {function_code}

  It's outputting a nested code block with markdown path syntax (python:unstructured/staging/label_box.py) instead of the actual function code inline. It never reaches the # unit tests section where it should generate def test_* functions.
2026-01-09 00:10:12 -05:00
Kevin Turcios
c3385c79ba double max_tokens for now 2026-01-09 00:10:12 -05:00
Kevin Turcios
f393c8ce9f refresh here 2026-01-09 00:07:16 -05:00
Kevin Turcios
084af4f34d fix: restore inline prompts in ranker.py
The previous commit deleted the .md files but didn't revert the code
that loads from them, causing FileNotFoundError on server startup.
2026-01-09 00:07:15 -05:00
Kevin Turcios
d3f785156f revert changes to prompts 2026-01-09 00:07:15 -05:00
Kevin Turcios
fe0eb264a6 readjust prompt 2026-01-09 00:07:15 -05:00
Kevin Turcios
64970afae8 strenghten prompt 2026-01-09 00:07:14 -05:00
Kevin Turcios
a906d651cd use speedups 2026-01-09 00:07:14 -05:00
Kevin Turcios
00bb9756f4 re-adjust 2026-01-09 00:07:13 -05:00
Kevin Turcios
33939c62c3 move to their own md 2026-01-09 00:07:13 -05:00
Kevin Turcios
32daebf832 update prompts 2026-01-09 00:07:13 -05:00
Kevin Turcios
4f27a23623 remove temperature 2026-01-09 00:07:13 -05:00
Kevin Turcios
99bfbd980d use the centralized config 2026-01-09 00:07:12 -05:00
Kevin Turcios
1d1ec35cc3 typed dict runtime eval 2026-01-09 00:05:30 -05:00
Kevin Turcios
13af3b09a7 prek 2026-01-09 00:05:29 -05:00
Kevin Turcios
db926e785a cleanup calculate_llm_cost 2026-01-09 00:05:29 -05:00
Kevin Turcios
2d35bac4eb use GPT-5-Mini 2026-01-09 00:05:29 -05:00
Kevin Turcios
1de222fcf2 add OpenAI_GPT_5_Mini and update pricing 2026-01-09 00:05:28 -05:00
Kevin Turcios
cf6898eacf use haiku 2026-01-08 23:29:09 -05:00
Kevin Turcios
8c8d9f2c73
Merge branch 'main' into fix/add-missing-imports-postprocessing 2026-01-08 14:39:56 -05:00
Aseem Saxena
29ec4fa6a5
Merge branch 'main' into gpu-sync-instrumentation 2026-01-07 18:38:03 -08:00
HeshamHM28
50c2a61b85 Fix: Simplify _increment_llm_cost function by removing unnecessary line breaks 2026-01-08 03:24:16 +02:00
Aseem Saxena
0777cdfecc instructions to generate jit compiled code in another PR 2026-01-07 17:23:31 -08:00
HeshamHM28
5f21f8fae0 Fix: Refactor llm_cost increment logic into a separate function 2026-01-08 03:19:22 +02:00
Aseem Saxena
5e3bdccd8d testgen instructions in another commit 2026-01-07 16:58:52 -08:00
Aseem Saxena
85b308a363 cleaning up 2026-01-07 16:44:44 -08:00
HeshamHM28
96aa1305f0 Fix: Update defaults in get_or_create_optimization_event for repository_id and current_username 2026-01-08 02:41:07 +02:00
Aseem Saxena
8700af0140
Merge branch 'main' into testgen-jit 2026-01-07 16:20:10 -08:00
Aseem Saxena
bd08e1b792 simpler jax instrumentation 2026-01-07 16:16:26 -08:00
Aseem Saxena
9fb2f72a41 instrumentation for generated tests 2026-01-07 15:13:08 -08:00
Kevin Turcios
b834e7d332
Merge branch 'main' into fix/add-missing-imports-postprocessing 2026-01-07 17:30:33 -05:00
HeshamHM28
60a3c0694c
[FEAT] Privacy Mode (#2092)
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>
2026-01-07 12:23:45 -08:00
Kevin Turcios
795ccab1be fix: add prompt instructions to avoid Mock objects and incorrect constructors
- Do not use Mock objects for domain classes (pickling issues)
- Use correct constructor signatures from context
- Use concrete subclasses when base class is abstract
2026-01-07 14:44:11 -05:00
codeflash-ai[bot]
207f2847c6
Optimize UndefinedNameCollector.get_undefined_names
The optimization eliminates a significant performance bottleneck by moving the computation of `set(dir(builtins))` from runtime to module load time.

**What changed:**
- Introduced a module-level constant `_BUILTIN_NAMES = frozenset(dir(builtins))` 
- Replaced the repeated `builtin_names = set(dir(builtins))` call with direct reference to `_BUILTIN_NAMES`
- Used `frozenset` instead of `set` for the constant (immutable and slightly more efficient for lookups)

**Why this is faster:**
The original code calls `dir(builtins)` and creates a new set from it on every invocation of `get_undefined_names()`. The line profiler shows this single line consumed 73.3% of the function's execution time (1.68ms out of 2.29ms total). 

Python's `dir(builtins)` returns a list of ~150 builtin names, and converting this to a set requires:
1. Calling `dir()` to introspect the builtins module
2. Iterating through the list 
3. Allocating a new set and hashing each name

Since builtin names are constant for a Python process, this work is entirely redundant. By computing it once at module import time, each call to `get_undefined_names()` saves ~21.8μs per invocation (from the line profiler: 21799.7ns per hit).

**Performance impact:**
- **184% speedup** overall (1.09ms → 383μs)
- The optimized version shows 100% of time now spent on the actual set operations (name filtering), not builtin lookup
- Test results show 1350-2450% improvement for simple cases with few names, and 22-126% improvement even for large-scale tests with 1000+ names
- The optimization is particularly effective when `get_undefined_names()` is called repeatedly (as shown by the 77 hits in the profiler and multiple test invocations)

**Test case effectiveness:**
- Most effective for tests with repeated calls to `get_undefined_names()` on the same or different collector instances
- Benefits all test patterns since the builtin check happens on every call regardless of the number of user-defined names
- Even large-scale tests with 1000+ names show 22-35% improvements because the builtin lookup overhead is eliminated
2026-01-07 19:31:38 +00:00
Kevin Turcios
68a51bfcc3 fix: remove local class redefinitions and replace with imports
Instead of just adding missing imports, now also:
1. Detects classes/functions defined locally that exist in source module
2. Removes those local redefinitions
3. Adds imports for them

This ensures tests use the real classes from the source module.
2026-01-07 14:18:34 -05:00
Kevin Turcios
86f68b6ac7 fix: add postprocessing to fix missing imports in generated tests
When the LLM generates test code, it sometimes redefines classes locally
(like Element, ChunkingOptions) but forgets to import or define others
(like PreChunk), causing NameError at runtime.

This adds a postprocessing step that:
1. Detects undefined names in the generated test code
2. Checks if those names are defined in the source module
3. Adds the missing imports automatically

This is more reliable than relying on prompt instructions which the LLM
sometimes ignores.
2026-01-07 14:12:04 -05:00
Kevin Turcios
0d13635e4f not just for claude code 2026-01-06 22:21:32 -05:00
Kevin Turcios
883038bffe reference ty 2026-01-06 22:18:04 -05:00
Kevin Turcios
b10b0295fe Update AGENTS.md 2026-01-06 22:16:20 -05:00
Kevin Turcios
ff1f302e40 Create AGENTS.md 2026-01-06 22:13:44 -05:00
Kevin Turcios
c9df33526f
Merge branch 'main' into remove-print-messages 2026-01-06 18:49:26 -05:00
Kevin Turcios
9ea1afbdbf
Merge branch 'main' into remove-print-messages 2026-01-06 18:24:22 -05:00
Aseem Saxena
7feb6a19e8
Merge branch 'main' into ranker-discourage-type 2026-01-06 15:16:20 -08:00
Kevin Turcios
7f3d204ab6
Merge branch 'main' into ranker-discourage-type 2026-01-06 17:49:50 -05:00
Kevin Turcios
977f5a4348
Merge branch 'main' into unstructured-fixes 2026-01-06 17:47:55 -05:00
mashraf-222
669a1fe028
Merge branch 'main' into disable-telemetry-flag-dev 2026-01-06 21:08:36 +02:00
Kevin Turcios
5abb597996
Merge branch 'main' into unstructured-fixes 2026-01-06 13:40:51 -05:00
Kevin Turcios
7b2922807b
Merge branch 'main' into unstructured-fixes 2026-01-06 12:08:31 -05:00
mashraf-222
d0d2fb6fc6
Merge branch 'main' into disable-telemetry-flag-dev 2026-01-06 18:01:31 +02:00
ali
6060fa6701
ensures llm generates the testgen code as is a markdown code 2026-01-06 12:57:29 +02:00
ali
997f450794
default values for candidates number 2026-01-06 03:18:00 +02:00
ali
75ee24ebbf
control num of llm calls for optimize and optimize-lp 2026-01-06 02:10:51 +02:00
mashraf-222
206469f3f6
Merge branch 'main' into disable-telemetry-flag-dev 2026-01-05 19:25:10 +02:00
Aseem Saxena
c5f859fc27 device specific tests 2026-01-02 13:30:32 -08:00
Aseem Saxena
805219691d
typo 2026-01-02 12:21:39 -08:00
Aseem Saxena
0bb3c2522c
grammar 2026-01-02 10:23:09 -08:00
Aseem Saxena
3478043dad
typo 2026-01-02 10:20:40 -08:00
Aseem Saxena
8dadc322f8
Update ranking optimization guidelines in ranker.py
avoid isinstance to type conversions
2026-01-02 10:19:27 -08:00
Sarthak Agarwal
23784bdf05 Discourage the isinstance to type conversion 2026-01-02 23:01:22 +05:30
mashraf-222
59354251aa
Merge branch 'main' into disable-telemetry-flag-dev 2026-01-02 15:14:23 +02:00
Kevin Turcios
798523bc29 Add logging.exception() to API error handlers for better debugging
Replace logger.error() and debug_log_sensitive_data() with
logging.exception() in exception handlers to ensure full stack traces
are logged to console/logs, not just to Sentry.

Affected endpoints:
- /optimize: Added exception logging
- /rank: Added logging import and exception logging
- /explanations: Added logging import and exception logging
- /workflow-gen: Changed logger.error to logger.exception
2026-01-01 17:47:12 -05:00
Kevin Turcios
2095c31195 Remove print_messages debug output from testgen
Remove the print_messages function and its usage since observability
tooling is now in place. This eliminates verbose system prompt output
during test generation in non-production environments.
2026-01-01 17:42:52 -05:00
Kevin Turcios
0c81863fff
Merge branch 'main' into unstructured-fixes 2026-01-01 13:31:05 -05:00
Kevin Turcios
0b308e4cd8
Merge branch 'main' into ty-follow-up 2026-01-01 13:29:07 -05:00
Kevin Turcios
b357f9541c fix: remove unreachable code in _handle_assign method 2026-01-01 13:07:27 -05:00
ali
2c5f031145
correct type for request in adaptive api 2026-01-01 20:01:28 +02:00
ali
13cedf8f5b
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into exp/adaptive-optimization 2026-01-01 20:00:00 +02:00
ali
8cd1ecb670
ruff format 2026-01-01 17:08:52 +02:00
Kevin Turcios
441a15f137 fix: instruct LLM to import classes instead of mocking them
Generated tests were failing isinstance() checks because LLM created
mock class definitions instead of importing real ones.

Added prompt instruction to import classes from their actual modules
when file paths are shown in the context.
2026-01-01 02:03:12 -05:00
Kevin Turcios
7943f8d782 fix: track base class dependencies in unused definition removal
Added base class dependency tracking as a secondary safeguard.
When a class inherits from another, the parent is now marked as
a dependency, preventing incorrect removal.
2026-01-01 02:02:57 -05:00
Kevin Turcios
b1819ffcae fix: preserve used classes/functions in generated tests
delete_top_def_nodes was removing helper classes even when they were
actually used in test code, causing NameError at runtime.

Now collects all names referenced in the module and protects them from
deletion. This ensures base classes and instantiated classes are kept.
2026-01-01 02:02:36 -05:00
ali
fe1b523895
adaptive optimization (working version) 2026-01-01 07:34:00 +02:00
Mohamed Ashraf
d5726b5091 Merge branch 'disable-telemetry-flag-dev' of https://github.com/codeflash-ai/codeflash-internal into disable-telemetry-flag-dev 2025-12-31 02:40:55 +02:00
Mohamed Ashraf
bf120fde40 Ruff reformatted the PostHog initialization 2025-12-31 02:39:03 +02:00
mashraf-222
9922de4684
Merge branch 'main' into disable-telemetry-flag-dev 2025-12-31 02:34:31 +02:00
Mohamed Ashraf
568b70a609 add telemetry flag to be disabled in dev 2025-12-31 02:29:06 +02:00
Aseem Saxena
4d8a597747 add rewrite endpoint 2025-12-30 14:14:51 -08:00
Aseem Saxena
83278c42ee wip 2025-12-30 14:08:44 -08:00
Kevin Turcios
c4764f58a0 one 2025-12-30 16:17:35 -05:00
Kevin Turcios
23e4a29608 a few more 2025-12-30 16:03:48 -05:00
Kevin Turcios
3f2f996ff2 fix a few more 2025-12-30 15:48:07 -05:00
Kevin Turcios
15443f39eb fix issues here 2025-12-30 15:38:54 -05:00
Kevin Turcios
fb2cd82da0 narrow type hints here 2025-12-30 15:35:56 -05:00
Kevin Turcios
5174b96050 narrow type hints here too 2025-12-30 15:27:02 -05:00
Kevin Turcios
28237eb8bb move sqlalchemy, gen_inspired_tests, and mistral 2025-12-30 15:22:39 -05:00
Kevin Turcios
59d57756f1 update test expectations 2025-12-30 15:07:13 -05:00
Kevin Turcios
78fbbd54cd formatting 2025-12-30 14:55:42 -05:00
Kevin Turcios
a2c0ef6573 Merge main into ty-setup branch 2025-12-30 14:50:29 -05:00
Aseem Saxena
7c317377f2 wip 2025-12-30 10:26:57 -08:00
Aseem Saxena
4af2814eb2 wip 2025-12-30 09:54:39 -08:00
Kevin Turcios
15c2337cc0 fix the type errors in edit_generated_tests.py 2025-12-30 03:19:42 -05:00
Kevin Turcios
434abdfc66 type the pipeline 2025-12-30 03:14:07 -05:00
Kevin Turcios
5ac8c3badd context guard 2025-12-30 03:06:34 -05:00
Kevin Turcios
2d78bceb0f missed this one 2025-12-30 02:51:38 -05:00
Kevin Turcios
de89aa3ac5 fix errors related to instrument_tests 2025-12-30 02:44:28 -05:00
Kevin Turcios
140683c03d fix errors related to BaseStatement 2025-12-30 02:32:24 -05:00
Kevin Turcios
0fdade4223 fix type hints related to ChatCompletionMessageParam 2025-12-30 02:05:02 -05:00
Kevin Turcios
045e3698a5 fix models related typing errors 2025-12-30 01:58:35 -05:00
Kevin Turcios
5b91b0e047 fix these type hints 2025-12-30 01:53:44 -05:00
Kevin Turcios
3bbc45a409 Update uv.lock 2025-12-30 01:35:02 -05:00
Kevin Turcios
858c1420b2 we don't have to read it every time 2025-12-30 01:34:41 -05:00
Kevin Turcios
1d72482777 only the formatter for now 2025-12-30 01:17:06 -05:00
Kevin Turcios
214389eae2 remove unused import 2025-12-30 01:17:05 -05:00
Kevin Turcios
664c66e7c3 run the formatter 2025-12-30 01:17:03 -05:00
Kevin Turcios
9f274a4713 add ruff to the config 2025-12-30 01:17:03 -05:00
Kevin Turcios
f4a2f5afd4 refresh lockfile 2025-12-30 01:17:03 -05:00
Kevin Turcios
2d4751a2f0 add pre-k to dependencies 2025-12-30 01:17:03 -05:00
Kevin Turcios
38f3e5c683 add ty type checker 2025-12-30 01:10:26 -05:00
Kevin Turcios
36b5ae44f1 Merge branch 'main' into test_gen_for_diversity 2025-12-29 22:49:07 -05:00
ali
fd8bb922d2
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into v4a-diff-patches-for-optimizer-context 2025-12-29 23:27:11 +02:00
ali
14491f63ce
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into v4a-diff-patches-for-optimizer-context 2025-12-29 22:33:36 +02:00
Sarthak Agarwal
f5a303dd31
removing comments 2025-12-29 22:09:44 +05:30
Sarthak Agarwal
af7f00cdae For diversity in testgen 2025-12-29 22:05:09 +05:30
Kevin Turcios
262c193365 include the model name 2025-12-26 19:22:55 -05:00
Kevin Turcios
6f45e0d0f1 make ruff and ty happy 2025-12-26 18:55:45 -05:00
Kevin Turcios
0819524858 use a config file 2025-12-26 18:33:49 -05:00
Kevin Turcios
a2ddac0b29 implement multi model optimization properly 2025-12-26 18:24:16 -05:00
Kevin Turcios
2bbce5ef53 fix call sequence 2025-12-26 16:06:29 -05:00
Kevin Turcios
e9709744aa make ty happy 2025-12-26 15:29:10 -05:00
Kevin Turcios
ac566d6ad0 lefovers 2025-12-26 15:21:46 -05:00
Kevin Turcios
a03b22bab7 make these async 2025-12-26 15:10:53 -05:00
Kevin Turcios
f247e59161 simplify here too 2025-12-26 15:02:30 -05:00
Kevin Turcios
63afac1ca8 first pass 2025-12-26 14:41:21 -05:00
Kevin Turcios
2c46242165 reduce abstraction 2025-12-26 14:15:13 -05:00
Kevin Turcios
9bd728a733 prevent race condition 2025-12-25 00:22:12 -05:00
Kevin Turcios
1f686f9fb5 bugfix 2025-12-25 00:05:29 -05:00
Kevin Turcios
f0bebecc35 ensure proper cost calculation and observability 2025-12-23 18:23:36 -05:00
Kevin Turcios
97210aefb8 remove debug 2025-12-23 14:12:35 -05:00
Kevin Turcios
0407292e56 remove n=min(data.n_candidates_lp or 6, 8), 2025-12-23 14:06:53 -05:00
Kevin Turcios
06db49251f diversity 2025-12-23 12:41:09 -05:00
Kevin Turcios
4bdb5c7bb8 remove from here 2025-12-23 00:18:08 -05:00
Kevin Turcios
b7c0040a42 simplify 2025-12-22 23:57:06 -05:00
Kevin Turcios
273edff3ab unify 2025-12-22 23:51:05 -05:00
Kevin Turcios
4a7f8a10f4 oops 2025-12-22 23:38:51 -05:00
Kevin Turcios
e938448e60 unified 2025-12-22 23:28:29 -05:00
Kevin Turcios
72e0fb037b simplify things 2025-12-22 21:41:45 -05:00
Kevin Turcios
43d3115bf3 update these 2025-12-22 21:30:21 -05:00
Kevin Turcios
49d0b496f9 Update env_specific.py 2025-12-22 21:17:24 -05:00
Kevin Turcios
d63d8ca910 use azure foundry openai endpoint 2025-12-22 21:11:28 -05:00
Kevin Turcios
3b79fd8c2d add anthropic to pyproject 2025-12-22 18:29:38 -05:00
Kevin Turcios
c97e16e12a
Merge branch 'main' into claude-azure-support 2025-12-22 18:26:12 -05:00
Kevin Turcios
2d1f388f30 use AsyncAnthropicFoundry 2025-12-22 18:25:20 -05:00
Kevin Turcios
0e23952673 create AnthropicFoundry client 2025-12-22 15:13:29 -05:00
mashraf-222
75201a95ab
feat: Add optimization usage display component to dashboard and billi… (#2028)
## Add Optimization Usage Display

### Technical Changes

- **New Component**: Created `OptimizationUsageCard` component
(`js/cf-webapp/src/components/dashboard/OptimizationUsageCard.tsx`)
  - Reusable component matching existing dashboard card styling
  - Uses shadcn/ui `Progress` component for visual progress indicator
  - Responsive design with mobile-friendly layouts
- Color-coded progress bar (green/yellow < 80%, yellow 80-95%,
orange/red ≥ 95%)

- **Server Action**: Added `getSubscriptionData` server action in
`dashboard/action.ts`
- Properly handles Prisma calls on server-side (fixes browser
PrismaClient error)
  - Fetches subscription data with lazy period reset logic

- **Dashboard Integration**: Added usage card to main dashboard page
  - Displays at top of metrics section for individual users
  - Only shows for personal accounts (hidden for organization views)
  - Integrated with existing data fetching pipeline
  
<img width="1891" height="991" alt="image"
src="https://github.com/user-attachments/assets/12c4f22b-51e7-439a-8614-644b06a423b2"
/>


- **Billing Page Integration**: Added usage card to billing page
  - Positioned above subscription card for easy visibility
  - Uses existing subscription data from page props
  
<img width="1891" height="982" alt="image"
src="https://github.com/user-attachments/assets/9c603227-750f-47be-ac10-36cfec3e4b45"
/>


### User-Facing Features

Users can now see their optimization usage in a clear, visual format:

- **Usage Metrics**: Displays formatted numbers showing "X / Y"
optimizations used
- **Remaining Count**: Shows how many optimizations are still available
- **Visual Progress Bar**: Color-coded progress indicator that changes
based on usage percentage
- **Plan Information**: Badge showing current plan type (free/pro)
- **Reset Date**: Displays when the usage period resets (if available)
- **Percentage**: Shows exact percentage of usage

The component appears on both the Dashboard and Billing pages, giving
users easy access to their usage information wherever they need it.

---------

Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
Co-authored-by: HeshamHM28 <HeshamMohamedFathy@outlook.com>
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
Co-authored-by: Kevin Turcios <106575910+KRRT7@users.noreply.github.com>
2025-12-22 21:02:43 +05:30
Kevin Turcios
89cc252d35 add claude 2025-12-22 03:34:07 -05:00
Kevin Turcios
d0400c0907 formatting
formatting
2025-12-22 02:59:52 -05:00
Kevin Turcios
1febc07527 sync 2025-12-22 02:55:37 -05:00
Sarthak Agarwal
a3380a2372
Observability V1 (#2101)
closes
https://linear.app/codeflash-ai/issue/CF-909/ai-observability-see-the-history-of-a-trace-id
2025-12-20 03:54:09 +05:30
ali
00f0036187
no harm still the same 2025-12-18 02:45:43 +02:00
ali
e17eb8c815
works now 2025-12-18 02:42:18 +02:00
ali
f77f9bb1e3
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into v4a-diff-patches-for-optimizer-context 2025-12-18 01:45:25 +02:00
Aseem Saxena
1192df12a6
feedback loop for unmatched test results (#2059)
fixes CF-932

# Pull Request Checklist

## Description
- [ ] **Description of PR**: Clear and concise description of what this
PR accomplishes
- [ ] **Breaking Changes**: Document any breaking changes (if
applicable)
- [ ] **Related Issues**: Link to any related issues or tickets

## Testing
- [ ] **Test cases Attached**: All relevant test cases have been
added/updated
- [ ] **Manual Testing**: Manual testing completed for the changes

## Monitoring & Debugging
- [ ] **Logging in place**: Appropriate logging has been added for
debugging user issues
- [ ] **Sentry will be able to catch errors**: Error handling ensures
Sentry can capture and report errors
- [ ] **Avoid Dev based/Prisma logging**: No development-only or
Prisma-specific logging in production code

## Configuration
- [ ] **Env variables newly added**: Any new environment variables are
documented in .env.example file or mentioned in description
---

## Additional Notes
<!-- Add any additional context, screenshots, or notes for reviewers
here -->

---------

Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
Co-authored-by: ali <mohammed18200118@gmail.com>
Co-authored-by: Kevin Turcios <106575910+KRRT7@users.noreply.github.com>
2025-12-17 08:14:32 +05:30
Aseem Saxena
962febcb7a
Merge branch 'main' into v4a-diff-patches-for-optimizer-context 2025-12-12 18:08:01 -08:00
Kevin Turcios
6cc0dbf90c Update auth_middleware.py 2025-12-12 08:51:28 -05:00
Kevin Turcios
b785f80a73 make it easier on us 2025-12-12 08:44:33 -05:00
ali
1fc49e0301
organize imports 2025-12-10 14:52:15 +02:00
ali
7832b3ca2d
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into v4a-diff-patches-for-optimizer-context 2025-12-10 14:51:40 +02:00
ali
ae1496de6c
don't switch to single context if a diff method is being used 2025-12-10 14:49:02 +02:00
ali
1922faf0df
refactoring 2025-12-09 23:09:50 +02:00
Aseem Saxena
8cbb2d32dd minor edit 2025-12-09 15:10:23 -05:00
Aseem Saxena
ad015aefbf first draft 2025-12-09 14:51:19 -05:00
ali
a124846724
cleanup 2025-12-09 19:16:25 +02:00
mashraf-222
d4ddff44df
Github action setup with PR for CLI user (#2009)
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
Co-authored-by: Kevin Turcios <106575910+KRRT7@users.noreply.github.com>
2025-12-08 23:18:13 +05:30
Kevin Turcios
900a6fe3fd no unittest 2025-12-03 05:22:52 -05:00
ali
80785109e9
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into v4a-diff-patches-for-optimizer-context 2025-11-25 22:13:17 +02:00
ali
d551245c4c
sentry capture for diff error 2025-11-25 22:11:18 +02:00
Aseem Saxena
4e5f0cdee1 fix 2025-11-25 07:58:12 -08:00
Aseem Saxena
ce9e0f4c20 fix 2025-11-24 17:48:57 -08:00
Aseem Saxena
a22153572f todo 2025-11-24 17:03:25 -08:00
Aseem Saxena
f13eef66ad cleaning up 2025-11-18 10:58:36 -08:00
Aseem Saxena
22e9aae0dc from original db 2025-11-18 10:55:37 -08:00
ali
491aadc7f1
make it work 2025-11-18 20:17:09 +02:00
Aseem Saxena
a37d9d042f wip 2025-11-18 09:00:26 -08:00
Aseem Saxena
c82c7f45de wip 2025-11-18 08:57:33 -08:00
Aseem Saxena
ae290e8e56 wip 2025-11-18 08:44:58 -08:00
Aseem Saxena
2896cde219 wip 2025-11-18 08:30:54 -08:00
Saurabh Misra
7c1933180a
local setup (#1898)
Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
Co-authored-by: saga4 <saga4@codeflashs-MacBook-Air.local>
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
Co-authored-by: Mohamed Ashraf <mohamedashrraf222@gmail.com>
Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2025-11-17 12:35:09 -08:00
mohammed ahmed
8696da541a
Merge branch 'main' into vsc/demo-optimization 2025-11-11 16:48:03 +02:00
ali
600b53d906
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into v4a-diff-patches-for-optimizer-context 2025-11-10 12:46:34 +02:00
Kevin Turcios
0af276990a
Merge branch 'main' into instruct-LLM-not-to-mock-anything 2025-11-07 14:44:52 -08:00
Aseem Saxena
13c4ef68cc peg to 0.18.2 2025-11-07 10:20:08 -08:00
Aseem Saxena
8c244de073 Merge remote-tracking branch 'origin/main' into generated-tests-markdown 2025-11-07 10:08:28 -08:00
ali
5b24b27edd
cleanup 2025-11-06 19:54:45 +02:00
ali
b77ca4354c
tests and fix the multiple diff patches issue 2025-11-06 19:52:54 +02:00
ali
c51411cb56
correctly get the file name for hacking for demo 2025-11-06 14:58:37 +02:00
ali
7ce4b5d620
always use multi context if the code in markdown format 2025-11-06 14:48:08 +02:00
ali
d9b6fa5907
error handler 2025-11-06 14:23:48 +02:00
ali
f4e79fecc0
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into v4a-diff-patches-for-optimizer-context 2025-11-06 14:13:51 +02:00
mohammed ahmed
cd98468dd8
Merge branch 'main' into vsc/demo-optimization 2025-11-06 13:53:51 +02:00
Kevin Turcios
69cb7c7509 use qualified name instead 2025-11-05 17:38:44 -08:00
mohammed ahmed
09a95e5038
Merge branch 'main' into v4a-diff-patches-for-optimizer-context 2025-11-05 19:59:30 +02:00
ali
91670b0465
Merge branch 'main' of github.com:codeflash-ai/codeflash-internal into vsc/demo-optimization 2025-11-05 12:29:09 +02:00
Aseem Saxena
ef51548ad1
Apply suggestion from @aseembits93 2025-11-04 00:31:02 -08:00
Aseem Saxena
e62d3d546d
Apply suggestion from @aseembits93 2025-11-04 00:29:59 -08:00
Aseem Saxena
44e9562093 3.10 to 3.11 2025-11-04 00:27:58 -08:00
Aseem Saxena
c8584d36d2 need to finetune the prompts a bit 2025-11-04 00:18:14 -08:00
Aseem Saxena
a9621d2f12 typo 2025-11-03 22:58:11 -08:00
Aseem Saxena
0776ad5524 aiservice needs cleaning up 2025-11-03 22:38:49 -08:00
Aseem Saxena
5da77300ad needs more cleaning up 2025-11-03 22:30:44 -08:00
Aseem Saxena
a5ae312071 cleaning up 2025-11-03 21:42:39 -08:00
Aseem Saxena
70d2b8ab21 more work needed on prompts 2025-11-03 21:21:00 -08:00
Aseem Saxena
e12d049073 edit prompts 2025-11-03 21:01:22 -08:00
ali
a0f62428af
working version 2025-11-03 18:20:02 +02:00
ali
a0a77b59f5
skip and continue 2025-11-02 15:28:27 +02:00
Kevin Turcios
69c9938fa6 restore jedi 2025-10-31 15:22:38 -05:00
Kevin Turcios
b7c60ffa86 move jedi too 2025-10-31 12:54:44 -05:00
Kevin Turcios
ed3a339a3d pytest django 2025-10-31 12:53:20 -05:00
Kevin Turcios
9d4c396797 move pytest 2025-10-31 12:52:38 -05:00
Kevin Turcios
222f49040b remove black from dependencies 2025-10-31 12:51:35 -05:00
ali
f233017045
fixes 2025-10-31 15:43:29 +02:00
Kevin Turcios
c63390c87c formatting and static strings 2025-10-31 08:08:04 -05:00
Kevin Turcios
46f27f0f36 implement suggestion 2025-10-31 05:54:20 -05:00
Kevin Turcios
2c2a4659df pre create _ISORT_CONFIG 2025-10-31 05:52:12 -05:00
Kevin Turcios
22d5c78056 revert previous changes 2025-10-31 05:52:12 -05:00
Kevin Turcios
92f80d1d37 shared instance 2025-10-31 05:51:39 -05:00
Kevin Turcios
01feff81dc Revert "Disable sentry in aiservice for few minutes (#1954)"
This reverts commit 998a796ff6.
2025-10-31 05:14:57 -05:00
Kevin Turcios
4bac062dde Revert "Memory Profiling (Will revert later) (#1949)"
This reverts commit 867c6b6a2f.
2025-10-31 05:14:51 -05:00
Sarthak Agarwal
2a7639da9c
fix[ memory leak ] force gc (#1956)
# Pull Request Checklist

## Description
- [ ] **Description of PR**: Clear and concise description of what this
PR accomplishes
- [ ] **Breaking Changes**: Document any breaking changes (if
applicable)
- [ ] **Related Issues**: Link to any related issues or tickets

## Testing
- [ ] **Test cases Attached**: All relevant test cases have been
added/updated
- [ ] **Manual Testing**: Manual testing completed for the changes

## Monitoring & Debugging
- [ ] **Logging in place**: Appropriate logging has been added for
debugging user issues
- [ ] **Sentry will be able to catch errors**: Error handling ensures
Sentry can capture and report errors
- [ ] **Avoid Dev based/Prisma logging**: No development-only or
Prisma-specific logging in production code

## Configuration
- [ ] **Env variables newly added**: Any new environment variables are
documented in .env.example file or mentioned in description
---

## Additional Notes
<!-- Add any additional context, screenshots, or notes for reviewers
here -->
2025-10-30 23:31:49 -07:00
Kevin Turcios
0083bce47d
Merge branch 'main' into inspect-signature-issue 2025-10-30 23:26:29 -05:00
Sarthak Agarwal
f00e79f580
module level shift for isort (fix) (#1955)
Logs from Prod Server on Memory Profiling:

```
2025-10-31T04:10:59.7463674Z MEMORY_PROFILE | endpoint=/ai/optimize | mem_before=1795.8MB | mem_after=2912.8MB | delta=+1116.97MB | worker_pid=2546
2025-10-31T04:10:59.7463739Z MEMORY_ALLOCATION_1 | /tmp/8de1825367fff9f/testgen/instrumentation/instrument_new_tests.py:42 | size=+11950.1KB | count=173888
2025-10-31T04:10:59.7463798Z MEMORY_ALLOCATION_2 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:193 | size=+2738.5KB | count=58421
2025-10-31T04:10:59.7463857Z MEMORY_ALLOCATION_3 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:498 | size=+2738.4KB | count=58419
2025-10-31T04:10:59.746393Z MEMORY_ALLOCATION_4 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:499 | size=+2128.0KB | count=0
2025-10-31T04:10:59.7463989Z MEMORY_ALLOCATION_5 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:505 | size=+1016.0KB | count=11336
2025-10-31T04:10:59.7464048Z MEMORY_PROFILE | endpoint=/ai/testgen | mem_before=3996.4MB | mem_after=4106.4MB | delta=+110.06MB | worker_pid=2546
2025-10-31T04:10:59.7464106Z MEMORY_ALLOCATION_1 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:498 | size=+4456.5KB | count=95072
2025-10-31T04:10:59.7464185Z MEMORY_ALLOCATION_2 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:193 | size=+4456.5KB | count=95072
2025-10-31T04:10:59.7464242Z MEMORY_ALLOCATION_3 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:499 | size=+4112.0KB | count=-1
2025-10-31T04:10:59.7464308Z MEMORY_ALLOCATION_4 | /tmp/8de1825367fff9f/testgen/instrumentation/instrument_new_tests.py:42 | size=+2710.4KB | count=40039
2025-10-31T04:10:59.7464367Z MEMORY_ALLOCATION_5 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:505 | size=+689.9KB | count=7347
2025-10-31T04:10:59.7464657Z MEMORY_PROFILE | endpoint=/ai/testgen | mem_before=3773.1MB | mem_after=4254.5MB | delta=+481.46MB | worker_pid=2546
2025-10-31T04:10:59.7464713Z MEMORY_ALLOCATION_1 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:193 | size=+6469.4KB | count=138013
2025-10-31T04:10:59.7464771Z MEMORY_ALLOCATION_2 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:498 | size=+6469.3KB | count=138012
2025-10-31T04:10:59.7464827Z MEMORY_ALLOCATION_3 | /tmp/8de1825367fff9f/testgen/instrumentation/instrument_new_tests.py:42 | size=+5976.7KB | count=88161
2025-10-31T04:10:59.7464896Z MEMORY_ALLOCATION_4 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:499 | size=+5536.0KB | count=0
2025-10-31T04:10:59.7464953Z MEMORY_ALLOCATION_5 | /opt/python/3.12.11/lib/python3.12/tracemalloc.py:505 | size=+4056.5KB | count=42579
2025-10-31T04:10:59.7465008Z 169.254.131.1:40963 - "GET /healthcheck HTTP/1.1" 200
```
2025-10-30 21:17:49 -07:00
Kevin Turcios
07e759958a
Merge branch 'main' into inspect-signature-issue 2025-10-30 22:01:57 -05:00
Sarthak Agarwal
998a796ff6
Disable sentry in aiservice for few minutes (#1954)
# Pull Request Checklist

## Description
- [ ] **Description of PR**: Clear and concise description of what this
PR accomplishes
- [ ] **Breaking Changes**: Document any breaking changes (if
applicable)
- [ ] **Related Issues**: Link to any related issues or tickets

## Testing
- [ ] **Test cases Attached**: All relevant test cases have been
added/updated
- [ ] **Manual Testing**: Manual testing completed for the changes

## Monitoring & Debugging
- [ ] **Logging in place**: Appropriate logging has been added for
debugging user issues
- [ ] **Sentry will be able to catch errors**: Error handling ensures
Sentry can capture and report errors
- [ ] **Avoid Dev based/Prisma logging**: No development-only or
Prisma-specific logging in production code

## Configuration
- [ ] **Env variables newly added**: Any new environment variables are
documented in .env.example file or mentioned in description
---

## Additional Notes
<!-- Add any additional context, screenshots, or notes for reviewers
here -->
2025-10-30 19:23:30 -07:00
Aseem Saxena
bb5c614f70
Merge branch 'main' into inspect-signature-issue 2025-10-30 18:48:36 -07:00
Aseem Saxena
b61aa505d8 fix tests, ready to review 2025-10-30 18:46:54 -07:00
Sarthak Agarwal
867c6b6a2f
Memory Profiling (Will revert later) (#1949)
<img width="1427" height="165" alt="image"
src="https://github.com/user-attachments/assets/b3534e91-4b7d-4c25-b4c2-ac13650a8cdf"
/>

How to Test:
```
Start the server with memory profiling enabled:

  PYTHONUNBUFFERED=1 ENABLE_MEMORY_PROFILING=true uv run uvicorn aiservice.asgi:application --host 0.0.0.0 --port 8888 2>&1

  Double check the output on startup:
  🔬 Memory profiling middleware enabled
  

  Make a test request :
  curl -X POST http://localhost:8888/ai/testgen \
    -H "Content-Type: application/json" \
    -d @test_payload.json

  Expected memory profiling output:
MEMORY_PROFILE | endpoint=/ai/testgen | mem_before=160.7MB | mem_after=208.5MB | delta=+47.73MB | worker_pid=97255
  ```

---------

Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2025-10-30 18:10:02 -07:00
Aseem Saxena
c02c46d722 add tests 2025-10-30 18:04:52 -07:00
Saurabh Misra
acef19008b fix some existing test
Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
2025-10-30 17:36:23 -07:00
Saurabh Misra
58c2b58168 dont remove unnecessary comments anymore
Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
2025-10-30 17:27:57 -07:00
Saurabh Misra
42f824d569 fix code-suggester bug
Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
2025-10-30 15:23:50 -07:00
Saurabh Misra
7e59828ab0
Update django/aiservice/optimizer/postprocess.py
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
2025-10-30 15:06:29 -07:00
Saurabh Misra
2a760ccaec move imports to top level
Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
2025-10-30 14:36:08 -07:00
Saurabh Misra
4fa05c470b Add comment cleaner as a post processing step
Add comprehensive tests for `clean_extraneous_comments` and integrate it into the postprocessing pipeline

Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
2025-10-30 14:20:16 -07:00
Aseem Saxena
cded668056 fix tests now 2025-10-30 14:14:57 -07:00
Aseem Saxena
28034793ae fix tests and do more testing 2025-10-30 13:54:56 -07:00
Aseem Saxena
06ede36398 putting code snippet to show the issue 2025-10-30 13:40:05 -07:00
ali
369e59d01f
the base for demo optimization 2025-10-30 20:03:48 +03:00
Kevin Turcios
d638074313 use a weakref 2025-10-29 02:34:48 -05:00
Kevin Turcios
575ce4d419 restore comment 2025-10-29 02:34:40 -05:00
Kevin Turcios
b218c30564 create the client within the function due to uvicorn workers 2025-10-28 22:03:02 -05:00
Kevin Turcios
4b3dad897b cleanup 2025-10-28 21:28:54 -05:00
Kevin Turcios
fd8e5b84f9 remove global instance 2025-10-28 21:24:23 -05:00
Kevin Turcios
bf203343e3 use ctx manager and use a single session 2025-10-28 21:21:21 -05:00
Kevin Turcios
20dfe0bec6 add aiohttp to dependencies 2025-10-28 19:56:13 -05:00
Kevin Turcios
3c554845c1 Revert "Connection Pool Limit Setup"
This reverts commit fb2d9eb639.
2025-10-28 19:47:28 -05:00
Aseem Saxena
b178273f89
Merge branch 'main' into generated-tests-markdown 2025-10-28 12:26:53 -07:00
Sarthak Agarwal
fb2d9eb639 Connection Pool Limit Setup 2025-10-28 01:21:23 -07:00
Kevin Turcios
c661156477 trigger actions 2025-10-24 16:48:46 -05:00
Kevin Turcios
14055d12b9
Merge branch 'main' into instruct-LLM-not-to-mock-anything 2025-10-23 10:02:48 -05:00
Aseem Saxena
3ef90d0630 formatting changes 2025-10-22 21:20:20 -07:00
Aseem Saxena
66ba5cefc2 ready to review 2025-10-22 21:08:06 -07:00
Aseem Saxena
27dab7b5cd
Apply suggestion from @aseembits93 2025-10-22 17:47:47 -07:00
Aseem Saxena
9564089541 same thing for optimization review 2025-10-22 17:46:55 -07:00
Aseem Saxena
f45230880c
Merge branch 'main' into generated-tests-markdown 2025-10-22 17:41:05 -07:00
Aseem Saxena
1608a34f35 should make merging easier 2025-10-22 17:40:32 -07:00
Aseem Saxena
b0efe3929b
Apply suggestion from @aseembits93 2025-10-22 17:21:04 -07:00
Aseem Saxena
3aa88a667a
Apply suggestion from @aseembits93 2025-10-22 17:20:12 -07:00
Aseem Saxena
57d0e12c70
Apply suggestion from @aseembits93 2025-10-22 17:19:49 -07:00
Aseem Saxena
dd6dcab616
Apply suggestion from @aseembits93 2025-10-22 17:19:28 -07:00
Kevin Turcios
e5896ddc01
Merge branch 'main' into instruct-LLM-not-to-mock-anything 2025-10-22 07:07:25 +00:00
Kevin Turcios
c4ca9a3f90 be specific 2025-10-22 01:44:10 -05:00
Kevin Turcios
425c2ec1b9 Revert "don't mock" for async 2025-10-22 01:39:22 -05:00
Aseem Saxena
184bffbd8f
Feat/add optimization review details (#1910)
Co-authored-by: HeshamHM28 <HeshamMohamedFathy@outlook.com>
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
2025-10-21 22:06:12 -07:00
Saurabh Misra
d252ac4cd0 sentry capture
Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
2025-10-21 15:35:35 -07:00
Saurabh Misra
1f2871e257 dont fail when there is not refinement available
Signed-off-by: Saurabh Misra <misra.saurabh1@gmail.com>
2025-10-21 14:34:02 -07:00
Kevin Turcios
5dfbff0ed2 don't mock 2025-10-21 15:19:28 -05:00
Kevin Turcios
2011238ed2 retry on OpenAI error too 2025-10-20 15:07:49 -07:00