- Exclude method declarations from type pattern matching
- Focus on Java 9+ module keywords for type declarations
- Prevents false positives on valid code like 'void testMethod()'
- Still catches all actual keyword usage issues
When the AI service generates Java tests, it sometimes uses Java reserved
keywords as class names or type identifiers, resulting in code that fails
to compile.
This change adds comprehensive keyword validation that checks for:
- Reserved keywords used as class names in import statements
- Reserved keywords used in class declarations
- Reserved keywords used as type names in variable declarations
The validation catches all Java reserved keywords including:
- Core keywords (class, if, while, etc.)
- Java 9+ module system keywords (provides, requires, exports, etc.)
- Reserved literals (true, false, null)
When reserved keywords are detected, the validation fails with a detailed
error message indicating which keyword was used and where, allowing the
retry mechanism to regenerate valid code.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Improve Java syntax validation to handle strings, comments, and proper
nesting
Problem:
The old validate_java_syntax() function had several limitations:
- Counted braces/parentheses inside string literals as actual code
- Counted braces/parentheses inside comments as actual code
- Did not validate bracket [] balance (arrays)
- Did not verify proper nesting order of delimiters
Solution:
- Add _remove_strings_and_comments() helper that strips string literals,
character literals, single-line comments (//), and multi-line comments
(/* */) before validation
- Add bracket [] validation alongside braces {} and parentheses ()
- Use stack-based approach to verify proper nesting order
- Handle escape sequences in strings and char literals
- Add CRITICAL Java syntax rules warning that import aliasing is invalid
(Java doesn't support "import X as Y" syntax like Python)
- Add guidelines for handling abstract classes/interfaces - use factory
methods instead of creating incomplete mock classes
- Add validation to detect invalid import aliasing syntax in generated tests
These changes prevent compilation errors in generated Java tests caused by
invalid syntax patterns that work in Python but not in Java.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add separate prompts for JUnit 4 vs JUnit 5 test generation
- Update build_java_prompt() to accept test_framework parameter
- Update testgen_java() to detect and pass the test framework
- Improve package extraction from non-standard Maven paths
- Add better logging for package/class extraction debugging
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## Summary
- Add `instrumented_perf_test` field to `OptimizationFeatures` model
- Update `log_features` function to accept and store performance
instrumented tests
---------
Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
## 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>
Remove prompt parameter from claude-mention job so Claude runs in
interactive mode and naturally receives @mention context. Move prek
formatting instructions to CLAUDE.md where Claude reads them for any
request.
- Add standalone fix-formatting.yml workflow for `/fix-formatting` command
- Uses prek's native --from-ref to only format changed files
- Properly handles prek exit codes and reports errors
- Enable show_full_output in claude-mention job for debugging
Update the prompt to explicitly mention "pre-k" and "prek" triggers
and provide step-by-step instructions for running the formatter,
committing, and pushing changes.