sword: keep note bodies, labels, references and marker places (#13, 6a) #126
No reviewers
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
schaefera/utStudyBIble!126
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/13-6a-notes-refs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #13 (PR 6a of 4)
What
This is the data layer only, in
sword/; nothing new is shown yet.Extract::notesnow holds each note whole: its kind, the module's own label, its text, and the references in it (the raw osisRef or passage plus the shown text).Shown::notesgives each marker's place as a byte offset into the runs' text. OSIS<reference>and ThML<scripRef>are read; relative references stay plain text (#117). The textExtractgives is unchanged.Blast radius
Tier: trunk
Trunk paths touched:
sword/src/filter.rs,sword/src/filter/notes.rs(new),osis.rs,runs.rs,thml.rsTesting tier: standard
Gate / rollback: revert this merge. There is no flag: core reads only
shown.runsandpara_start(core/src/bible/reader.rs), so the app shows nothing new until 6c.Budgets (docs/07):
sword::shownnow builds the note bodies for each verse it reads, and core drops them at once. That is a short-lived allocation of about 0.7–0.9 KB per chapter on average, and 3.8–5.2 KB in the busiest chapters (Dan 11 KJV, Ezek 40 BSB). Nothing new stays in memory until 6b and 6c keep the notes. CI'sappjob ran mem-check and passed against the 176000 kB baseline. Start-up work is unchanged.Proof
cargo make: fmt, clippy, tests (sword lib 95 passed; golden 15 passed, covering KJV, BSB, Darby, GerElb1871, TR, OSHB, GerSch and TSK), release check, deny and audit.markers_are_placed…,note_bodies_keep…,marks_follow_the_collapse, the thml notes test;bsb_notes_keep_their_references,elberfelder_…, with nref differing in 689 BSB chapters and 306 GerElb1871 ones.1ae0a0c: changes, rust, audit, app (with mem-check), e2e and click all succeeded.sword::showngives it, with no note text in it. The journal has no errors.Choices and deviations:
osisRef="", e.g. "Kap 6,5") and stay text; about 234 are real.<reference type="annotateRef">has no osisRef, so it stays text.nlabel attribute, solabelis covered by unit tests only.* … *around<hi type="bold">.Extract.textnow does the same. Only Darby has bold, and the display runs are not affected.tools/golden/fetch.shnow fetches Darby and GerElb1871. The CI module cache is keyed on that file, so it refreshes. The comment inci.ymlstill lists the old set; it's a comment only.Review
Reviewer: a fresh-context review at high on
1ae0a0c(review 328) had no findings. It noted two observations, not defects:<reference>at the end of a note is dropped. That's harmless for well-formed modules.Review-Confidence: 85/100. The audit took 15 off because the reviewer's report doesn't show it traced the caller (
core/src/bible/reader.rs). The audit read the riskiest hunks itself and found no missed defect.Confidence by part
collapse_marked, ThML prefix offsets): medium. Diatheke has no marker offsets to compare against, so only unit tests cover them until 6c puts markers on screen.🤖 Generated with Claude Code
Fresh-context review (claude-review). Level: high. Blast radius: trunk. Testing tiers: standard.
Reviewed commit:
1ae0a0cf51Range: origin/main...HEAD
Files read in context (hunks plus surrounding code): sword/src/filter.rs, sword/src/filter/notes.rs, sword/src/filter/osis.rs, sword/src/filter/runs.rs, sword/src/filter/thml.rs, sword/src/lib.rs, sword/tests/common/forms.rs, sword/tests/golden.rs, tools/golden/dump.py, fetch.sh, run.sh. The .tsv fixtures were checked by running the golden tests against the local SWORD cache; I did not read them line by line.
Findings: none (no high, medium or low defects with a concrete failure scenario).
What I checked:
note_atandx.notesstay one to one, so thezipinshownis safe.Run::collapse_marked: each mark lands after the preceding word and before any pending space, trailing marks go to the end, and the offsets are byte-correct for multi-byte text. The divine-name uppercasing keepsdisplay_lenconsistent, because it counts the bytes actually pushed totext.normalize_wsof the whole text (both trim leading space and drop trailing space). The prefix clone per note is quadratic only in notes per verse, which is negligible.Extract.text, not the display runs, and core only callssword::shown, so reading is unchanged. The core crate compiles against the newShownandExtractshapes.cargo test -p sword --offlinewith the local module cache: all pass, including the KJV, BSB, Darby and GerElb1871 golden rows with the new nbody and nref forms, andbusiest_verse_has_few_notes.Observations, not defects:
sword::shownnow builds note bodies (strings) for every verse on the reading path, although core discards them. The cost is small, but the CLAUDE.md rule says to state any memory effect in the PR body, so I suggest a line there. An unclosed<reference>at the end of a note drops that reference silently, which is harmless for well-formed modules.Phone check (docs/09) on the PR build, journal
utsb: build 0.0.1 feat/13-6a-notes-refs@1ae0a0cf5:restored BSB 27575 0.531, John 10), with the window loaded after 311 ms.showing John 11) and saved the place each time. Scrolling back crossed 11 → 10 and returned to the same verse (saved BSB 27575 0.573).sword::shownfrom this branch. The text is identical ("When Jesus saw her weeping, … deeply moved in spirit and troubled."), with no note text in it and normal spacing at the marker position. Reading looks the same as on main, as expected, since core doesn't use notes yet.🤖 Generated with Claude Code
Gate approval (claude-review) on head
1ae0a0c.Open before merge, not blocking: the PR body should say that
sword::shownnow builds note bodies on the reading path. The reviewer asked for that line because of the memory-effect rule. The PR is also still a draft and titled "WIP:".WIP: sword: keep note bodies, labels, references and marker places (#13, 6a)to sword: keep note bodies, labels, references and marker places (#13, 6a)