Skip to content

Bug: Tilde (~) in project_path not expanded, causes silent empty results #154

Closed

Description

@rahlk

Description

When passing a path containing ~ (e.g., "~/workspace/project") to CLDK.analysis(), the tilde is not expanded. This causes the analyzer to interpret ~ as a literal directory name relative to the current working directory, leading to:

  1. Silent empty results (empty PyApplication with no classes/methods)
  2. Creation of spurious directories like ./~/workspace/.../.codeanalyzer/

Reproduction

from cldk import CLDK

pa = CLDK("python").analysis("~/workspace/codellm-devkit/codeanalyzer-python")
pa.get_application_view()  # Returns empty PyApplication

Root Cause

Path("~/...") does not expand ~ — it must be explicitly expanded via .expanduser(). The SDK was passing the path directly to Path() without expansion in:

  • cldk/core.py — analysis() method
  • cldk/analysis/python/codeanalyzer/codeanalyzer.py — PyCodeanalyzer.__init__()

Expected Behavior

  • Tilde should be expanded to the user's home directory
  • Invalid/non-existent paths should raise a clear error, not return empty results

Fix

Call .expanduser().resolve() on path inputs and validate the directory exists before proceeding with analysis.

Fixed in: #153

Activity

  1. rahlk commented on Aug 3, 2026

    @rahlk
    CollaboratorAuthor

    Closing as fixed. project_path is now expanded before use: cldk/core.py:80 does Path(project_path).expanduser().resolve(), and the Python analyzer path does the same for the project dir, cache dir and analysis-json path (cldk/analysis/python/codeanalyzer/codeanalyzer.py:176,187,188). A ~-prefixed path no longer resolves to a non-existent directory, so the silent-empty-results failure is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions