oliver-zehentleitner / maity

reads stay cheap at scale: SQL paging for cards, requests, overview; read limits per caller; SQLite reads without the write lock

Sign in to report

tsk-ybc2ma72dzvq Review Maity Coder Claude 002

Reads stay cheap as projects grow, and every caller has a limit. From the security team's round-3 load pass; details go to the coder by DM from the lead. Split into several PRs.

To do:

  1. On SQLite, reads don't take the instance-wide write lock.
  2. The card list pages in SQL: keys first, then full rows only for the page. Search doesn't load every note body.
  3. Overview: the latest reports and the request counts come from SQL with a limit and grouping.
  4. Request lists, per project and across projects: keyset paging in SQL.
  5. Probe: cache misses are limited per caller and per project, and the number of distinct refs per window is bounded.
  6. Open claims per caller are capped, and the holding list is bounded.
  7. Default per-caller limits for read routes in route limits.

Timing tests on a seeded hub for each point, with numbers before and after in the PR.

Boundary: on SQLite, routes that only read no longer hold the database's write lock (PR 1, #1800); a read transaction cannot write. What a call authenticates with still writes, so every call takes the write lock briefly before its route runs. PostgreSQL and MySQL/MariaDB are unchanged. A Keep the Why view's read waits at most half a second before it answers, and a contract text read keeps the default branch's head for up to 30 s per reader (PR 5, #1803). Paging in SQL, bounded search, probe budgets and limits per caller are later slices of this card.

Notes

  1. Maity Coder Claude 002 · Nov 18, 2026, 12:36 UTC

    6a open item before push (lotse 161063): the 429 rate_limited on GET /bootstrap is fine only if the CLI honours Retry-After there (join/resume must not abort hard). Check cli/ bootstrap handling, test it, and name it in the PR. Default 600 -> 1000 is a contract change with a changelog line (lotse 160489). Order: #1839 -> limits-hub -> 6a. k5ax

  2. Maity Test Team · Nov 23, 2026, 20:58 UTC

    Tester check of the card list paging (#1982 keys first / batched search, #2012), on the deployed hub (0.1.0a11, revision 20261123120000_acct_lock_rows), read-only, by maity-test-team.

    For each filter I followed next_cursor with a small limit, and again with limit=200. Then I compared the id lists (script on my box: /workspace/maity-state/page-test.py).

    • status=review, limit 3: 38 cards in 13 pages, the same ids in the same order as with limit 200, no duplicates. PASS
    • q=performance&status=all (search), limit 4: 35 cards in 9 pages, the same ids and order, no duplicates. PASS
    • status=done,cancelled&closed_after=2026-11-20, limit 5: 123 cards in 25 pages, the same ids and order, no duplicates. PASS
    • status=proposed,open,in_progress, limit 7: 478 cards in 69 pages, against 479 with limit 200. The one extra is tsk-pm4khj9esvah, which was created at 20:57:40Z, between the two walks. No duplicates, nothing skipped. PASS
    • status=all&order=updated&closed_after=2026-11-23, limit 6: 547 cards in 92 pages, the same set of ids as with limit 200 and no duplicates. The order differs, which I expect, because cards were updated during the ~1 min walk. PASS (set). An order check on a quiet hub was not done.

    Not tested: the overview and request-list paging (#2005 is still in review), read limits per credential, SQLite lock behaviour (the deployed hub's backend is not visible to me), and timings. No bug filed.

  3. Lotse · Nov 24, 2026, 12:54 UTC

    #2005 merged (main 530ba234): request list paging in SQL. Remaining parts wait for the cap.