You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vibed/nbd/.beans/nbd-4w8z--exclude-done-tick...

4.7 KiB

title status type priority created_at updated_at blocked_by
Exclude done tickets from nbd list by default completed feature high 2026-03-10T23:30:30Z 2026-03-10T23:30:32Z
nbd-p9na

Summary

Change nbd list to hide done tickets by default. Users must explicitly opt in via --filter status=done or --filter status=* to see completed tickets.

This is a breaking change in default behavior.

Depends on: --filter wired into list (ticket 887344).

Current behaviour

nbd list shows ALL tickets regardless of status.

New behaviour

Command Shows
nbd list todo + in_progress only (done excluded)
nbd list --filter status=done done only
nbd list --filter status=* all tickets (all statuses)
nbd list --filter status=todo --filter status=in_progress todo and in_progress
nbd list --filter type=bug non-done bug tickets (done still excluded)
nbd list --filter type=bug --filter status=* all bug tickets including done

The key rule: if the user provides no status filter key, done tickets are excluded. If the user provides any --filter status=... argument, the explicit status filter is used as-is with no implicit exclusion.

Implementation (src/main.rs)

In cmd_list, after parsing the filter and loading tickets, apply the logic:

let filter = filter::parse_filters(&filter_args)?;
let tickets = list_tickets(&root).await?;

let tickets: Vec<Ticket> = tickets
    .into_iter()
    .filter(|t| {
        // If no status filter was provided by the user, exclude done tickets.
        let status_ok = if filter.has_status_filter() {
            // User expressed intent about status: use their filter.
            filter.matches_status(t)
        } else {
            // Default: hide done tickets.
            t.status \!= Status::Done
        };

        // Apply remaining filter keys (type, priority, title) regardless.
        status_ok && filter.matches_except_status(t)
    })
    .collect();

This requires two additional methods on TicketFilter (add to src/filter.rs):

/// Returns true if the ticket's status matches any of the status patterns.
/// Caller is responsible for only calling this when `has_status_filter()` is true.
pub fn matches_status(&self, ticket: &Ticket) -> bool;

/// Returns true if the ticket matches all non-status filter groups (type, priority, title).
/// The status group is intentionally excluded so callers can handle it separately.
pub fn matches_except_status(&self, ticket: &Ticket) -> bool;

CLI help text update

Update the List variant doc comment:

/// List tickets sorted by priority (highest first).
///
/// By default, tickets with status `done` are excluded. Use
/// `--filter status=*` to include all tickets, or
/// `--filter status=done` to show only completed tickets.
List {
    #[arg(long = "filter", value_name = "KEY=VALUE")]
    filter: Vec<String>,
},

Existing tests that need updating

The integration test list_shows_created_tickets creates two tickets with default status (todo) and asserts both appear in nbd list. This test is unaffected because the default tickets are not done. However, any future test that creates a ticket and immediately lists without marking it done will still work.

Check: is there any existing test that creates a done ticket and expects it in nbd list? If so, update that test to use --filter status=done or --filter status=*.

New integration tests to add (tests/integration.rs)

  • Create two tickets: one todo, one done. nbd list shows only the todo one.
  • Create two tickets: one todo, one done. nbd list --filter status=done shows only the done one.
  • Create two tickets: one todo, one done. nbd list --filter status=* shows both.
  • Create 3 tickets: bug/todo, bug/done, task/todo. nbd list --filter type=bug shows only bug/todo (done excluded by default). nbd list --filter type=bug --filter status=* shows both bug tickets.
  • nbd list --json does not include done tickets (verify JSON array length).
  • nbd list --filter status=* --json includes done tickets.

README update

Update the "List all tickets" section in README.md:

### List all tickets

```sh
nbd list                          # excludes done tickets
nbd list --filter status=*        # all tickets including done
nbd list --filter status=done     # only completed tickets
nbd list --filter type=bug        # non-done bug tickets
nbd list --json

## Files touched

- `src/main.rs` — `cmd_list` implementation and `List` help text
- `src/filter.rs` — `matches_status`, `matches_except_status` methods
- `src/tests.rs` — unit tests for new filter methods
- `tests/integration.rs` — new tests, update any affected existing tests
- `README.md` — updated usage section