Skip to content

fix(sensor): support VS Code and multi-IDE storage paths in ClineParser - #145

Merged
barisozbas merged 2 commits into
uber:mainfrom
vschs007:fix/sensor-cline-vscode-storage
Sep 29, 2026
Merged

barisozbas merged 2 commits into
uber:mainfrom
vschs007:fix/sensor-cline-vscode-storage

Conversation

@vschs007

@vschs007 vschs007 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Related issue: N/A

What changed?

  • Multi-IDE path discovery: Expanded ClineParser.BASE_PATHS to discover task history across Visual Studio Code (Code), Cursor, VS Code Insiders, VSCodium, and Windsurf across macOS, Linux, and Windows.
  • Multi-directory aggregation: Updated parse_all() to scan and aggregate tasks across all existing candidate directories on the endpoint, with session-level deduplication (session_id).
  • Per-directory failure isolation: Inaccessible or invalid editor roots record file_read_error and do not discard sessions from healthy editors. Inaccessible input is not classified as missing input.
  • Flexible initialization: Added an optional base_path argument to ClineParser.__init__, matching the constructor signature of other parsers (e.g., CopilotParser, GeminiParser).
  • Explicit path compatibility: Constructor overrides and direct parser.base_path assignments restrict collection to the selected directory, including an installed editor or the initially detected path.
  • Cross-platform path test fixes: Normalized path assertions in TestPlatformPathCoverage using as_posix() so that tests pass reliably on Windows and POSIX systems.
  • Hermetic uninstalled test: Isolated Path.exists in test_first_candidate_used_when_none_exist so unit tests never fail when an agent happens to be installed on the local test machine.
  • Unit test coverage: Added tests in TestClineParser covering custom base path overrides, multi-editor coverage in BASE_PATHS, and multi-directory task aggregation.
  • Logging integration: Resolved the conflict with current main while retaining the shared sensor logger, so console levels and opt-in runtime logs apply to Cline collection.
  • Documentation: Added a dedicated ### Cline (Claude Dev) documentation section to Sensor/README.md detailing default task storage paths across operating systems.

Why?

Cline (saoudrizwan.claude-dev) is primarily a Visual Studio Code extension with widespread adoption across developer environments. Previously, _CLINE_TASKS_SUFFIX was hardcoded exclusively to Cursor's global storage path (Cursor/User/globalStorage/saoudrizwan.claude-dev/tasks), leaving standard VS Code users unobserved and creating a telemetry blind spot for enterprise security monitoring.

How did you test it?

  1. Unit tests: Ran the complete Sensor test suite via uv run pytest tests/ -v: 470 passed, 0 failed.
  2. Multi-IDE verification: Verified test_parse_all_discovers_tasks_across_multiple_existing_editors and test_cline_base_paths_covers_multiple_editors.
  3. Linting: Passed uv run ruff check adr_sensor/parsers/cline_parser.py tests/test_parsers.py with 0 errors.
  4. Distribution build: Verified package packaging via uv build.
  5. Post-merge validation (September 29, 2026): 527 Sensor tests passed on Python 3.9 and 527 on Python 3.12, using frozen dependencies on macOS. Added 21 synthetic regression cases for root failures before/after healthy roots, observer preservation, diagnostics, explicit overrides, deduplication, and quiet/runtime logging. An independent 12-case reproduction suite also passed. Source/test lint, changed-file formatting, package build, and pre-push validation passed.

Potential risks

Low. Changes are backward-compatible and additive. If no Cline directories exist on the host, the parser preserves historical behavior by recording an input_missing diagnostic.

vschs007 and others added 2 commits September 29, 2026 00:55
Cline (saoudrizwan.claude-dev) was originally parsed only from Cursor's global storage ('Cursor/User/globalStorage/saoudrizwan.claude-dev/tasks'), leaving standard Visual Studio Code users unobserved by ADR Sensor.

- Support task directories across VS Code, Cursor, VS Code Insiders, VSCodium, and Windsurf on macOS, Linux, and Windows.
- Enable ClineParser to scan and aggregate tasks across all existing candidate directories, while preserving session deduplication.
- Add optional base_path constructor argument for consistent parser API.
- Normalize path assertions in TestPlatformPathCoverage using as_posix() for cross-platform Windows compatibility and hermetic uninstalled tests.
- Add unit tests for multi-IDE task discovery and document Cline storage locations in Sensor/README.md.
Preserve shared sensor logging while retaining multi-editor discovery. Isolate unreadable editor roots so healthy sessions remain available, preserve explicit base_path overrides, and cover parser/observer recovery and runtime logging with synthetic regression tests.

@barisozbas barisozbas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Hardened and reviewed.

@barisozbas
barisozbas merged commit 6a7e0e2 into uber:main Sep 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants