Record that a person, not the daemon, reprints a job

The owner decided that the daemon never reprints a job by itself. It
cannot tell a receipt that printed from one that is missing: an
uncertain job may have printed, and in two narrow cases a job reads
done before it has printed. A reprint when the cover closes would not
reach the second of those, whose job reads done, and it would print
duplicates, since the printer resumes its own buffer when the cover
closes, as stage 1d's third paper check showed; after a cut-short image
the printer can also still be inside the image command. So those cases
stay as they are, by design.

A person reprints instead, through the API, by ID or by category.
POST /api/v1/jobs/{id}/reprint reprints one stored job, as often as
asked. In place of the ID, last reprints the last completed job, one
that read done and never one still waiting or printing; failed retries
the last failed print; and uncertain reprints every uncertain job. A
job a category reprints is marked, so no category takes it again, and
each answer names the new job, so a person can print it again by its
ID. A reprint takes a job from any source: a print or module route, an
ntfy card or digest, and later a webhook. The routes take no query
parameters: every input goes in the JSON body, an empty body or none
means the defaults, and the printer, with several, is a body field. No
message a source receives, an ntfy message included, makes the daemon
print a job again.

design.md records the decision beside the confirmation and rewords the
open cases as accepted choices; its Planned next item 1 names the
routes and says their questions await the owner. docs/plans/job-store.md
gains decision 24 in phase 2 and open questions 25-39 on its details,
each with an assumed default and its trade-off: last after a reprint,
which failed jobs failed takes, the order of uncertain reprints, when a
job is marked, an age limit for uncertain, several printers, an empty
category, the answer, which jobs an ID may name, the tokens, pruned
content, repeats and the duplicate check, a REPRINT mark, a CLI command
and clearing the printer first. The Status line, the overview and phase
2, its tests and paper check included, take them in, and phase 5 no
longer lists a reprint route. docs/plans/templates.md says that a
webhook replay is the sender's resend, not a reprint command. No code,
route or API document changes until phase 2 builds the routes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-12-01 21:28:38 -06:00
1 parent bdda410deb
commit cee528aa83
3 files changed
+84 -12

No files matched your search

+43 -7
View File
@@ -115,8 +115,10 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
`printer.confirm = false`, unchecked on the TM-T88VII and TM-m50II.
`printer.confirm` also needs a printer that answers `DLE EOT` on
receipt.
- What remains open, which an acknowledgement that names the job,
`GS ( H` fn 48 (phase 5), would close:
- Two cases are accepted as they are, by design (the next decision).
In each a job can read `done` before it has printed, and the daemon
does not try to catch it; only an acknowledgement that names the
job, `GS ( H` fn 48 (phase 5), could tell it apart:
- A `raw` job holding a command the printer answers with a byte
whose bits 4 and 7 are clear, such as `GS r`, `GS I`, `ESC v` or
`ESC u 0`, with printing after it, is confirmed by that answer
@@ -135,14 +137,39 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
feeds and cuts when its cover closes; if it reports online before
it has run the queued requests and pauses between them, the late
ready answer confirms the job before it has printed.
- The client relies on the printer answering `DLE EOT` on receipt,
ahead of the `GS r 1` sent just before it, and running `GS a 0` in
order, and on how the board routes bytes across connections. The
TM-T88IV answers `DLE EOT`; the rest is unverified, and stage 4a's
raw-byte probe (docs/plans/printers.md) checks it.
- The client relies on the printer answering `DLE EOT` on receipt,
ahead of the `GS r 1` sent just after it, running `GS a 0` in order,
and never answering `DLE EOT` between the bytes of a status block,
and on how the board routes bytes across connections. The TM-T88IV
answers `DLE EOT`; the rest is unverified, and stage 4a's raw-byte
probe (docs/plans/printers.md) checks it.
- A job holds the printer's connection until it has printed, so
`/healthz` answers `503` `timeout` during a receipt that takes more
than 3 seconds.
- **The daemon never reprints (owner, 2026-12-01).** It does not reprint
a job by itself, not when a cover closes and not at start. An
`uncertain` job, and a job that reads `done` in one of the two cases
above, are left as they are on purpose: the daemon cannot tell a
receipt that printed from one that is missing, so a reprint of its own
would risk a duplicate. A reprint when the cover closes would not even
reach the second case, whose job reads `done`; the printer resumes its
own buffer when the cover closes (paper check 3), so it would print
the receipt twice; and after a cut-short image the printer can still
be inside the image command. A person who finds a receipt missing
reprints it through the API instead. `POST /api/v1/jobs/{id}/reprint`
reprints one stored job by its ID, as often as asked. In place of the
ID, which can never be one of them, `last` reprints the last completed
job, one that read `done`, never one still waiting or printing;
`failed` retries the last failed print; and `uncertain` reprints every
`uncertain` job. A job one of these categories reprints is marked, so
no category takes it again, and each answer names the new job, so a
person can print it again by its ID. A reprint takes a job from any
source: a print or module route, an ntfy card or digest, and later a
webhook. The routes take every input in the JSON body, never in a
query parameter, and the ID or category in the path is the route
itself. No message a source receives, an ntfy message included, makes
the daemon print a job again. Phase 2 of docs/plans/job-store.md
builds the routes (its decision 24).
- **Deliveries.** A job has one delivery per printer, one for `default`
until several printers are configured, each with its own state,
attempts and times. A job's `status` derives from them: `queued` while
@@ -685,6 +712,15 @@ before anything is built. They come in this order.
- A PNG preview draws the paper one pixel per dot, box drawing from
the cell geometry and other glyphs from a bitmap font. Stored jobs
preview by ID.
- `POST /api/v1/jobs/{id}/reprint` reprints a stored job by its ID,
and by category `/jobs/last/reprint` the last completed job,
`/jobs/failed/reprint` the last failed one and
`/jobs/uncertain/reprint` every `uncertain` one, each marked so that
no category takes it again: the user-side path for `uncertain` jobs
and any receipt that went missing, since the daemon never reprints by
itself and no message asks it to (owner, 2026-12-01; the plan's
decision 24). Its details are the plan's questions 25-39, which await
the owner.
- Epson's acknowledgement, ntfy state in the store and an age limit
wait for phase 5.
2. **Several printers**: `docs/plans/printers.md` (written; the owner