Commit graph

5474 commits

Author SHA1 Message Date
aseembits93
b7607b2b2d experimental 2026-01-21 16:29:16 -08:00
HeshamHM28
8245bb567c
Merge pull request #1111 from codeflash-ai/feat/line/profiler/vsc
[Feat]  Add a line profiler for VS Code
2026-01-20 09:38:31 -08:00
HeshamHM28
be9c4bed80
Merge branch 'main' into feat/line/profiler/vsc 2026-01-20 09:26:46 -08:00
mashraf-222
98cfe6e4f9
Merge pull request #1083 from codeflash-ai/update-extension-docs
add vsc extension docs
2026-01-20 19:23:41 +02:00
Aseem Saxena
20fbecb046
Merge branch 'main' into update-extension-docs 2026-01-20 09:07:03 -08:00
mashraf-222
23238eced1
Merge pull request #1086 from codeflash-ai/fix-path-resolution/no-gen-tests
FIX: --no-gen-tests Flag Causes Path Resolution Error with Module-Root
2026-01-20 19:06:28 +02:00
Mohamed Ashraf
130c84afc6 docs: enhance VSCode extension documentation with new images and configuration steps
- Added images for various features including CodeLens hints, optimization tab, and completed optimizations.
- Updated configuration steps to include a visual guide for selecting project configuration.
2026-01-20 13:31:45 +02:00
mashraf-222
83058129fc
Merge branch 'main' into update-extension-docs 2026-01-20 12:00:03 +02:00
mashraf-222
c9916f7d57
Merge branch 'main' into fix-path-resolution/no-gen-tests 2026-01-20 11:43:06 +02:00
Mohamed Ashraf
2388c0d46b refactor for better readability 2026-01-20 11:42:36 +02:00
Kevin Turcios
f397f4ff4a
Merge pull request #1121 from codeflash-ai/claude-MD
bring Claude.md in
2026-01-20 01:17:35 -05:00
Kevin Turcios
f35723fc0b Delete AGENTS.md 2026-01-20 01:16:50 -05:00
Kevin Turcios
0b24bed12d removed misleading 2026-01-20 01:15:55 -05:00
Kevin Turcios
3afc33a88d docs: add missing conventions to CLAUDE.md
Add naming convention, pre-commit hooks mention, and PR title guidance.
2026-01-20 01:07:16 -05:00
Kevin Turcios
1f79aa4d19 refactor: make AGENTS.md a symlink to CLAUDE.md
Consolidates agent instructions into a single source of truth.
2026-01-20 01:06:27 -05:00
Kevin Turcios
2b8dfb5d89 docs: add comprehensive CLAUDE.md for Claude Code
Consolidates project guidance including common commands, architecture overview, key patterns (Either/Result, git worktree isolation, libcst), and code style conventions.
2026-01-20 01:05:02 -05:00
Kevin Turcios
478a2524a1 chore: remove CLAUDE.md from gitignore
Allow CLAUDE.md to be tracked in version control.
2026-01-20 01:03:49 -05:00
mashraf-222
b3c8ed3cb1
Merge pull request #1101 from codeflash-ai/codeflash/optimize-pr1086-2026-01-17T11.10.22
️ Speed up method `TestFiles.get_by_original_file_path` by 702% in PR #1086 (`fix-path-resolution/no-gen-tests`)
2026-01-20 02:20:20 +02:00
mashraf-222
399baebbd9
Merge branch 'fix-path-resolution/no-gen-tests' into codeflash/optimize-pr1086-2026-01-17T11.10.22 2026-01-20 02:20:11 +02:00
mashraf-222
de20491271
Merge pull request #1102 from codeflash-ai/codeflash/optimize-pr1086-2026-01-17T11.16.14
️ Speed up method `TestFiles.get_test_type_by_original_file_path` by 73% in PR #1086 (`fix-path-resolution/no-gen-tests`)
2026-01-20 02:19:25 +02:00
HeshamHM28
621644b24d feat: add line profiler results to optimization response 2026-01-20 01:47:50 +02:00
mashraf-222
7bdef6c88f
Merge branch 'main' into fix-path-resolution/no-gen-tests 2026-01-19 16:23:16 +02:00
mashraf-222
5067d9fbae
Merge branch 'main' into update-extension-docs 2026-01-19 16:23:05 +02:00
Kevin Turcios
6b996da406
Merge pull request #1103 from codeflash-ai/limit-crosshair
fix: validate CrossHair-generated tests before use
2026-01-18 05:28:04 -05:00
Kevin Turcios
3fc755ef65 fix: avoid Windows file locking in concolic test validation
Replace NamedTemporaryFile with Path.write_text to avoid file locking
issues on Windows. Also increase subprocess timeout from 5s to 10s for
slower CI environments.
2026-01-18 05:17:03 -05:00
Kevin Turcios
9aea2c6f3c fix: validate CrossHair-generated tests before use
Run pytest --collect-only on generated tests to catch invalid output
like undefined names (SideEffectDetected), missing test functions, or
syntax errors. Logs syntax errors to Sentry.
2026-01-18 04:33:26 -05:00
Kevin Turcios
5ef98193ec
Merge pull request #1042 from codeflash-ai/add-server-cli-flag
feat: add --server flag and set local AI service timeout
2026-01-18 04:12:22 -05:00
Kevin Turcios
3fcec5ee96 Merge branch 'main' into add-server-cli-flag 2026-01-18 04:10:55 -05:00
Kevin Turcios
bce89c5ab8
Merge pull request #1028 from codeflash-ai/fix---benchmark
fix --benchmark not working on codeflash itself
2026-01-18 04:08:44 -05:00
Kevin Turcios
60453ef934
Merge branch 'main' into fix---benchmark 2026-01-18 04:07:36 -05:00
codeflash-ai[bot]
0f7ff37f21
Optimize TestFiles.get_test_type_by_original_file_path
The optimized code achieves a **72% speedup** (from 597μs to 346μs) by adding `@lru_cache(maxsize=4096)` to the `_normalize_path_for_comparison` method. This single change provides substantial performance gains because it caches the results of expensive path normalization operations.

