Name the filter condition's target field - #956
Open
aaronccasanova wants to merge 1 commit into
Open
aaronccasanova wants to merge 1 commit into
aaronccasanova wants to merge 1 commit into
Conversation
A filter condition is a predicate over one field of the record under evaluation: `field` names it, `operator` says how to compare, `value` is the operand. For a document, the fields are its metadata keys, and that special case is what the property was named after. Rename the property from `key` to `field` so the grammar describes itself without reference to what it happens to be applied to. Nothing else in the AST changes: `operator`, `value`, `operands`, and `operand` keep their names, and the parser rejects the old property the same way it rejects any unknown one, with the JSON path of the failing node. The rename lands before metadata filtering (tobi#910) ships, so no released version accepts `key`. Updates the README filter table and semantics, the skill, the MCP `query` tool description, the CLI help and error examples, the changelog entry, and every test that builds a condition. Assisted-by: Claude Fable 5.1 via Pi
This was referenced Sep 15, 2026
Draft
aaronccasanova
marked this pull request as ready for review
September 15, 2026 02:03
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.
Follow-up to #910, before it ships. This renames one property in the filter AST,
keytofield, so a condition reads as what it is: a predicate over a named field of whatever record is being evaluated.Nothing else in the grammar changes.
operator,value,operands, andoperandkeep their names, and the parser rejectskeythe same way it rejects any unknown property, naming the JSON path.Why
The AST in #910 is a small predicate grammar: logical groups, negation, and conditions of the form
{ <target>, operator, value }. The target was namedkeybecause, for a document, the fields a condition can test are its metadata keys. That is true, but it is a special case of what the property does, and the name leaks the special case into the grammar.The general statement is: a condition tests one field of the record under evaluation. Name the slot
fieldand the grammar describes itself without reference to what it happens to be applied to. That matters as soon as the same predicate is evaluated against something other than a document. #951 does exactly that, applying the filter grammar to individual metadata entries (whose fields arekeyandvalue) so discovery can narrow what it reports with the same language filtering uses. With the property namedkey, the entry case reads{"key":"key",...}. Withfield, it reads{"field":"key",...}, and the one-line explanation becomes:--filterevaluates documents,--matchevaluates metadata entries, same predicate either way.fieldis also the conventional name for this slot: Elasticsearch, Typesense, Vespa, and Solr all use it. Qdrant useskey. Weaviate usespath, which implies nesting #910 deliberately does not support. Meilisearch and Algolia sayattribute, the same idea with a longer word.Why now
#910 is merged but not released, so no published version of qmd has accepted
key. After the next release this becomes a breaking change to a documented, agent-facing grammar. Before it, it is a rename.What changed
src/metadata-filter.ts: theMetadataConditiontypes, the parser (allowed properties, the two validation messages that named the property), and the compiler's parameter binding. The module comment states the predicate framing.skills/qmd/SKILL.md, the MCPquerytool description, the CLI help and--filtererror example, and the CHANGELOG entry for filtering.keyis rejected as an unknown property.Typecheck, lint, and the metadata, MCP, SDK, store, and CLI suites pass under Node and Bun.