fix(server,cli,mcp): default item list to per-collection non-terminal filter (BUG-2001)#845
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BUG-2001 — stop hiding open items behind the hardcoded status allowlist
Problem
pad item list(default, no--status/--all) sent a hardcoded ~20-statusallowlist as the
statusfilter. Collections with custom statusvocabularies fell outside that list and had their open items hidden:
human-tasks: 2 of 24 shown (22todohidden)blog: onlypublishedshown (5drafting+ 13scheduledhidden)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:
ItemListParams.NonTerminal. When set,ListItems(and the FTS path)append
AND NOT (<per-collection terminal expr>), reusing the existingdoneFiltersForWorkspace+buildChildrenDoneExprmachinery. Eachcollection is evaluated against its own
terminal_options(falling backto
DefaultTerminalStatuseswhen none declared).parseItemListParamsreads?non_terminal=true.non_terminal=trueinstead of the hardcoded allowlist. The old
defaultActiveStatusFilterconstant is removed.
--status X(explicit) and--allsemantics are unchanged.Tests
internal/store/non_terminal_filter_test.go— custom-vocabulary blogcollection:
todo/drafting/scheduledappear,publishedhidden; asecond collection's
donealso hidden;--allshows everything; explicitstatus=publishedstill filters.dispatch_http_routes_test.goupdated: bare list sendsnon_terminal=true(no status allowlist);
--alldrops it; explicit--statusstill wins.Gates green:
go build ./...,go test ./...,golangci-lint run(0 issues).Codex-reviewed (caught the HTTP-route allowlist, now fixed).