Skip to content

Page the Precedent cases and search all of them on the server - #179

Merged
ryanbarlow97 merged 3 commits into
mainfrom
precedent-pages
Oct 11, 2026
Merged

ryanbarlow97 merged 3 commits into
mainfrom
precedent-pages

Conversation

@ryanbarlow97

@ryanbarlow97 ryanbarlow97 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

The Precedent tab loaded every case on each visit. On Main that is 219 cases, fetched with two fresh Supabase connections: one for the rows and one for the count, about 0.3 s each.

  • Pages: the tab shows 25 cases a page, with Previous / Next, the same as the Players directory.
  • Search covers every case: the search box sends q to GET /precedent/staff/cases. A case matches when every word appears somewhere in its text, rule, ruling, punishment, logger or players, ignoring case. % and _ are matched as plain characters. It searches the whole corpus, not just the page on screen, and the count line says how many cases match.
  • One connection: the page and its count share one connection, so a page takes about 0.3 s instead of 0.6 s.
  • Player suggestions: the case form now gets its names from a new GET /precedent/staff/players route, fetched when the form first opens. The page no longer holds every case to collect them from.
  • The bot's limit/offset use of /staff/cases is unchanged (limit still defaults to 500).
  • The pager button style moves to components/admin/ui.ts, shared with the Players directory.

Docs: TF-Minecraft/Docs#133

Testing

  • Backend: full suite (2038 passed). Frontend: vitest (all passing), tsc, oxlint, oxfmt.
  • The new read-only queries were run against Main's Precedent database through the backend container:
    • xaero 4.8 returns 1 case.
    • 100% and a_b return no cases.
    • The final page returns 19 of 219 cases.
    • The player list returns 139 names.
  • Checked in a browser against a stub API: paging, search across pages, the match count while typing, and player autocomplete.
  • Dev has no Precedent database, so branch previews can't show cases.

🤖 Generated with Claude Code

The Precedent tab loaded the whole corpus on every visit, opening one
database connection for the rows and another for the count. It now
loads 25 cases a page. The search box sends its words to
/precedent/staff/cases?q=, which keeps cases containing every word
anywhere in the text, rule, ruling, punishment, logger or players, so
it covers every case, not just the page on screen. The page and its
count share one connection.

The case form's player suggestions come from a new
/precedent/staff/players route, fetched when the form first opens,
since the page no longer holds every case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 55 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b2fca281-a547-43bd-a068-62a3749a44ee

📥 Commits

Reviewing files that changed from the base of the PR and between 5ced04f and d62c9b0.


📒 Files selected for processing (14)
  • backend/src/api/precedent_routes.py
  • backend/src/api/test_precedent_routes.py
  • backend/src/auth/test_staff_tools.py
  • backend/src/precedent/db.py
  • backend/src/precedent/test_db.py
  • frontend/app/admin/precedent/page.tsx
  • frontend/app/components/admin/PlayersDirectory.tsx
  • frontend/app/components/admin/ui.ts
  • frontend/app/components/precedent/PrecedentTable.tsx
  • frontend/app/lib/precedent/filter.test.ts
  • frontend/app/lib/precedent/playerSuggest.test.ts
  • frontend/lib/precedent/api.ts
  • frontend/lib/precedent/filter.ts
  • frontend/lib/precedent/playerSuggest.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Next could count from the old search's page while a new search was
loading, and a failed page turn left nothing to click. The pager now
waits for the page in flight, a failed load offers Try again, each new
search is a fresh request, and the search box stops at the API's 200
characters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ryanbarlow97
ryanbarlow97 merged commit a2f73eb into main Oct 11, 2026
6 checks passed
@ryanbarlow97
ryanbarlow97 deleted the precedent-pages branch October 11, 2026 12:59

This branch was successfully deployed

1 active deployment
preview — d62c9b06 Deployed Oct 11, 2026 by ryanbarlow97 via deploy #226
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