**Why this optimization works:**

1. **Eliminates redundant I/O operations**: The line profiler shows that `path.resolve()` consumes 79.2% of the normalization time (2.07ms out of 2.61ms). This operation requires filesystem I/O to resolve symbolic links and compute absolute paths. With caching, repeated calls with the same `Path` object return instantly from memory.

2. **Exploits repetitive access patterns**: In `get_test_type_by_original_file_path`, the method normalizes both the query path AND every `original_file_path` in `test_files` during iteration. When the same paths are queried multiple times or when the same test files are checked repeatedly, the cache eliminates these redundant normalizations.

3. **Negligible memory cost**: With `maxsize=4096`, the cache can store up to 4096 path normalizations. Since each cache entry stores a path string (typically <200 bytes), total memory overhead is minimal (<1MB worst case).

**Performance characteristics from test results:**

- **Best case** (cache hits): 504-635% faster for repeated queries of the same paths (e.g., `test_returns_matching_test_type_for_equivalent_paths`)
- **Worst case** (cache misses): 10-36% slower for large-scale searches through many unique paths, where cache overhead slightly exceeds benefits
- **Typical case**: Most real-world scenarios involve querying a limited set of file paths repeatedly, making this optimization highly effective

**Key behavioral note**: The cache persists across method calls, so applications that repeatedly query the same test files will see compounding benefits over time.
2026-01-17 11:16:17 +00:00
codeflash-ai[bot]
86de3ac7be
Optimize TestFiles.get_by_original_file_path
The optimized code achieves a **702% speedup** (from 4.19ms to 522μs) by adding a single, strategic optimization: **`@lru_cache(maxsize=1024)` on the `_normalize_path_for_comparison` method**.

## Why This Works

The original line profiler shows that **98.1% of the normalization time** is spent in `path.resolve()` - an expensive filesystem operation that converts paths to absolute canonical form. When `get_by_original_file_path` searches through test files, it calls `_normalize_path_for_comparison` repeatedly for:
1. The input `file_path` (once per search)
2. Each `test_file.original_file_path` in the collection (potentially many times)

