Skip to content

feat(items): free-text search on items list - #4

Open
wiguider wants to merge 12 commits into
masterfrom
feature/fullstack-items-search
Open

wiguider wants to merge 12 commits into
masterfrom
feature/fullstack-items-search

Conversation

@wiguider

@wiguider wiguider commented Oct 1, 2026

Copy link
Copy Markdown

Summary

Free-text search on the Items page, server-side.

  • Backend: GET /items/ takes an optional q (max 255 chars, NUL rejected). It does a case-insensitive ILIKE on title OR description, with %/_/\ escaped so they match literally. The filter applies to both the data and count queries and respects ownership (superuser sees all). The change is additive: without q, behavior is unchanged.
  • Client: regenerated (ItemsReadItemsData.q?: string | null).
  • Frontend:
    • The query lives in the URL (/items?q=…). It's validated with zod: number→string, trimmed, max 255, NUL dropped, malformed values fall back to no search.
    • SearchItems debounces input by 300 ms into navigate({ replace: true }). A consumed echo queue keeps the field and the URL in sync on back/forward, the sidebar link and clears.
    • useDeferredValue keeps previous results visible (dimmed) while a new query loads, with no skeleton flash.
    • Separate No items match "…" state with a "Clear search" button.
    • A11y: <search> landmark, labelled input and ×, Esc clears (IME-safe), focus returns to the input, <output> live region announces the result count.

No migration, flag or env var. Rollback = revert.

ClickUp

Docs

  • Design: docs/plans/2026-10-01-items-search/design.md
  • Plan: docs/plans/2026-10-01-items-search/plan.md
  • Stories: docs/backlog/user-stories-items-search-2026-10-01.md
  • QA: docs/project_context/items-search/qa-report.md
  • UX: docs/project_context/items-search/ux-review.md (+ screens/)
  • Journals: docs/project_context/items-search/journals/

Verification

  • Backend scripts/lint.sh (mypy, ty, ruff) ✅. Frontend bun run lint ✅ and bun run build ✅.
  • Code review: backend approved in round 1, frontend approved after 4 rounds.
  • QA: PASS on all 8 ACs. The API was checked with curl (case, count, literal wildcards, ownership, 422 above 255 chars and on NUL). The UI was checked with Playwright (debounce→URL, reload/back, Table/Cards, ×/Esc, no-results, malformed URLs).
  • UX/a11y: PASS at 1280/375 px in light and dark, with keyboard only.
  • No automated tests added (project rule: only on request).
  • The final polish commit (3c44b91: opacity, live region placement, enterKeyHint, echo edge case) landed after QA/UX and was verified with lint and build only.

Known trade-offs

  • ILIKE '%x%' does a sequential scan, which is fine at template scale. Add pg_trgm + GIN if it becomes an issue.
  • replace: true means Back inside /items leaves the page rather than undoing the previous query.
  • In hand-written links, ?q=1e3 becomes "1000" (the router's JSON parsing). Typed values are unaffected.

🤖 Generated with Claude Code

wiguider and others added 12 commits October 1, 2026 16:46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <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.

1 participant