Commit graph

6200 commits

Author SHA1 Message Date
Kevin Turcios
29255a6dd5 restore debug data 2026-02-06 01:41:02 -05:00
Sarthak Agarwal
f82bb41c19
Merge branch 'main' into observabilityv2 2026-02-06 01:19:48 +05:30
Sarthak Agarwal
98fb2d1579
Revert "CF-1041 observability v2 " need more changes and testing (#2375)
Reverts codeflash-ai/codeflash-internal#2329
2026-02-06 01:18:17 +05:30
Kevin Turcios
07d33edd9f
CF-1041 observability v2 (#2329)
introducing this due to pain points in V1, not a complete rewrite, based
off v1

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
2026-02-05 14:08:02 -05:00
Kevin Turcios
56837b98ab fix: use Map to track call indices by type instead of filtering on each iteration 2026-02-05 13:56:27 -05:00
Kevin Turcios
1f8f70f441 fix: use Map to track call indices by type instead of filtering on each iteration 2026-02-05 13:48:03 -05:00
Kevin Turcios
e02e4e524a
Update js/cf-webapp/src/components/observability/timeline-page-view.tsx
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
2026-02-05 13:38:56 -05:00
Kevin Turcios
c38500c7f0 chore: remove unnecessary comments from observability components 2026-02-05 13:34:11 -05:00
Kevin Turcios
1df2b1b67b fix: escape curly braces in JS import examples for Python .format()
The import path examples `{ fn }` were being interpreted as Python
format placeholders, causing KeyError in build_javascript_prompt().
2026-02-05 13:16:11 -05:00
Kevin Turcios
45a48f10ac fix: address critical security and logic issues
- Remove /observability from ignorePaths to restore authentication
- Restore conditional obs_context logic when call_sequence is None
2026-02-05 13:14:57 -05:00
Kevin Turcios
7fc8e915fe perf(observability): optimize rendering and add loading state
- Add RAF throttling to scroll handler to prevent excessive re-renders
- Memoize inline style objects in CandidateContent component
- Parallelize function search across files with Promise.all
- Remove useSearchParams hook to stabilize callback dependencies
- Add loading.tsx for Next.js route streaming
2026-02-05 13:14:57 -05:00
Kevin Turcios
f51f1b639f feat(observability): improve ranking section with code display and badges
- Add full-width code blocks in ranking section for better review
- Add badges matching main: Rank #X (indigo), Best (emerald), Used for PR (blue)
- Filter out unknown candidates from ranking display and re-rank sequentially
- Strip markdown code block wrappers from displayed code
- Fix refinement parent lookup to include other refinements
- Fall back to original code when refinement parent not found
- Make search bar non-sticky (scrolls with content)
- Add temporary auth bypass for /observability testing
2026-02-05 13:14:57 -05:00
Kevin Turcios
b495d5858d refactor: rename observability2 to observability as the default
- Rename src/app/observability2/ to src/app/observability/
- Rename src/components/observability2/ to src/components/observability/
- Update all route references from /observability2 to /observability
- Update all import paths from observability2 to observability
2026-02-05 13:14:56 -05:00
Kevin Turcios
bac8acdc98 refactor: remove old observability implementation, keep only observability2
Delete all legacy observability code and consolidate on observability2:
- Remove src/app/observability/ routes and src/app/trace/ route
- Remove src/components/observability/ and src/components/trace/
- Remove src/lib/observability-utils.ts and observability-response-parse.ts
- Move copy-button and info-icon components to observability2
- Update middleware, sidebar, and conditional-layout to use /observability2
2026-02-05 13:14:56 -05:00
Kevin Turcios
3b103ab87d changes. 2026-02-05 13:14:30 -05:00
Kevin Turcios
0d04617f7c feat(observability2): add tree-sitter parsing and summary view
- Add tree-sitter for accurate Python function detection and highlighting
- Add summary-only view toggle for test generation section
- Clean up timeline view and types
2026-02-05 13:14:30 -05:00
Kevin Turcios
2b634711cc feat(observability2): add scrolling timeline page view with sci-fi effects
- Replace LLMCallsTimeline with new TimelinePageView component
- Add scroll-based section tracking with sticky timeline dot
- Implement sci-fi pop-out animations when sections become active
- Add unified diff view with GitHub-style coloring for candidates
- Auto-expand code blocks when section is active (70vh max height)
- Collapse test sections by default
- Remove orphaned components (llm-calls-timeline, scrolling-timeline, timeline-utils)
- Update exports in index.ts
2026-02-05 13:14:30 -05:00
Kevin Turcios
75045207f8 feat(observability2): improve timeline display and function extraction
- Fix LP candidate ordering to display in numerical order (1-6)
- Add "Reverts to original" warning badge for refined candidates
- Rename "test_generation" section to "Generated Tests"
- Reorder sections: Generated Tests now appears before optimization candidates
- Collapse unit tests by default (only candidates expanded)
- Fix Function to Optimize section to work without filePath
- Prioritize metadata.function_to_optimize for function name extraction
2026-02-05 13:14:29 -05:00
Kevin Turcios
ebb3a5c7a5 feat(observability2): add response debug toggle and collapse instrumented tests
- Add Response button in debug dialog to toggle raw LLM response view
- Collapse Instrumented Behavior Test and Instrumented Performance Test by default
2026-02-05 13:14:29 -05:00
Kevin Turcios
fba943bb92 fix: resolve ESLint warnings and errors
Replace <img> with Next.js <Image> component for optimized loading,
remove unused imports, fix TypeScript any type, and add eslint-disable
comments for intentional hook dependency patterns.
2026-02-05 13:14:29 -05:00
Kevin Turcios
25ab6c0142 chore: add .planning to gitignore and update dependencies
- Add .planning/ directory to gitignore
- Add postcss-import as explicit dev dependency for CSS imports
2026-02-05 13:14:29 -05:00
Kevin Turcios
db8da32bef feat(observability2): polish icons, transitions, and remove gradients
Phase 4 of visual redesign - final consistency pass:

- Add ICON_STANDARDS.md documenting lucide-react conventions
- Add icon-example.tsx with standard sizing patterns
- Update switch.tsx with smooth 200ms transitions
- Update tabs.tsx with consistent transition timing
- Remove gradient backgrounds from review-optimizations pages

All purple/blue gradients removed, consistent icon sizes (16px/20px),
smooth transitions (150ms hover, 200ms state changes)
2026-02-05 13:14:29 -05:00
Kevin Turcios
5441ffa800 feat(observability2): apply design system to trace components
Phase 3 of visual redesign - refine trace-specific visualization:

- Create custom zincDarkTheme for syntax highlighting
- Update trace-summary with flat zinc metric cards
- Restyle code-context-section with zinc hierarchy
- Apply zinc styling to function-to-optimize-section
- Clean decorative elements from llm-calls-timeline
- Establish clear visual hierarchy in errors-section
- Update trace-search with zinc input styling
- Migrate page.tsx and layout.tsx to zinc colors

Requirements: TRC-01 through TRC-05
2026-02-05 13:14:29 -05:00
Kevin Turcios
021ed80988 feat(observability2): restyle core UI components with zinc palette
Phase 2 of visual redesign - update base components for new design system:

- Card: flat bordered panels with zinc-900 bg, zinc-800 borders
- Button: zinc color variants with consistent focus rings
- Input: dark mode styling with zinc-950 bg, zinc-700 borders
- Select: dropdown with zinc palette and icon standardization
- Table: hover states, dense layout, monospace headers
- Badge: flat styling with rounded-sm corners
- Separator: zinc-800 dividers

Requirements: LAY-03, LAY-04, CMP-01 through CMP-04
2026-02-05 13:14:29 -05:00
Kevin Turcios
c4d1dcf1ac feat(observability2): establish design system foundation
Phase 1 of visual redesign - create token system for consistent theming:

- Add tokens.css with zinc color scale (50-950) and semantic colors
- Add typography.css with JetBrains Mono for technical data
- Add spacing.css with 8px grid system
- Update globals.css to import all token files
- Configure tailwind.config.ts with token integration
- Load JetBrains Mono font in layout.tsx

Requirements: CLR-01 through CLR-05, LAY-01, LAY-02, TYP-01 through TYP-03
2026-02-05 13:14:29 -05:00
Kevin Turcios
2f99261cb0 cleanup 2026-02-05 13:14:29 -05:00
Kevin Turcios
05225ab2d8 one more step 2026-02-05 13:14:29 -05:00
Kevin Turcios
5a18276d31 refactor: flatten LLM calls UI and add debug dialogs
Replace dropdown structure with flat card layout for all call types.
Each item now shows directly with a header containing title, ranking
badges, and a debug button. LLM call details (metrics, tokens, prompts,
response) are moved into a reusable debug dialog component.
2026-02-05 13:14:29 -05:00
claude[bot]
5bbc4ea357 fix: resolve critical bugs in observability v2
- Fix operator precedence in language detection (llm-calls-timeline.tsx:65)
- Fix AttributeError by checking function_to_optimize is not None before accessing attributes (testgen.py:260)

Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
2026-02-05 13:14:29 -05:00
Kevin Turcios
85c0c57d2e dialog thing 2026-02-05 13:14:29 -05:00
Kevin Turcios
cdf824d55c Revert "feat: add context window usage visualization to token distribution"
This reverts commit 83b6068b10ab3016c5c2755d569b8a2b99b2e9e3.
2026-02-05 13:14:29 -05:00
Kevin Turcios
95894b7ba5 feat: add context window usage visualization to token distribution
- Create model-context-windows.ts with model info and context limits
- Show context window usage bar when model is recognized
- Display warning when approaching (>75%) or near (>90%) context limit
- Add tooltips showing exact token counts
- Supports GPT-4.1, GPT-5-mini, GPT-4o, Claude Sonnet/Haiku models
2026-02-05 13:14:29 -05:00
Kevin Turcios
78d4e994da fix: move ranking badges to LLM call summary line
- Display Rank #N, Best, and Used for PR badges inline with model name
- Remove separate banner from candidate cards
- Matches V1 badge placement for consistency
2026-02-05 13:14:29 -05:00
Kevin Turcios
d5e02b2a15 feat: add prominent ranking banner for best candidates
- Add colored banner at top of candidate cards showing rank, best, and used-for-PR
- Banner uses emerald for best candidates, indigo for ranked candidates
- Move badges from inline to dedicated banner for better visibility
- Apply same treatment to refinement candidates
2026-02-05 13:14:29 -05:00
Kevin Turcios
1c9bcb2023 feat: add refinement candidate support to observability2
- Extract refinement candidates (source=REFINE) from optimizations_origin
- Pass refinementCandidates to LLMCallsTimeline component
- Map refinement LLM calls to their generated candidates
- Display refinement candidates with amber theme and parent reference
- Show diff comparing refined code to parent candidate code
- Support ranking/best/used-for-PR badges on refinement candidates
2026-02-05 13:14:29 -05:00
Kevin Turcios
afc29e9ce0 feat: add total tokens and candidates count to trace summary
- Calculate totalTokens across all LLM calls
- Display tokens and candidates count in TraceSummary
- Update grid layout to accommodate 6 metrics on larger screens
2026-02-05 13:14:29 -05:00
Kevin Turcios
c427b22ff1 fix: remove "No Errors Detected" message from observability2
Return null instead of rendering a celebratory card when there are
no errors. The trace summary already indicates success status.
2026-02-05 13:14:29 -05:00
Kevin Turcios
8fd63f46dd feat: add ranking badges and explanation to optimization candidates
- Show Rank #N badge for ranked candidates
- Show "Best" badge for top-ranked candidate
- Show "Used for PR" badge when best candidate was used for pull request
- Highlight best candidate with green border/background
- Add ranking explanation section at the bottom of timeline
2026-02-05 13:14:28 -05:00
Kevin Turcios
6a8fda9f37 Update package-lock.json 2026-02-05 13:14:28 -05:00
Kevin Turcios
773080747b feat: make Function to Optimize section collapsible, expanded by default 2026-02-05 13:14:28 -05:00
Kevin Turcios
1ad7313f2c feat: make diff view the default for optimization candidates 2026-02-05 13:14:28 -05:00
Kevin Turcios
519a8f5f9d fix: hide "no newline at end of file" messages in diff view 2026-02-05 13:14:28 -05:00
Kevin Turcios
6c1e3cdfa6 fix: hide blank line changes in diff view
Filter out empty line additions/deletions (formatting-only changes)
to keep the diff focused on actual code changes.
2026-02-05 13:14:28 -05:00
Kevin Turcios
7a97308c68 fix: style "no newline" diff messages as faded metadata
Handle "\ No newline at end of file" messages with italic gray styling
instead of showing them as regular code lines.
2026-02-05 13:14:28 -05:00
Kevin Turcios
f39497a700 feat: add GitHub-style diff viewer with colored backgrounds
Replace basic syntax highlighting with custom DiffView component that shows:
- Green background for additions with + indicator
- Red background for deletions with − indicator
- Blue background for hunk headers
- Left border color coding for quick visual scanning
2026-02-05 13:14:28 -05:00
Kevin Turcios
0804296a41 fix: clean up diff output by stripping header lines
Remove the file header lines from unified diff display, keeping only
the hunk headers and actual changes for a cleaner view.
2026-02-05 13:14:27 -05:00
Kevin Turcios
4dae4b3a35 feat: add code/diff toggle for optimization candidates
Add ability to switch between full optimized code view and unified diff
view for each optimization candidate, making it easier to understand
what changes were made during optimization.
2026-02-05 13:14:27 -05:00
Kevin Turcios
130e3507bd feat: add Function to Optimize section to observability2
Display the function being optimized prominently at the top of the page
with syntax highlighting, function name badge, file path, and line count.
2026-02-05 13:14:27 -05:00
Kevin Turcios
759ea42d7e feat: add instrumented_perf_test support and syntax highlighting to observability2
- Add instrumented_perf_test field display in LLM calls timeline
- Add syntax highlighting with react-syntax-highlighter for all code blocks
- Parse markdown code blocks to extract filename and show clean code
- Create reusable CodeFileDisplay component for consistent code rendering
- Update code-context-section to parse files and display them separately
- Default code sections to expanded when viewing optimizations
2026-02-05 13:14:27 -05:00
Kevin Turcios
734e5eb408 remp 2026-02-05 13:14:27 -05:00