Found by the Haitian attachment-search browser test. Every attachment
lookup of the global search read the attachment's card from a top-level
cardId, which attachments do not have - they name it in meta.cardId - so
has:attachment, a free-text match on a filename and attachment:<name>
found no card at all; tests/databaseQueryBounds.test.cjs had pinned that
projection. The negated predicates (has:-attachment, has:-checklist)
were ignored and returned the cards WITH one. Soft-deleted attachments
do not count for has:attachment.
Thanks to xet7 !
Scope attachment and checklist discovery to authorized boards, project only fields consumed by filename search, retain only the requested text-ranking window in memory, page Due Cards without truncating the result set, and add compound indexes for lazy and due-card query shapes.\n\nThanks to xet7 !