|
| 1 | +# Collection query and pagination contract |
| 2 | + |
| 3 | +A saved collection is a query over the caller's accessible workspaces. An empty |
| 4 | +or whitespace-only query adds no restriction. A collection's workspace location |
| 5 | +does not replace its query scope; explicit workspace restrictions belong in CQL. |
| 6 | +Completion filters and other sub-filters narrow that same scope before counting |
| 7 | +and pagination. Removing a sub-filter must not turn an unrestricted collection |
| 8 | +into an empty result. |
| 9 | + |
| 10 | +Item lists and backlog resolve saved queries through `resolveItemListQLContext`. |
| 11 | +Delta membership checks use the item list service. Board metadata projects the |
| 12 | +matching workspace IDs through the same CQL evaluator and permission scope, |
| 13 | +including when the query is empty. |
| 14 | + |
| 15 | +The v2 response contract uses `page`, `page_size`, `total_items`, and `total_pages`. |
| 16 | +`collectionService.js` adapts `page_size` to the collection store's existing |
| 17 | +`limit` option once, for both items and backlog. Continuations must use that |
| 18 | +effective server size, especially when the server caps a requested size. |
| 19 | +Headers, pagination controls, and remaining counts all use `total_items`. |
| 20 | +The collection query editor opts into empty searches and consumes canonical v2 |
| 21 | +pagination directly. The general search page still waits for a query. |
| 22 | + |
| 23 | +Regression coverage lives in the sibling `core-tests` repository: |
| 24 | + |
| 25 | +- `tests/collection_empty_query_test.go`: empty and whitespace queries, |
| 26 | + completion sub-filters, page contents and totals, board metadata, and |
| 27 | + inaccessible workspace exclusion. |
| 28 | +- `frontend/src/lib/features/collections/collectionService.test.js`: the v2 |
| 29 | + pagination response adapter for item and backlog continuation. |
| 30 | +- `e2e/tests/collection-empty-query.spec.ts`: navigation beyond fifty rows, |
| 31 | + both list and query-editor pagination, toggling completion visibility from |
| 32 | + page two, and preference persistence. |
| 33 | +- `frontend/src/lib/stores/searchStore.test.js`: unrestricted empty collection |
| 34 | + searches and the general search page's initial idle state. |
| 35 | + |
| 36 | +## Validation commands |
| 37 | + |
| 38 | +Run from `core`: |
| 39 | + |
| 40 | +```sh |
| 41 | +../core-tests/overlay.sh . -- -tags=test -count=1 -run 'TestEmptyCollection|TestCollectionMetadata|TestItemsBatch' ./tests |
| 42 | +TEST_DB_TYPE=postgres TEST_POSTGRES_DSN='postgresql://localhost:5432/postgres?sslmode=disable' ../core-tests/overlay.sh . -- -tags=test -count=1 -run 'TestEmptyCollection|TestCollectionMetadata|TestItemsBatch' ./tests |
| 43 | +../core-tests/overlay.sh . -- -tags=test -count=1 -run 'TestItemCRUDService|TestCollection.*Board|TestBoardConfiguration' ./internal/services |
| 44 | +../core-tests/run-overlay-script.sh . scripts/run-frontend-tests.sh src/lib/features/collections src/lib/stores/collectionContext.test.js src/lib/stores/collectionCompletion.test.js src/lib/stores/searchStore.test.js |
| 45 | +E2E_KEEP_ARTIFACTS=1 ../core-tests/run-e2e.sh tests/collection-empty-query.spec.ts tests/collection-completed-visibility.spec.ts tests/collection-search-columns.spec.ts --retries=0 |
| 46 | +./scripts/run-golangci-lint.sh run --timeout=5m |
| 47 | +``` |
| 48 | + |
| 49 | +Go files are formatted with `gofmt`. Changed JavaScript and TypeScript files are |
| 50 | +checked with Biome using `frontend/biome.json`; Svelte files are excluded. |
| 51 | +Full repository suites are outside this focused validation. |
0 commit comments