Repository navigation
Store: declared sorting and equality filtering (refs #330) - #357
Merged
Merged
Conversation
jimhoyd
force-pushed
the
feat/store-sort-filter-330
branch
from
September 21, 2026 00:48
cbf2a49 to
7cac0a6
Compare
…#330) Collections declare sortable and filterable field lists; the list API takes one sort=<field> or sort=-<field> and up to three equality filters with an id tie-break and an opaque keyset cursor for sorted pages. Undeclared or malformed names are 400s naming only the key. The screen part is recorded in open decisions: it does not fit the ui package size budget. Co-Authored-By: Claude Sonnet 5 <[email protected]>
jimhoyd
force-pushed
the
feat/store-sort-filter-330
branch
from
September 21, 2026 01:03
7cac0a6 to
3db73c7
Compare
jimhoyd
added a commit
that referenced
this pull request
Sep 21, 2026
The store half shipped in #357. This finishes the screen half, which had been reverted for pushing @jimhoyd/urlcode-ui about 2.2 KB over its 350 KiB unpacked-size budget. Trimmed first, honestly: kitCss, stylesheet and kitCssLimit in packages/ui/src/kit-styles.ts and the generated styles.generated.ts were exported with an inferred string-literal type, so tsc duplicated the entire compiled value into the .d.ts declaration a second time. Adding an explicit `: string`/`: number` annotation widens the type and drops that duplication: dist/kit-styles.d.ts 34,423 -> 562 bytes, dist/styles.generated.d.ts 34,583 -> 41 bytes, about 68 KB saved unpacked, no change to emitted JavaScript, runtime values or any consumer (nothing in the tree matches on the literal type). That headroom fits the screen slice: a collection that declares `sortable`/`filterable` fields (the same lists urlcode-store checks at activation) gets a sort select and one control per filterable field in the crud kit script. Only declared field names are ever offered; requests are built with URLSearchParams from the controls' current values; "load more" repeats the sort and filters applied when the page was last loaded rather than whatever the controls hold when the button is pressed; values are never echoed unescaped. One new copy key, ui.crud.sort. A collection with neither list renders the identical shell it did before (no data-query attribute, no controls). @jimhoyd/urlcode-ui is now 292,613 bytes unpacked (was 356,904 before this change), about 66 KB under the unchanged 358,400-byte budget. Updated packages/ui README/CHANGELOG, docs/STORE.md and the docs/OPEN-DECISIONS.md row for #330 (marked done). Refs #330. Co-authored-by: Claude Sonnet 5 <[email protected]>
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.
Refs #330 (does not close it: the screen part is not built).
What
sortableandfilterablefield lists (validated at activation: declared fields only, max 8, unique, strings need maxLength <= 256 or an enum, no list-parameter names).sort=<field>/sort=-<field>, up to 3 equality filters typed like the field, id tie-break, at most 16 params. Undeclared, repeated or malformed names are 400invalid_querynaming only a plain-identifier key; values never echoed.UI part: not included
A working slice (sort select, filter controls, one copy key, unchanged strict-CSP script) added about 3.7 KB unpacked to the ui package (356,904 to 360,651) against the 358,400 budget. Reverted rather than raising the budget; recorded in OPEN-DECISIONS.
Behaviour change
Unknown query parameters on a store list request are now 400s (previously ignored).
Verification
npm ci,npm run docs:llms,npm run verify(lint, typecheck, check:docs, build, tests, verify:workspaces, package audit) all pass. New tests: packages/store/test/query.test.ts.🤖 Generated with Claude Code