Skip to content

Add local print summaries and include results in AI-drafted forms - #578

Merged
prestoncabe merged 11 commits into
mainfrom
557-print-summary-and-ai-drafts
Oct 27, 2026
Merged

prestoncabe merged 11 commits into
mainfrom
557-print-summary-and-ai-drafts

Conversation

@prestoncabe

@prestoncabe prestoncabe commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Screeners can include a Print summary component that opens the browser's Print / Save as PDF dialog. It prints the screener name, date, benefit decisions, unmet requirements, and copied Next steps instructions. Printing stays on the device and excludes answers.

Closes #557. Closes #558. Fifth PR for #552, following #576.

The printout shares the Next steps renderer and uses the first visible Next steps component in schema order, including nested groups. Hidden components are skipped, and whenDecided / whenComplete is respected. Without a visible component, it prints decisions and unmet requirements without application instructions. Web addresses, email addresses, and phone numbers are added beside link text only when the text does not already show the destination. Markdown images are omitted.

The print stylesheet hides the rest of the page. The temporary print tree stays available until afterprint or print-media exit, supporting browsers whose print dialog returns asynchronously. It is also removed on navigation or a print error, and replaced on retry if the browser omitted its completion event. Printing is disabled for editor samples and stale or failed evaluations; click handlers recheck the latest result state.

AI drafts append Next steps (whenDecided) and Print summary server-side after the questions. Content is copied from configured benefits after generation; the model does not receive or generate application instructions, URLs, or contacts. Benefits without content copy as empty objects consistently with manually inserted components, and the editor warns about both missing and empty copies. Only answer-storing fields receive keys, and required answer bindings remain validated after draft import.

Validation:

  • Frontend regressions cover asynchronous printing, navigation cleanup, visible-component selection, contact destinations, empty-content warnings, unbound field creation, and draft binding compatibility.
  • All 297 frontend tests passed in CI on the final commit.
  • Production frontend build passed.
  • All 236 builder API tests passed.
  • Both public-screening Playwright tests passed locally, including print-media exit cleanup and both display settings.
  • All five CI checks passed on the rebased, reviewed commit: frontend, builder API, library API, documentation, and end-to-end (22 browser tests).
  • git diff --check passed.

@prestoncabe
prestoncabe force-pushed the 557-print-summary-and-ai-drafts branch from bc7d469 to 2880ef7 Compare October 27, 2026 17:17
prestoncabe and others added 11 commits October 27, 2026 16:35
Mobile browsers return from window.print() before taking the print
snapshot, so cleaning up right after the call printed a blank page or
the person's answers. Clean up on afterprint, or when the print media
query stops matching, and replace any tree a browser left behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Analyst Markdown can link to mailto: and tel: destinations, which printed
as bare link text. Print the address or number after the link, unless
the link text already shows it, as the help phone's does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A bare URL in analyst Markdown printed as "https://x (https://x)".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The printout used the first Next steps component in the schema, even
when a condition hid it, so it could show different content and timing
than the screen. Rendered Next steps fields now report their IDs, and
the printout skips any that are hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PrintSummary reused Text's create, so dragging it from the palette added
text: "# Text" to the saved, published and exported schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI drafts left these benefits out of benefitContent, so the editor said
no content was copied for them. A Next steps component placed by hand
copies them as {}, and only flags content that was never copied, such
as a benefit that failed to load. Both paths now follow that rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The editor skipped key assignment for a hand-kept list of types, so new
text, spacer, separator, image and other display fields were saved with
key = id. AI draft validation kept two more copies of the list. Check
each field type's keyed config instead, which also removes the
"print_summary" string literals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renaming a screener fired screeningResults.changed and re-rendered every
results field and subscriber, although no results changed, and the
editor passed a name it never used. The name now has its own accessor
on the service, which the print summary reads when printing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
appendResultsComponents cast form.path("components") to ArrayNode, which
would throw ClassCastException if the array were ever missing. The broad
catch turned that into a generic 503 for every AI draft.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prestoncabe
prestoncabe force-pushed the 557-print-summary-and-ai-drafts branch from 2880ef7 to a7467ba Compare October 27, 2026 20:37
@prestoncabe
prestoncabe marked this pull request as ready for review October 27, 2026 20:45
@prestoncabe
prestoncabe merged commit f1a26f6 into main Oct 27, 2026
8 of 9 checks passed
@prestoncabe
prestoncabe deleted the 557-print-summary-and-ai-drafts branch October 27, 2026 20:48
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.

Include Next steps and Print summary components in AI-drafted forms Add a Print summary screener component

1 participant