Skip to content

tn --filter fails with three AND conditions #1

@ArtemXTech

Description

@ArtemXTech

Bug Report

I've encountered a bug where the tn list --filter command fails to return results when combining three specific AND conditions. The issue appears when filtering on a combination of two array-based properties (projects, contexts) and one string-based property (status).

Interestingly, combinations of any two of these conditions work perfectly as expected. The query only fails when the third condition is added. This behavior persists regardless of syntax variations (e.g., using explicit :contains operators or grouping with parentheses), which points to a potential issue in the underlying query processing logic.

Steps to Reproduce

  1. Create a task with the following properties:

    ---
    status: in-progress
    contexts:
      - energy-high
      - office
    projects:
      - Newsletter Project
    ---
    
    My example task title.
  2. Run the following queries, which correctly return the task (or a subset containing it), proving the individual conditions and pairs work:

    # Returns the task, proving Array + String works
    tn list --filter "project:'Newsletter Project' AND status:in-progress"
    
    # Returns the task, proving Array + Array works
    tn list --filter "projects:contains:'Newsletter Project' AND contexts:contains:energy-high"
  3. Now, run the full query that combines all three conditions:

    tn list --filter "project:'Newsletter Project' AND status:in-progress AND contexts:energy-high"

Expected Behavior

The final command should return the single task that matches all three conditions.

Actual Behavior

The command returns no results:

✔ Found 0 tasks
ℹ No tasks found matching your criteria

Workaround

A functioning workaround is to perform a broader, two-condition query that is known to work and then pipe the JSON output to jq for the final filtering step. This demonstrates that the data exists and is accessible, but the three-part server-side filter is failing.

tn list --filter "projects:contains:'Newsletter Project' AND contexts:contains:energy-high" --json | jq '.data.tasks[] | select(.status == "in-progress")'

Thank you for this excellent tool. I hope this report is helpful in tracking down the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions