Support Relay-owned draft previews and AISHL footer context
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
Direzione di ricerca
Start with the transactional template routes and rendering service, then read the existing template, preview, send, and API/OpenAPI tests named by the issue. Trace how template keys, published versions, Markdown rendering, layout context, and message creation flow through those entry points. Done means the acceptance criteria pass, including the byte-for-byte AISHL plaintext fixture and validation before any writes or enqueueing.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Support Relay-owned draft previews and AISL footer context
Status: pending
Tags: transactional, api, email
Depends on: None
Blocks: AI-Shipping-Labs/website#2009
Scope
- Add an explicit draft-preview choice to
POST /api/transactional/templates/{key}/preview.draft: truerenders the current editable draft even when published versions exist. An omitted or false value keeps today's resolution order: requested version, latest published version, then draft when no version exists. A non-boolean returnsdraft: must_be_boolean; combiningdraft: truewithtemplate_versionreturnsdraft: conflicts_with_template_version. - Accept periods in template keys on every keyed template endpoint: detail/upsert, publish, versions, preview, and test-send. This unblocks the four existing AISHL
coursework.*keys without allowing/or changing client scoping. - Add
markdown_layout_contextas a boolean on transactional template drafts and snapshot it into every immutable published version. Expose it in template detail, list, publish, and version payloads. It defaults tofalse; non-boolean upsert values returnmarkdown_layout_context: must_be_boolean. Existing drafts and versions therefore retain their current HTML and plaintext output. - For an opted-in Markdown render source, Relay owns both layout footer rendering and the plaintext equivalent. Only
footer_note,verify_email_url, andunsubscribe_urlmay flow from message context into the client layout. Raw HTML/text render sources remain unchanged. - Validate those three layout values before rendering: empty values are allowed;
footer_notemust be text no longer than 500 characters; URLs must be text, no longer than 2048 characters, and absolutehttporhttpsURLs. Usemust_be_string,too_long, andmust_be_absolute_http_urlas the field error codes. Escape footer text and URL attributes in HTML. No other arbitrary context value reaches the layout. - For opted-in Markdown, produce the same AISHL plaintext contract as the website renderer: normalized Markdown text, layout
brand_name, optional footer note, optional two-line verification action, and optional unsubscribe action, separated in the existing order by blank lines. Add a representative AISHL fixture that covers headings, emphasis, lists, links, footer text, verification, and unsubscribe so parity is byte-for-byte reviewable. - Keep preview, dry-run send, and durable send on the same render-source function. Invalid layout context must fail before contact/message/event creation or enqueueing.
- Document the new preview field, versioned rendering option, dotted-key grammar, validation errors, and response fields in the API/OpenAPI docs.
- Do not alter
campaign-broadcastversion 1, publish or edit live templates, call AWS, or send email in this issue. AISHL will opt new template versions into this contract duringAI-Shipping-Labs/website#2009rollout.
Compatibility Boundary
- Real external client: AI Shipping Labs, while
AI-Shipping-Labs/website#2009removes its local email templates and renderer. - Migration window: the AISHL site remains pinned to existing published versions, including
campaign-broadcastv1, until reviewed opt-in versions are published and the website rollout completes. - Observability: template and version API payloads expose the rendering option; delivered messages already record
template_version. - Removal plan: no compatibility alias or duplicate endpoint is introduced. The opt-in is a first-class Relay rendering contract. The AISHL-local renderer is removed by the blocked website issue after rollout.
Acceptance Criteria
-
GET/PUT, publish, versions, preview, and test-send routes resolve a client-owned key containing periods, including all four existingcoursework.*key shapes, while keys with/remain outside the route. - Preview accepts only a boolean
draft; invalid values returndraft: must_be_boolean, anddraft: truewithtemplate_versionreturnsdraft: conflicts_with_template_version. -
draft: truepreviews the saved draft after at least one version exists and returnspublished: falseandtemplate_version: null, with no database writes or queue work. - Preview without
draft: truepreserves current version resolution and remains byte-for-byte equal to dry-run rendering for the same source and context. -
markdown_layout_contextis editable on the draft, defaults tofalse, rejects non-booleans withmust_be_boolean, is copied into each immutable version, and is returned by template and version APIs. - With the option off, existing clients and all raw HTML/text templates keep their current HTML and plaintext rendering.
- With the option on for a Markdown template, valid
footer_note,verify_email_url, andunsubscribe_urlrender in the client HTML layout in the existing order and are safely escaped. - The same opted-in render produces AISHL plaintext byte-for-byte equal to the reviewed legacy fixture, including Markdown normalization, brand name, footer note, verification action, and unsubscribe action.
- Non-string, over-length, or non-HTTP(S) layout values return field-level validation errors before any contact, message, event, or queue work; unrelated context keys remain available only to the subject/body template.
- Preview, dry-run, normal send, and recipient-list send use the snapshotted option and produce the same fields for the same template version and context; workers and retries deliver the stored rendered fields unchanged.
- API/OpenAPI documentation describes the new request and response contract and dotted template keys.
- Focused tests and the repository test/lint gates pass without AWS credentials or a live send.
Test Notes
- Unit/service tests: draft versus published source resolution; option snapshot immutability; validated layout allowlist; HTML escaping; URL rejection; exact AISHL plaintext fixture; default-off and raw-template behavior.
- API/view tests: dotted-key detail/upsert, publish, versions, preview, and mocked test-send;
draft: true; invalid/non-booleandraft; mutual exclusion withtemplate_version; client isolation; option round trip in list/detail/version payloads. - Pipeline tests: preview equals dry-run; mocked durable and recipient-list paths render the same published version; retry and worker paths deliver the stored fields unchanged; invalid layout context creates no rows and enqueues nothing.
- LocalStack/mocked AWS tests: no LocalStack or real AWS needed; sender/queue boundaries stay mocked.
- UI/screenshot checks: not applicable; this is an authenticated API and rendering-service change.
Blocked by: None
- Lingua principale
- Python
- Stelle
- 0
- Fork
- 0
- Merge medio
- 8h 34m
- PR unite (30g)
- 10
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DataTalksClub/relay
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
DataTalksClub/relay#48 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
DataTalksClub/relay#42 · 7 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
DataTalksClub/relay#41 · 9 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
community-base enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
DataTalksClub/relay#39 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
community-base enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
DataTalksClub/relay#37 · 15 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di DataTalksClub/relay
Issue simili
-
component:benchmark
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
agentic-os-org/ANOLISA#9177 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
distrochooser/distrochooser#520 ·
I maintainer di solito rispondono entro 2 giorni
-
Status: Needs confirmation Status: Needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Published Docker images lack the redis extra: HEADROOM_COMPRESS_SESSION_STORE stops startupForse già presa @AlessandroSpallina l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
headroomlabs-ai/headroom#4513 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
codespell-project/codespell#4060 ·
I maintainer di solito rispondono entro 1 giorno