Repository navigation
Library: a person can draw a line's boxes (PUT lines/:id/rects) - #51
Merged
Merged
Conversation
…; 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
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
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.book_linesgetsrects_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, ornullfor 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).lines,lines/all) return the drawn boxes asrectswhen there are any, withrectsManualandrectsBy. The PathshalaX reader shows corrections with no change on its side.lines/synccompares 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/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 checkpasses. (The first run timed out once inadopt.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