Repository navigation
Send an HTML reply when a transformer returns message_html - #34
Merged
Merged
Conversation
A transformer may now add an optional message_html to result.json: an email-safe HTML fragment of the same report. When a succeeded job has one, the reply goes out as both text and HTML (Mailgun's html field beside text); a reply whose jobs sent none is byte-for-byte as before. The first user is check_temple_schedule, whose report of sections and a per-block count table is hard to read as plain text on a phone. - contract: Result.MessageHTML (json message_html, omitempty). Additive; contract_version stays "1". - store: jobs.message_html TEXT NOT NULL DEFAULT '', added by migration on existing databases. The default keeps the rollback binary, which inserts jobs without naming the column, working. The files_deleted_at migration is generalized into addJobsColumn. Complete takes the HTML; PendingEmails and Get read it. - app: only a succeeded job's HTML is stored. finish now logs only the first line of a job's message: a report runs to 50+ lines, which %q turned into one long escaped log line per job. - mailgun: deliver builds an HTML document from each job's fragment under an escaped caption naming the file and report, then the sheet links as anchors and the support line as a mailto link. The link and support wording each live in one helper shared with the text reply. Everything FileMill inserts is escaped; the fragment goes in verbatim, as transformers are trusted code. Alerts stay plain text. - README documents result.json, including message_html's rules, and the uppercase example sets a one-line message_html. doc/HTML-REPLY-PLAN.md is the plan, revised after review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The new
check_temple_scheduletransformer emails back a report with several sections and a per-block count table. As plain text it's hard to scan, and the table only lines up in a fixed-width font, which phones don't use. It already writes an HTML version of the report asmessage_htmlinresult.json. This PR makes FileMill send it.The plan is in
doc/HTML-REPLY-PLAN.md, revised after review.What changes
Contract:
result.jsongains an optionalmessage_html. The change is additive, socontract_versionstays"1", and an older FileMill ignores the field.Store: a new
jobs.message_htmlcolumn,NOT NULL DEFAULT '', added by migration on existing databases. Thanks to the default, the rollback binary can still insert jobs into a migrated database; a test covers this. The existingfiles_deleted_atmigration is now a generaladdJobsColumnhelper.App:
filemill.lognow records only the first line of a job's message. A real schedule report is 52–55 lines and was being logged as one long escaped line per job.Delivery: when a succeeded job has HTML, the reply is sent as text plus HTML through Mailgun's
htmlfield. The HTML part contains:mailto:link.Everything FileMill inserts itself is escaped. The link and support wording are shared with the text reply, so both say the same thing. A reply with no HTML job is unchanged, byte for byte. Alerts stay plain text.
README: documents
result.json, including the rules formessage_html(a fragment, email-safe, escaped by the transformer, under 100 KB). Theuppercaseexample now sets a one-linemessage_html.Testing
message_html;PendingEmails, migrating an old database keeps its rows, and an old-style insert still works;go vet ./...andgo test ./...pass. The delivery and HTML tests also pass 20 runs in a row.check_temple_scheduleproduces 21–25 KB of HTML, well under Gmail's ~102 KB clipping limit.After merge
Deploy-FileMill.ps1.check_temple_scheduleon a plain email route, notsheets-link. It outputs no files, andsheets-linkfails when no publisher is configured.🤖 Generated with Claude Code