Skip to content

Library: a person can draw a line's boxes (PUT lines/:id/rects) - #51

Merged
sawradip merged 1 commit into
mainfrom
feat/line-rects
Nov 2, 2026
Merged

sawradip merged 1 commit into
mainfrom
feat/line-rects

Conversation

@sawradip

@sawradip sawradip commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

The computed boxes of a book's lines (rects) are often a few letters off where a sentence starts or ends inside a printed line: the indexer only knows where each whole printed line is, and places a cut by counting characters. A team will correct them by hand in the chalkbook dashboard; this stores their corrections.

  • Step 6 of the schema: book_lines gets rects_manual, rects_by, rects_at (added columns only; nothing existing changes).
  • PUT /v1/books/<slug>/lines/<id>/rects { rects, by } (author): the line's boxes as a person drew them, or null for the computed ones again. A live line of the book only (404, 409 retired); boxes on the page (x, y ≥ 0, w, fs > 0, 1 to 200).
  • Reads (lines, lines/all) return the drawn boxes as rects when there are any, with rectsManual and rectsBy. The PathshalaX reader shows corrections with no change on its side.
  • lines/sync compares and writes only the computed boxes, so a drawn line is never counted as changed and never overwritten; when a line's words change under the same key (textHash), its drawing is dropped (it belonged to the old words).
  • Spec: spec/1.2/registry-api.md §11 (the line record, the new request).

Tests in highlights.test.ts: drawn boxes read instead of computed ones, kept by a sync with other computed boxes, reset by null, dropped when the words change; author only, 404, 409, invalid boxes.

pnpm check passes. (The first run timed out once in adopt.test.ts, untouched here; it passes alone and on the second full run.)

Deploying this changes the production library: it waits for the owner's go.

🤖 Generated with Claude Code

…; readers get them instead of the computed ones, a sync keeps them while the words stay

Step 6 adds rects_manual, rects_by, rects_at to book_lines (added columns only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawradip
sawradip merged commit 8589512 into main Nov 2, 2026
1 check passed
sawradip added a commit that referenced this pull request Nov 2, 2026
Deploy the library: hand-drawn line boxes (#51)
This was referenced Nov 2, 2026
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