Skip to content

bug: report --project flag with relative path (e.g. '.') never matches any entries #430

@claude

Description

@claude

Problem

uncompact report --project . always returns zero results, even when the current project has activity log entries.

In cmd/report.go:82-85, the flag value is only cleaned, not resolved to an absolute path:

var filterProject string
if reportProject != "" {
    filterProject = filepath.Clean(reportProject)
}

filepath.Clean(".") returns "." — a relative path. But activity log entries store absolute paths (e.g. /home/user/myproject) set via proj.RootDir from project.Detect. The comparison in filterEntries at cmd/report.go:131 is:

filepath.Clean(e.Project) != filterProject

filepath.Clean("/home/user/myproject") != "." is always true, so every entry is filtered out.

Steps to reproduce

  1. Run uncompact run a few times to populate the activity log.
  2. cd into that project directory.
  3. Run uncompact report --project .
  4. Observe zero results even though events exist.

Fix

Resolve the flag value to an absolute path before storing it:

if reportProject != "" {
    if abs, err := filepath.Abs(reportProject); err == nil {
        filterProject = abs
    } else {
        filterProject = filepath.Clean(reportProject)
    }
}

Location

  • cmd/report.go:82-85 (relative path not resolved)
  • cmd/report.go:131 (comparison using the unresolved path)

Note: logsHandler and statsHandler correctly call project.Detect (which calls os.Getwd() internally) to resolve the project path, so they are not affected. Only reportHandler has this bug.

@claude please implement this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions