# Plan: CP437 blocks, modules and ntfy printing Status: **phases 1-4 are done**: the blocks and the preview; the list block, the module layer and the note module; the notify and ntfy modules, their cards and scoped tokens; and the ntfy subscriptions, with their digest, paper budget and quiet hours. All four are built and checked on paper, and docs/api.md, README.md and design.md describe them. Phase 5 is a list of items built one at a time, each when a real need appears, in its own session briefed from its item. ## Rules for phase 5 BACKWARD COMPATIBILITY - Every existing element, field and response keeps its meaning, and /print stays strictly decoded. - TestRenderCompat (receipt/testdata/compat) and TestPaperReceipts pin the bytes of existing jobs; later work keeps them passing. - Emoji are removed only on the module and ntfy paths; /print prints an emoji sequence as one '?'. DEFERRED UNTIL A NEED APPEARS - nested boxes and goldmark. - Geometry checks in the HTTP handler (Renderer.Check) stay rejected: layout never fails on a valid job, preview shows the result and line count synchronously, and each module caps its own length. INVARIANTS (all match the current code) 1. receipt.Job stays printer-neutral. Blocks are sized at render time from Options.Columns or Profile.Columns(font). The same job therefore prints correctly on a TM-T88IV, TM-T88VII or TM-m50II, and on several printers later. 2. Job.Validate stays structural and independent of geometry, so handlePrint keeps its Validate-then-Submit flow. 3. Layout never fails on a valid job. Widths clamp, titles are cut with "...", and over-long words split the way wrap() already splits them. The only render-time failure is the [format].max_lines backstop (default 2000). 4. Renderer.Render is the only path to printer bytes, and is all-or-nothing. 5. New code never emits raw ESC/POS. Payload text only ever lands in string fields of elements. The raw element stays available on /print only, to tokens issued with --raw. 6. /print stays strictly decoded (DisallowUnknownFields). A byte-compatibility test pins today's bytes. 7. Layers call only downward: server -> modules -> receipt -> escpos. ntfy never imports modules; internal/app connects the subscriptions to modules. ## Phases ### Phase 5: Later, on demand (1-3 days each; build only when a real need appears) **Goal.** Keep the core small. Each item below is independent and waits for real demand or an owner decision. **Work.** - Several printers: planned in docs/plans/printers.md. - User templates: planned in docs/plans/templates.md. - More blocks: planned in docs/plans/blocks.md. - Queue.Cancel so message_delete can cancel a still-queued job. - Webhook sources: planned in docs/plans/templates.md. - Default line spacing per model: planned in docs/plans/printers.md (decision 30). **Tests.** Each item ships with its own goldens and table tests in the phase 1-4 style. **Done when.** Each item is done when its feature has golden or preview coverage, README docs, and a real-paper check where layout changes. Nothing here blocks phases 1-4.