Kevin Turcios
0312c37631
feat: extract imported class definitions for testgen context
...
When generating tests, the LLM now receives class definitions for
types imported from project modules. This helps the LLM understand:
- Constructor signatures (avoiding incorrect argument guessing)
- Base classes (e.g., abstract classes that can't be instantiated)
- Class structure for creating proper test instances
Previously, the LLM only saw import statements like:
from mypackage.elements import Element
Now it also sees the actual class definition with constructor details.
Changes:
- Add get_imported_class_definitions() to extract class definitions
from project modules referenced in import statements
- Integrate into get_code_optimization_context() to include extracted
classes in testgen context
- Gracefully handle token limits by dropping class definitions if needed
- Add 4 unit tests covering extraction, deduplication, and filtering
2026-01-07 16:09:29 -05:00
Kevin Turcios
3048ece4da
fix: track class __init__ as helper when class is instantiated
...
Ensures LLM sees constructor signatures for proper test generation.
2026-01-01 02:25:10 -05:00
ali
b464c4d869
typo
2025-11-21 20:53:35 +02:00
ali
15d2027bb0
keep the refrenced global definitions
2025-11-21 20:10:26 +02:00
Kevin Turcios
f978a406bb
Merge branch 'main' into part-1-windows-fixes
2025-09-29 14:46:25 -07:00
Kevin Turcios
c9cfaacaaa
macos symlink shenanigans
2025-09-27 23:21:15 -07:00
Kevin Turcios
09e9d12813
update context extractor
2025-09-28 04:47:46 +00:00
Kevin Turcios
a826252277
Update test_code_context_extractor.py
2025-09-28 04:38:25 +00:00
Kevin Turcios
c6c9d9559f
few missing things
2025-09-26 16:25:28 -07:00
Kevin Turcios
4325416827
resolve paths
...
in my case, i've started using symlinks a bit more often, and the current impl causes issues, we need to resolve the symlinked path too.
2025-09-26 14:49:29 -07:00
mohammed
a7ff701309
eleminate the use of flat code for parsing
2025-08-06 22:48:03 +03:00
mohammed
989b1f30a2
unit tests fixing
2025-08-06 03:33:46 +03:00
mohammed
654a6ec251
refactoring
2025-07-26 08:49:23 +03:00
mohammed
f48c77df38
flat method rename
2025-07-25 17:50:13 +03:00
mohammed
99cd9dc706
fix tests for context extractor
2025-07-25 15:13:10 +03:00
mohammed
216eb7e794
start using markdown representation for read writable context
2025-07-16 18:48:31 +03:00
mohammed
2e394f6b8f
tests and fix global assignments imports
2025-06-29 00:23:36 +03:00
mohammed
2acda6a411
initial test files
2025-06-28 21:14:26 +03:00
Saurabh Misra
7167d2b75d
edge case for python 39
CodeFlash / Optimize new Python code (pull_request) Waiting to run
PR Labeler / label-workflow-changes (pull_request) Waiting to run
Mypy Type Checking for CLI / type-check-cli (pull_request) Waiting to run
/ Run pr agent on every pull request, respond to user comments (pull_request) Waiting to run
Lint / Run pre-commit hooks (pull_request) Waiting to run
unit-tests / unit-tests (3.10) (pull_request) Waiting to run
unit-tests / unit-tests (3.11) (pull_request) Waiting to run
unit-tests / unit-tests (3.12) (pull_request) Waiting to run
unit-tests / unit-tests (3.9) (pull_request) Waiting to run
2025-06-09 00:14:45 -07:00
Saurabh Misra
51c936f421
normalize code before hashing
2025-06-09 00:02:59 -07:00
Saurabh Misra
be1ef9b7d9
fix for test
2025-06-08 01:14:53 -07:00
Saurabh Misra
6ed93871b4
add more tests
2025-06-08 01:13:17 -07:00
Saurabh Misra
2c1314dc91
fix more tests
2025-06-08 00:41:25 -07:00
Saurabh Misra
9e14cfe7a0
fix bugs with docstring removal
2025-06-08 00:30:47 -07:00
Alvin Ryanputra
0d77ea4a0b
reworked tests
2025-04-18 20:29:38 -04:00
Alvin Ryanputra
7cda6aafa7
tests for code context extractor
2025-04-17 18:44:15 -04:00
Alvin Ryanputra
9b4ede56a3
initial implementation
2025-04-16 14:14:05 -04:00
Alvin Ryanputra
99189a7cb2
prevent nested classes/ functions from showing up in code context . helper_functions
CodeFlash / Optimize new Python code (pull_request) Waiting to run
end-to-end-test / bubble-sort-optimization-pytest-no-git (pull_request) Waiting to run
end-to-end-test / bubble-sort-optimization-unittest (pull_request) Waiting to run
Coverage E2E / end-to-end-test-coverage (pull_request) Waiting to run
end-to-end-test / futurehouse-structure (pull_request) Waiting to run
end-to-end-test / init-optimization (pull_request) Waiting to run
end-to-end-test / tracer-replay (pull_request) Waiting to run
end-to-end-test / topological-sort-optimization (pull_request) Waiting to run
Mypy Type Checking for CLI / type-check-cli (pull_request) Waiting to run
/ Run pr agent on every pull request, respond to user comments (pull_request) Waiting to run
unit-tests / unit-tests (3.10.13) (pull_request) Waiting to run
unit-tests / unit-tests (3.11.6) (pull_request) Waiting to run
unit-tests / unit-tests (3.12.1) (pull_request) Waiting to run
unit-tests / unit-tests (3.13.0) (pull_request) Waiting to run
unit-tests / unit-tests (3.9.18) (pull_request) Waiting to run
2025-04-01 15:26:40 -07:00
Alvin Ryanputra
26e5923b50
fixed a bug where helper functions called in the __init__ was not being found as a helper of helper
/ Run pr agent on every pull request, respond to user comments (pull_request) Waiting to run
unit-tests / unit-tests (3.13.0) (pull_request) Waiting to run
unit-tests / unit-tests (3.9.18) (pull_request) Waiting to run
CodeFlash / Optimize new code in this PR (pull_request) Waiting to run
end-to-end-test / bubble-sort-optimization-pytest-no-git (pull_request) Waiting to run
end-to-end-test / bubble-sort-optimization-unittest (pull_request) Waiting to run
Coverage E2E / end-to-end-test-coverage (pull_request) Waiting to run
end-to-end-test / futurehouse-structure (pull_request) Waiting to run
end-to-end-test / init-optimization (pull_request) Waiting to run
end-to-end-test / tracer-replay (pull_request) Waiting to run
end-to-end-test / topological-sort-optimization (pull_request) Waiting to run
Mypy Type Checking for CLI / type-check-cli (pull_request) Waiting to run
unit-tests / unit-tests (3.10.13) (pull_request) Waiting to run
unit-tests / unit-tests (3.11.6) (pull_request) Waiting to run
unit-tests / unit-tests (3.12.1) (pull_request) Waiting to run
2025-03-13 11:25:16 -07:00
Alvin Ryanputra
7d33b948b0
Merge branch 'refs/heads/main' into testgen-context-improvement
...
# Conflicts:
# codeflash/context/code_context_extractor.py
# tests/test_get_read_writable_code.py
2025-03-05 16:50:10 -08:00
Alvin Ryanputra
17a42a218c
Implemented testgen context retrieval. Context retrieved is the union of read-writable code and read-only code. Did some refactors to remove code_to_optimize_with_helpers, and updated tests.
2025-03-05 16:40:23 -08:00
Kevin Turcios
d28031f174
ruff check .
2025-02-28 19:21:22 -08:00
Alvin Ryanputra
f5f136ba9b
changes after code review, made logic more robust, added tests_root arg to codeflash capture, added recursive tests, renamed some files / functions
2025-02-05 16:17:41 +08:00
Alvin Ryanputra
17c354a466
takes care of docstring of new init function
2025-01-14 10:54:43 -08:00
Alvin Ryanputra
8de9cebe90
draft PR for init caching. no instrumentation checks implemented yet
2025-01-13 17:01:52 -08:00
Alvin Ryanputra
c41f710f5f
Modified code replacer to work file by file. now compatible with new code context extractor.
2025-01-08 14:56:53 -08:00
Alvin Ryanputra
57d1d979da
changed file paths in read only context to be relative to project root
2025-01-02 12:05:41 -08:00
Alvin Ryanputra
a10b399dbe
added helpers of helpers into readonly context, and refactored code slightly
2024-12-31 17:19:09 -08:00
Alvin Ryanputra
0204ef2fcb
handle token limits
2024-12-26 14:29:32 -08:00
Alvin Ryanputra
e10f13a83a
added docstring removal
2024-12-26 14:06:05 -08:00
Alvin Ryanputra
693c150262
some refactoring
2024-12-23 12:27:31 -08:00