Without caching, identical paths are re-normalized on every search, repeating the expensive `resolve()` operation unnecessarily.

## The Optimization

By adding `@lru_cache(maxsize=1024)`, Python memoizes the normalization results. When the same `Path` object is normalized multiple times:
- **First call**: Performs the expensive `resolve()` operation and caches the result
- **Subsequent calls**: Returns the cached string instantly (hash table lookup)

Since `Path` objects are hashable and the function is stateless, this is a perfect caching scenario.

## Test Results Analysis

The annotated tests confirm the optimization excels when:
- **Repeated path lookups** occur: `test_large_scale_many_entries_with_single_match` shows **778% speedup** (3.73ms → 424μs) because the query path is normalized once and cached, then each comparison against 500+ entries reuses cached normalizations for stored paths
- **Multiple searches** use the same paths: Tests like `test_basic_match_with_exact_path_string` (734% faster) and `test_multiple_files_first_match_returned` (544% faster) benefit from cached normalizations across test runs
- **Cache hits dominate**: Most tests show 540-730% speedups, indicating the cache effectively eliminates repeated `resolve()` calls

The one exception (`test_resolve_exception_uses_absolute_fallback` at 9% slower) involves exception handling with custom path objects that don't benefit from caching, but this represents an edge case.

## Impact

This optimization is particularly valuable if `get_by_original_file_path` is called frequently in a hot path (e.g., during test collection, file matching, or validation loops where the same paths are queried repeatedly). The 1024-entry cache is large enough to handle typical project sizes while avoiding memory bloat.
2026-01-17 11:10:26 +00:00
mashraf-222
7ecd34009c
Merge branch 'main' into fix-path-resolution/no-gen-tests 2026-01-17 13:04:16 +02:00
Aseem Saxena
c935efecbe
Merge pull request #1055 from codeflash-ai/instrument-jit
JIT rewrite endpoint for testgen more suitable for JIT compiled functions
2026-01-16 12:39:39 -08:00
Aseem Saxena
074ad24d8b final formatting 2026-01-16 12:24:44 -08:00
Aseem Saxena
b41d387368
sentry capture 2026-01-16 12:15:38 -08:00
Aseem Saxena
01a8ebf7e7
Apply suggestions from code review 2026-01-16 12:14:40 -08:00
Mohamed Ashraf
3ba5ed394a Refactor path normalization in TestFiles model for consistency and cross-platform compatibility. Remove redundant path matching logic and enhance logging in parse_test_xml for better debugging of test type registration issues. 2026-01-16 18:53:09 +02:00
Mohamed Ashraf
3541bd9165 FIX: --no-gen-tests Flag Causes Path Resolution Error with Module-Root 2026-01-16 18:03:25 +02:00
Mohamed Ashraf
9871ce23af break down cli-reference docs to multiple pages 2026-01-16 15:20:07 +02:00
Mohamed Ashraf
03d4dcced8 update naming for CLI Reference to be Codeflash CLI 2026-01-16 15:10:09 +02:00
Mohamed Ashraf
e55a19154e add vsc extension docs 2026-01-16 14:35:24 +02:00
aseembits93
9d4fa82b52 ready to review 2026-01-15 21:25:40 -08:00
aseembits93
ee6872c317 tensorflow, jax, pytorch now working on mac metal 2026-01-15 19:04:31 -08:00
aseembits93
4d28c1779f almost ready 2026-01-15 18:58:13 -08:00
aseembits93
3a0e41861c local aiservice temporary 2026-01-15 18:03:16 -08:00
aseembits93
184b8533e0 some jit heavy functions 2026-01-15 17:37:52 -08:00
aseembits93
ecce649a7a add prompt conditionally 2026-01-15 14:43:32 -08:00
aseembits93
97c9a10bd0 cleaning up 2026-01-15 10:40:38 -08:00
Aseem Saxena
b33a53fff6
Merge branch 'main' into instrument-jit 2026-01-15 10:33:54 -08:00