Repository navigation
Add phrase spans, page-built token maps and undo step locations - #528
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
795a8fc to
eea9aa0
Compare
dda053f to
f497972
Compare
imnasnainaec
left a comment
There was a problem hiding this comment.
⛏️ Evidence doesn't report the run's numbers. Per tier, perf:pages prints how many phrases reach unheld segments and how many jumps ran. Those numbers are what show that the case of phrases spanning unloaded segments actually ran. Could you add them, as #527 and #529 do?
Drafted by Claude Opus 5.5; barely reviewed by me.
Done: the Evidence now gives each tier's phrases that reach unheld segments and its jumps. One correction to the old text: the held pages are every other segment's, not random sets. |
89adf0a to
7d571d6
Compare
ea357e1 to
b827dab
Compare
imnasnainaec
left a comment
There was a problem hiding this comment.
@imnasnainaec reviewed 43 files and all commit messages, and resolved 5 discussions.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).
Auto-merge was disabled for another pull request in the stack
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ook code, per review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b827dab to
e41143a
Compare
imnasnainaec
left a comment
There was a problem hiding this comment.
@imnasnainaec reviewed 5 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).
Part of #426; closes #451. Stacked on #527.
Summary
This PR adds phrase spans to session segment pages, builds the WebView's token-level lookups from pages, and gives each undo step a location or a summary.
phraseSpansgives, for each phrase link that the page names, every word token of that link wherever it sits in the book. Each token comes with its segment, its document order and its gap text. A token that the book no longer holds is left out.buildPageIndexesbuilds, from the outline and the pages held, the lookups that the WebView reads through the whole book's maps today:tokenSegmentMap,tokenDocOrder,fullTokenOrder,gapTextByWordRef,wordTokenByRefand the segment maps. It also builds the boundary guard,straddledBoundaryRefs. Spans fill in the tokens of phrases that reach past the held pages. The token walk (indexSegmentTokens) and the guard (straddledRefs) are shared withbuildBookIndexesandInterlinearizer.tsx.outlineRangeOffinds the outline range to load for a segment id or token ref whose page isn't held. It reads the verse from the token ref, as the Render the continuous view from segment pages #467 comment proposes, throughpositionOf, which now lives inverse-ref.ts.afterHistoryMovereads them on main (the Add apply with inverse capture and per-session undo #486 comment). Every command except the stale-place reviews passes its step toAnalysisSessions.edit. Token, phrase, boundary and free-translation edits locate theirs at the token or segment edited. Catalog edits, deletions and discards record aStepSummary. A kept stale breakdown is located at its token when kept from a token chip, and otherwise recorded as a catalog edit; the WebView now records the same, where before it recorded no step. Stale-place reviews (discarding or reapplying a stale analysis, keeping or discarding a stale free translation) record none, as the WebView does, because the view makes them at no place.EditHistorykeeps each step, and an undo or redo hands it back in the reply.senseRef(the Resolve lexicon-linked glosses for display #514 comment), because pages carry whole phrase payload records.Nothing calls
page-indexesuntil Phase 4.Evidence
The #407 tiers are checked only by
npm run perf:pages, run by hand. CI runs only the unit tests, which use a small fixture.npm run perf:pagesnow builds page indexes from every other segment's page on the Data layer: capture a performance baseline before the database migration #407 datasets and checks them against the whole book's lookups. It compares each phrase's text, arc order, split previews and segments, the boundary guard on the held tokens, and where each token's segment lies in the outline.outlineRangeOfreturns, and the harness checks that the page holds the target. Whether the jump lands focus waits for 4a ([4a] Wire the WebView to the host behind a feature flag #453), where the WebView first callspage-indexes.perf:pagesreports 0 differences on every tier:small: 6 phrases reach unheld segments, 12 jumps.medium: 89 phrases reach unheld segments, 260 jumps.large-loadable: 26 phrases reach unheld segments, 260 jumps.page-indexes.test.ts(11 cases) checks token placement against the whole book's, for held pages and for a phrase in a segment not held. It also checks the boundary guard, including a phrase that names a token the book lacks.outlineRangeOfcases cover tokens, segment ids, a verse that begins inside a segment begun mid-verse, and a verse or heading that the book lacks.editSteps.test.ts(7 cases) covers a catalog step that names the analysis left holding its row or none; single, unused and multiple deletions; and a phrase step at its first token or at no place when the phrase isn't stored.sessionPages,editHistory,analysisSessionsandmaintests check the spans on a page and the step that each command records and that undo and redo hand back.tscare clean.Decisions with a strong alternative
EditStepandStepSummarymove tosrc/types/edit-step.ts, so the host can build them without importing a hook. Their docs are unchanged.Merge Danger
Door: two-way
The WebView doesn't use sessions or page indexes yet. Moving the step types changes only imports.
Blast Radius:
getSegments' session form (a newphraseSpansfield), the undo and redo replies (a newstep),AnalysisSessions.editandEditHistory.apply(a newstepoption), and every command inmain.ts, each of which now passes a step.buildBookIndexesand the WebView's boundary guard now run through the walk and guard they share with the page indexes. Phase 4 must read jump targets throughoutlineRangeOfand announcements through the reply'sstep.🤖 Generated with Claude Code
Stack created with GitHub Stacks CLI • Give Feedback 💬
This change is