Repository navigation
Replace the JSON query editor with a structured filter builder (#1920) - #2000
Merged
Merged
Conversation
The "Edit Query" panel was a raw JSON textarea. Replace it with a structured builder driven by the target type's schema: - Filter rows: Property (select over the schema's fields — no free-typed names), Operator (narrowed to the field's type), Value (typed control — enum select with labels, number input, boolean select, or text; `exists` takes no value, `in` accepts a comma-separated list). - targetType is inherited from the view and shown as a read-only chip, never an input — a saved query can no longer target a type its columns don't match. - Results stay visible while the builder is open (the editor already renders above the result view). - Fix the preview count: `handleQueryPreview` now applies the definition's filters client-side via `executeQueryDefinition` instead of reporting the whole-type count regardless of filters. The pure logic (operator narrowing, value coercion, row seeding, definition building) lives in a new `query-editor-model.ts` and is unit-tested directly (18 tests). Validated live against the running app: the builder renders on the Task view, the status enum populates (Open/In Progress/Done/Cancelled), and Preview reports a filtered count. svelte-check + eslint clean. Co-Authored-By: Claude <[email protected]>
…1920) Adversarial review of the filter builder found real defects: - [data-loss] Content/relationship/metadata filters (and property filters on fields the schema no longer declares) were silently dropped on save, since only property filters became editable rows and save overwrote the filter list wholesale. `partitionFilters` now splits a definition into editable rows and `preserved` pass-through filters; `buildDefinition` re-emits the preserved ones ahead of the edited rows, and the UI notes how many advanced filters are kept-but-not-editable. - [ux] A boolean filter rendered "true" (first select option) while its value stayed empty, so Save wrongly reported "needs a value". Boolean rows now seed to a concrete `true`. - [type-safety] A number `in`-list accepted non-numeric text and saved `NaN`; buildDefinition now rejects any NaN on a number field. - A stored operator invalid for its field's type is coerced to the first allowed operator when seeding, so the control can't show one value while holding another. Tests extended to 24 (partition/preserve, boolean seed, NaN rejection, operator coercion). svelte-check + eslint clean. Co-Authored-By: Claude <[email protected]>
Contributor
Author
|
Adversarial review → addressed → APPROVE. Independent review flagged a data-loss bug (non-property filters wiped on save), a save-blocking boolean UX defect, and a NaN type-safety gap — all fixed in the follow-up commit (partition/preserve pass-through filters, boolean seeds to |
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.
Closes #1920. Builds on #1919 (default-query model).
Replaces the raw-JSON
Edit Querytextarea with a structured filter builder driven by the target type's schema.What
exists= no value,in= comma-separated list).targetTypeinherited — a read-only chip, never an input (can't create a type/column mismatch).handleQueryPreviewnow applies the definition's filters viaexecuteQueryDefinitioninstead of reporting the whole-type count.query-editor-model.ts, 24 unit tests.Live-validated
Ran the app here (isolated daemon → dev-proxy → vite → Chromium): the builder renders on the Task view, the status enum populates (
Open/In Progress/Done/Cancelled), Preview reports a filtered count — zero console errors.Adversarial review → addressed
An independent review found real defects, all fixed in the follow-up commit:
partitionFilterssplits editable rows frompreservedpass-through filters, re-emitted on save; UI notes how many advanced filters are kept-but-not-editable.true.NaNsavable in a numberin-list → rejected inbuildDefinition.svelte-check + eslint clean; pre-push gate (test:all + build + e2e) passed.