Skip to content

feat(usfm): preserve section headings through import and export - #320

Merged
henrique221 merged 6 commits into
feat/419-usfm-import-createfrom
feat/288-section-heading-storage
Sep 16, 2026
Merged

henrique221 merged 6 commits into
feat/419-usfm-import-createfrom
feat/288-section-heading-storage

Conversation

@henrique221

@henrique221 henrique221 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

USFM import could append a section heading to the previous verse, and chapter content could drop stored headings. Supported titles now stay in the existing markers.headings field and preserve their order through import, editing, chapter content, and export. Export also adds a body paragraph after a heading when needed, keeping scripture text outside the heading.

This is stacked on #305 because the import path is not on main yet. Please retarget this PR to main before merging #305, since merged branches are deleted automatically. No new migration or route is required. Refs #288; the web fix is eten-tech-foundation/fluent-web#432.

The semantic-division marker list now has one canonical source. New writes reject text on the textless sd/sd1sd4 markers, while legacy stored rows still export as valid bare divisions. An imported heading with no following verse now fails explicitly instead of being discarded.

Validation: all 669 tests in 70 files passed on Node 24.14.0, plus lint, formatting, typecheck, build, drizzle-kit check, and the diff whitespace check. An isolated PostgreSQL 16 smoke passed for immediate and delayed imports, saved edits, chapter content, export, empty titled verses, retries without overwrites, and compatibility with legacy semantic-division records. Lint has three existing file-length warnings. The full pre-merge workflow does not run for a PR targeting the import branch.

Continues #319 after renaming the branch from codex/288-section-heading-storage to feat/288-section-heading-storage. The commits are unchanged.

Screenshot

This report was generated from a fresh execution of the existing integration smoke on head ae36d4b, using a local fixture and an isolated PostgreSQL 16.13 container with all 29 migrations. No shared database or external storage was used.

PostgreSQL smoke report for section heading import, storage, chapter USJ, and export

@henrique221 henrique221 self-assigned this Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 8b5c9b59-59f5-420c-af87-b03d85131573

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@henrique221

Copy link
Copy Markdown
Contributor Author

@kaseywright This PR targets feat/419-usfm-import-create because it builds on the USFM import code in #305, which is not in main yet. This keeps the diff focused on preserving section headings.

The plan is to merge #305 into main first, then change this PR's base to main and rerun the checks before merging it.

Comment thread src/lib/usfm-verse-serializer.ts Outdated

@kaseywright kaseywright left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two correctness issues found in the section-heading serialization/import path.

Comment thread src/lib/usfm-verse-serializer.ts
Comment thread src/lib/usfm-converter.ts

@kaseywright kaseywright left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both findings from the prior review are fixed in 7aacca1: sd-marker text is now rejected at write time via schema refinement, and usjToVerseTexts now returns an explicit error instead of silently dropping a trailing heading with no following verse. The marker-set duplication is also resolved (single source in schema.ts).

@henrique221
henrique221 merged commit 9464855 into feat/419-usfm-import-create Sep 16, 2026
1 check passed
@github-actions
github-actions Bot deleted the feat/288-section-heading-storage branch September 16, 2026 23:34
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.

Store block-level text that belongs to no verse (section headings)

2 participants