Skip to content

SF-3817 Partial book drafting#3964

Open
Nateowami wants to merge 1 commit into
masterfrom
feature/SF-3817-partial-book-drafting
Open

SF-3817 Partial book drafting#3964
Nateowami wants to merge 1 commit into
masterfrom
feature/SF-3817-partial-book-drafting

Conversation

@Nateowami

@Nateowami Nateowami commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

This PR creates a new implementation of the stepper for generating drafts, while leaving the old one alone. I chose an architecture where as much of the business logic as possible is put into NewDraftLogicHandler, where it can be unit tested without UI concerns. It is used by NewDraftComponent to determine which books and chapters are available for training or drafting.

New components

  • NewDraftComponent: Stepper that uses NewDraftLogicHandler
  • DraftPendingUpdatesComponent: Prompts user to sync projects before generating a draft (pretty basic implementation; could use UX improvement)
  • ExperimentalFeaturesDialogComponent: Allows users to enable experimental features (in this case partial book drafting being the only available feature)

Back end changes

  • Back end had to be updated to accept an explicit target training range (rather than inferring from source training ranges), while still accepting the format the legacy stepper provides.

Front end changes

  • Front-end now prepends book ID to USFM files if a user is downloading a book that didn't draft chapter 1
  • Import dialog updated to only import drafted chapters
  • Draft preview books component updated to state which chapters were drafted
  • Book multi select needed to be updated to be a bit more flexible (and prevent browser hang I've run into a number of times)

Data model changes

  • New property added to remember which files were available at the last build, so a later build can distinguish newly-added files (default to selected) from files the user deliberately deselected (it would probably be better to have a key/value record indicating which files were selected, but given the existing implementation leaves a gap it's easier to just add a second array).
  • Project progress now reports at a chapter level, rather than just a book level

Other

  • New VerboseScriptureRange tracks selection at a chapter level (It's verbose in the sense that expressing which chapters are selected for each book isn't merely something it can do, rather chapters must always be listed. This contrasts with a standard scripture range where "GEN" means "all chapters of Genesis" and in a VerboseScriptureRange it would mean "no chapters of Genesis". In order to implement chapter-level logic correctly, chapters have to be explicit since they're used for more than just filtering)
  • Some helper functions created to prevent duplication
  • E2E test for partial book drafting

This change is Reviewable

@Nateowami Nateowami added will require testing PR should not be merged until testers confirm testing is complete e2e Run e2e tests for this pull request labels Jun 23, 2026
@Nateowami Nateowami temporarily deployed to screenshot_diff June 23, 2026 18:32 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

📸 Screenshot diff deployed! (20 changes)

View the visual diff at: https://pr-3964--sf-screenshot-diffs.netlify.app

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.30683% with 203 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.94%. Comparing base (e5df661) to head (50de8dd).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../draft-generation/new-draft/new-draft.component.ts 71.08% 75 Missing and 21 partials ⚠️
...ft-generation/new-draft/new-draft-logic-handler.ts 82.02% 45 Missing and 3 partials ⚠️
.../SIL.XForge.Scripture/Services/SFProjectService.cs 0.00% 28 Missing ⚠️
...ate/draft-generation/draft-generation.component.ts 16.66% 5 Missing ⚠️
src/SIL.XForge.Scripture/Models/BookProgress.cs 0.00% 4 Missing ⚠️
...XForge.Scripture/Services/MachineProjectService.cs 80.00% 1 Missing and 3 partials ⚠️
...ipture/ClientApp/src/app/shared/scripture-range.ts 97.22% 2 Missing and 1 partial ⚠️
...aft-preview-books/draft-preview-books.component.ts 82.35% 2 Missing and 1 partial ⚠️
...pending-updates/draft-pending-updates.component.ts 94.44% 1 Missing and 2 partials ⚠️
...d/book-multi-select/book-multi-select.component.ts 77.77% 2 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3964      +/-   ##
==========================================
+ Coverage   80.92%   80.94%   +0.02%     
==========================================
  Files         637      647      +10     
  Lines       41245    42148     +903     
  Branches     6721     6917     +196     
==========================================
+ Hits        33376    34117     +741     
- Misses       6814     6949     +135     
- Partials     1055     1082      +27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e Run e2e tests for this pull request will require testing PR should not be merged until testers confirm testing is complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant