Skip to content

feat(website): allow restricting which fields are allowed to be referenced in the AdvancedQueryFilter#1195

Open
fhennig wants to merge 5 commits into
mainfrom
adv-query-allowed-fields
Open

feat(website): allow restricting which fields are allowed to be referenced in the AdvancedQueryFilter#1195
fhennig wants to merge 5 commits into
mainfrom
adv-query-allowed-fields

Conversation

@fhennig
Copy link
Copy Markdown
Contributor

@fhennig fhennig commented May 5, 2026

resolves #1157, #1194

Summary

Adds an optional allowedFields config to the advancedQuery baseline filter. When set, the parsed LAPIS expression is walked client-side after successful validation, and any metadata column not in the allowed list causes an error with an informative message. Mutation-only queries (e.g. A123T) always pass regardless of allowedFields, since they reference sequence positions rather than metadata columns.

  • New AdvancedQueryFilterConfig type exported from BaselineSelector.tsx with optional allowedFields?: string[]
  • AdvancedQueryFilter component accepts and enforces allowedFields in its onSuccess handler via extractMetadataFields
  • New extractMetadataFields utility in siloFilterExpression.ts recursively collects all column values from a SiloFilterExpression tree
  • Three browser spec tests covering: disallowed field → error, allowed field → checkmark + callback, mutation-only → checkmark

The feature is fully opt-in: omitting allowedFields preserves existing behaviour (any field is allowed).

Test plan

  • extractMetadataFields unit tests in siloFilterExpression.spec.ts
  • Browser spec tests for the three allowedFields scenarios in AdvancedQueryFilter.browser.spec.tsx
  • Manually tested by temporarily setting allowedFields: ['host'] on the COVID baseline config — queries on host passed, queries on other metadata fields showed the error, mutation queries passed

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by an appropriate test.

@fhennig fhennig self-assigned this May 5, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dashboards Ready Ready Preview, Comment May 5, 2026 8:49am

Request Review

Required by verbatimModuleSyntax.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…yFilter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advanced query filter. supply list of allowed metadata fields

1 participant