feat: make metadata queryable from list, search, and query DSL#1908
feat: make metadata queryable from list, search, and query DSL#1908steveyegge merged 1 commit intosteveyegge:mainfrom
Conversation
❌ 115 Tests Failed:
View the top 3 failed test(s) by shortest run time
View the full list of 15 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
|
Easy-win summary: 162 lines of production code following established filter patterns, 358 lines of tests, zero deletions. Complements #1905 (see metadata) — this lets you filter by metadata. Follows the exact same pattern as existing label/priority/status filters in No overlap with any open PR. Builds on #1905 but has zero file overlap with it. |
|
Good feature! Two things needed before merge: (1) rebase onto current main (you're ~20 commits behind), (2) remove the |
58f05e6 to
ca318fe
Compare
|
Thanks for the review! Rebased onto current main and removed the //go:build cgo tag from metadata_filter_test.go. All squashed into one clean commit. Ready for re-review. |
Add SQL-level metadata filtering using Dolt's JSON_EXTRACT/JSON_UNQUOTE with parameterized queries. New CLI flags: --metadata-field key=value (repeatable, AND semantics) and --has-metadata-key key. Add metadata.<key> support to bd query DSL. Strict key validation prevents JSON path injection. Remove //go:build cgo tag from metadata_filter_test.go (CGO bifurcation was removed in c4010c1).
ca318fe to
5ba0887
Compare
Summary
bd listandbd searchusing Dolt'sJSON_EXTRACT/JSON_UNQUOTEwith parameterized queries--metadata-field key=value(repeatable, AND semantics) and--has-metadata-key key(existence check)metadata.<key> = "<value>"support tobd queryDSL (both filter and predicate modes)ValidateMetadataKey) prevents JSON path injectionDetails
Implements the queryability layer for the metadata system (GH#1406). This builds on the existing
types.Issue.MetadataJSON column and the visibility work in #1905.Files changed (8):
internal/types/types.go— AddMetadataFieldsandHasMetadataKeytoIssueFilterinternal/storage/metadata.go— AddValidateMetadataKey()with strict regexinternal/storage/dolt/queries.go— Generate WHERE clauses usingJSON_EXTRACT/JSON_UNQUOTEwith?paramscmd/bd/list.go— Add--metadata-fieldand--has-metadata-keyflagscmd/bd/search.go— Add same flagsinternal/query/evaluator.go— Addmetadata.prefix handling in filter and predicate modescmd/bd/metadata_filter_test.go— 7 Dolt integration tests + 14 key validation unit testsinternal/query/query_test.go— 5 evaluator metadata tests + predicate evaluation testsTest plan
TestSearchIssues_MetadataFieldMatch— single key=value filter returns matching issueTestSearchIssues_MetadataFieldNoMatch— non-matching value returns emptyTestSearchIssues_HasMetadataKey— existence check filters correctlyTestSearchIssues_MultipleMetadataFieldsANDed— multiple fields use AND semanticsTestSearchIssues_MetadataFieldInvalidKey— SQL injection attempt rejectedTestSearchIssues_HasMetadataKeyInvalidKey— invalid key rejectedTestSearchIssues_NoMetadataDoesNotMatch— issues without metadata don't matchTestValidateMetadataKey— 14 cases (valid keys, empty, spaces, hyphens, digits-first, SQL injection, JSON path chars, newlines)TestEvaluatorMetadataQueries— 5 DSL query cases including ANDTestMetadataPredicateEvaluation— predicate mode with JSON parsinggo build ./...)🤖 Generated with Claude Code