Files
vibe-kanban/frontend
Louis Knight-Webb 354c6c05ac Safely parse logs (#82)
* Both executors have been successfully updated to handle log parsing failures gracefully. The changes ensure that:

1. **Invalid JSON lines** are captured as raw text entries instead of causing the entire parsing to fail
2. **Valid JSON with unexpected structure** is captured as unrecognized JSON entries with the raw content preserved
3. **Expected JSON formats** continue to be parsed normally

The key changes made:
- Wrapped JSON parsing in a `match` statement to handle parse errors
- Added logic to track whether JSON was successfully processed
- Added fallback entries for both invalid JSON and unrecognized valid JSON
- All raw/unrecognized content is stored as `SystemMessage` entries with descriptive prefixes

* fixes

* The changes are complete! I've modified the `normalize_logs` method in [`backend/src/executors/amp.rs`](file:///private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vk-7a88-improve-pa/backend/src/executors/amp.rs#L116-L227) to ignore the specific JSON types you mentioned:

- `{"type":"initial",...}`
- `{"type":"token-usage",...}`
- `{"type":"state",...}`

The parser now uses a match statement to handle different JSON types, setting `processed = true` for the ignored types, which prevents them from being added as "Unrecognized JSON" entries. The build passes successfully.

* Perfect! I have successfully implemented both requested improvements to the parsing of normalized logs for Claude:

## Summary of Changes

**1. Ignoring `{"type":"result",...}` JSON entries:**
- Modified both [`ClaudeExecutor::normalize_logs`](file:///private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vk-60e3-improve-pa/backend/src/executors/claude.rs#L221-L236) and [`AmpExecutor::normalize_logs`](file:///private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vk-60e3-improve-pa/backend/src/executors/amp.rs#L227-L242) to skip JSON entries with `type: "result"`
- These entries are now completely ignored and won't appear in the normalized logs

**2. Converting absolute paths to relative paths:**
- Added `make_path_relative` helper functions to both Claude and Amp executors
- Updated path extraction logic in `extract_action_type` methods to use relative paths for file operations
- Updated `generate_concise_content` methods to display relative paths for directory listings
- Paths are now shown relative to the project root, making them more concise

**3. Added comprehensive tests:**
- Created tests to verify that `{"type":"result",...}` entries are properly ignored
- Created tests to verify that absolute paths are converted to relative paths
- All tests pass successfully

The changes maintain backward compatibility while improving the conciseness and readability of the normalized logs.

* Resolve paths in claude

* fmt

* Clippy
2025-07-08 01:13:36 +01:00
..
2025-06-17 21:41:57 -04:00
2025-07-08 01:13:36 +01:00
2025-06-25 09:36:07 +01:00
2025-06-25 09:36:07 +01:00
2025-06-14 15:14:08 -04:00
2025-06-17 20:36:25 -04:00
2025-07-04 11:11:45 +02:00
2025-07-04 11:11:45 +02:00
2025-06-14 15:14:08 -04:00
2025-06-14 16:26:48 -04:00
2025-06-14 15:14:08 -04:00
2025-07-04 11:11:45 +02:00