Skip to content

fix(server,cli,mcp): default item list to per-collection non-terminal filter (BUG-2001)#845

Merged
xarmian merged 1 commit into
mainfrom
fix/bug-2001-non-terminal-filter
Jul 7, 2026
Merged

fix(server,cli,mcp): default item list to per-collection non-terminal filter (BUG-2001)#845
xarmian merged 1 commit into
mainfrom
fix/bug-2001-non-terminal-filter

Conversation

@xarmian

@xarmian xarmian commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

BUG-2001 — stop hiding open items behind the hardcoded status allowlist

Problem

pad item list (default, no --status/--all) sent a hardcoded ~20-status
allowlist as the status filter. Collections with custom status
vocabularies
fell outside that list and had their open items hidden:

  • live human-tasks: 2 of 24 shown (22 todo hidden)
  • live blog: only published shown (5 drafting + 13 scheduled hidden)

MCP inherited the bug two ways — the ExecDispatcher runs the CLI (same
default), and the HTTP route table mirrored the same allowlist in
mapItemList. An agent asking "what's open" got a wrong answer.

Fix

A server-side, per-collection non-terminal filter:

  • New ItemListParams.NonTerminal. When set, ListItems (and the FTS path)
    append AND NOT (<per-collection terminal expr>), reusing the existing
    doneFiltersForWorkspace + buildChildrenDoneExpr machinery. Each
    collection is evaluated against its own terminal_options (falling back
    to DefaultTerminalStatuses when none declared).
  • parseItemListParams reads ?non_terminal=true.
  • The CLI default and both MCP dispatch paths now send non_terminal=true
    instead of the hardcoded allowlist. The old defaultActiveStatusFilter
    constant is removed.

--status X (explicit) and --all semantics are unchanged.

Tests

  • internal/store/non_terminal_filter_test.go — custom-vocabulary blog
    collection: todo/drafting/scheduled appear, published hidden; a
    second collection's done also hidden; --all shows everything; explicit
    status=published still filters.
  • dispatch_http_routes_test.go updated: bare list sends non_terminal=true
    (no status allowlist); --all drops it; explicit --status still wins.

Gates green: go build ./..., go test ./..., golangci-lint run (0 issues).
Codex-reviewed (caught the HTTP-route allowlist, now fixed).

… filter (BUG-2001)

The CLI's default `pad item list` (no --status/--all) sent a hardcoded
~20-status allowlist as the status filter. Collections with custom status
vocabularies (blog: drafting/scheduled; human-tasks: todo) fell outside the
list and had their open items hidden. MCP inherited the same bug via the
CLI default and the HTTP route table's mirrored allowlist.

Replace it with a server-side `non_terminal` filter: ItemListParams.NonTerminal
resolves each collection's terminal set from its schema's terminal_options
(falling back to DefaultTerminalStatuses) and keeps only items NOT in that
set — reusing the existing doneFiltersForWorkspace + buildChildrenDoneExpr
machinery, applied in both the normal and FTS query paths.

The CLI default and both MCP dispatch paths (ExecDispatcher via the CLI,
HTTPHandlerDispatcher via mapItemList) now send non_terminal=true. --status X
and --all semantics are unchanged.
@xarmian xarmian merged commit 0aa431f into main Jul 7, 2026
4 checks passed
@xarmian xarmian deleted the fix/bug-2001-non-terminal-filter branch July 7, 2026 20:45
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.

1 participant