Skip to content

properties literal#1966

Merged
whutchinson98 merged 7 commits intomainfrom
hutch/properties-literal
Mar 16, 2026
Merged

properties literal#1966
whutchinson98 merged 7 commits intomainfrom
hutch/properties-literal

Conversation

@whutchinson98
Copy link
Copy Markdown
Member

macro-cy6PBPLDtRh31ivFR2vUc-properties-filtering-in-soup

… in AST

Add PropertiesLiteral struct and PropertyMatchValue enum to support
filtering items by their entity_properties values. Add PropertyFilter
to EntityFilters as the user-facing API, with expansion logic that
converts property filters into the AST representation.

Supports SelectOption (UUID match via ? operator) and EntityRef
(entity_id match via @> operator) value matching strategies.
Add build_properties_filter() that generates EXISTS subqueries against
entity_properties table. Supports SelectOption matching (? operator)
and EntityRef matching (@> operator). The filter is applied in the
document TopItems clause, leveraging the existing PREFIX CTE for
access control via UserAccessibleItems.
Add 7 unit tests for PropertiesLiteral AST expansion covering:
- Single select option, multiple options (OR), entity ref matching
- Multiple property filters (AND), mixed option+entity_ref (OR)
- Empty filters produce no AST

Add 5 integration tests for dynamic soup query with property filters:
- Filter by single select option (Priority = Low)
- Filter matching one document (Status = Completed)
- AND-ing multiple property filters
- No-match filter returns no documents
- OR-ing multiple option values within a single filter

Also fix EntityFilters::is_empty to check individual PropertyFilter
emptiness rather than just vec length.
@whutchinson98 whutchinson98 requested a review from a team as a code owner March 16, 2026 15:42
@ghost
Copy link
Copy Markdown

ghost commented Mar 16, 2026

Parameterize build_properties_filter with entity_id_sql so it generates
the correct table alias for each clause: d.id for documents, c.id for
chats, p.id for projects. Previously only documents were filtered.
Make entity_type Option<String> on both PropertyFilter and
PropertiesLiteral. When None, the entity_type clause is omitted from
the EXISTS subquery, allowing a single filter to match properties
across all entity types (TASK, DOCUMENT, PROJECT, etc.).

Add unit tests for None vs Some(entity_type) serialization and
integration tests verifying cross-type matching and scoped matching.
…s_combined

Use ..Default::default() to cover the new property_filters field
added to EntityFilters, fixing compilation with --all-features.
@whutchinson98 whutchinson98 requested a review from a team as a code owner March 16, 2026 16:31
@github-actions
Copy link
Copy Markdown

@whutchinson98 whutchinson98 merged commit 22a3a76 into main Mar 16, 2026
39 checks passed
@whutchinson98 whutchinson98 deleted the hutch/properties-literal branch March 16, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant