Record the owner's acceptance of the job-store plan

The owner accepted every proposed default of docs/plans/job-store.md on
2026-12-01. Its open questions become numbered decisions, without the
alternatives, and design.md's Planned next item 1 records them.
Decisions 7 and 21 keep the wording that the remote-printers plan had
already settled. Each stage now follows its decisions, and the
"(assumed)" marks on the plan's own defaults go.

The other plans cite job-store decisions in place of questions:
printers.md, remote-printers.md, templates.md and ntfy.md. Templates
decision 22 now follows job-store decision 10 rather than leaning on an
assumed default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-12-01 11:03:30 -06:00
1 parent a06c12a202
commit f302b76ef4
6 files changed
+181 -154

No files matched your search

+14 -14
View File
@@ -28,12 +28,12 @@ Questions 6, 10 and 17 are settled by plans the owner has accepted since, and sa
failure the second, then the third. A failure before any byte was sent
fails over at once. After bytes were sent, the assumed default is the
existing retry rule on that printer, then failover. job-store.md
question 23 names the double-print risk this carries; this plan settles
decision 23 names the double-print risk this carries; this plan settles
it as an open question (question 22).
- **A multicast or broadcast job is one job with several deliveries,** one
per printer, each tracked on its own. job-store.md already plans that
model (its DELIVERIES AND SEVERAL PRINTERS section, question 12 on a
job's status from its deliveries, and question 23). This plan builds on
model (its DELIVERIES AND SEVERAL PRINTERS section, decision 12 on a
job's status from its deliveries, and decision 23). This plan builds on
it and does not redesign the store.
- **An explicit `?printer=` on a request is a direct unicast.**
- **A job that matches no rule goes to the default printer,** so today's
@@ -60,7 +60,7 @@ Before stage 1a:
- Trade-off: `format.max_lines` is global, so a multicast job that wraps into more lines on a narrower printer can fail there and print on the others. One image fetcher serves every printer.
- Alternatives: per-printer `format.*`, which nothing asks for; for a repeated address, one client shared by both lanes.
4. **One queue with a lane per printer.** Assumed: one `printqueue.Queue`. Each printer is a lane with its own waiting list, worker, renderer, sender, retries and retry delay. The submit lock, the status map, the history, the references of ntfy jobs and the store stay shared, so a job with several deliveries is one `Store.Add` commit, as job-store.md plans. `queue.size` bounds each lane, so a dead printer's backlog cannot refuse jobs for the others (question 19 for multicast and broadcast). Order is first in, first out per printer.
- Trade-off: no global order; a broadcast prints at different times on each printer. A host with three printers can hold three times `queue.size` jobs. With a durable store, unfinished content can reach N × `queue.size` × 4 MiB: about 1.2 GiB for three printers at the defaults, where job-store question 9 counts about 400 MiB for one. A unicast rule or a `?printer=` to a dead printer still refuses jobs once its lane is full, and an ntfy subscription whose jobs go there stops reading, as it does today when the one printer is dead.
- Trade-off: no global order; a broadcast prints at different times on each printer. A host with three printers can hold three times `queue.size` jobs. With a durable store, unfinished content can reach N × `queue.size` × 4 MiB: about 1.2 GiB for three printers at the defaults, where job-store decision 9 counts about 400 MiB for one. A unicast rule or a `?printer=` to a dead printer still refuses jobs once its lane is full, and an ntfy subscription whose jobs go there stops reading, as it does today when the one printer is dead.
- Alternatives: formatters phase 5's Pool of independent queues. It suits unicast only: a multicast job would have a status in each queue, capacity could not be checked across them at once, history would be evicted per queue, and anycast could not move a job between channels. For capacity, one global `queue.size`.
5. **A printer removed from the config while deliveries wait for it** (job-store.md, DELIVERIES AND SEVERAL PRINTERS). It matters once the store is durable. Assumed: at restore, a queued delivery whose printer is no longer configured fails, in a synced commit, with an error naming the printer, and one WARN line by `job_id` and `printer`. Finished deliveries, `uncertain` ones included, stay as history. An anycast delivery drops the missing printers from its list and fails only when none is left (stage 3).
- Trade-off: renaming a printer fails what waits for it.
@@ -74,7 +74,7 @@ Before stage 1b:
- Any token that may print may name any printer. A token claim that limits printers can come later.
- Trade-off: the break above. A preview without `printer` lays the job out for the default printer, even when the rules would send it elsewhere; from stage 2c the JSON preview's `route` says where it would go.
- Alternatives: ignore other parameters, as today; or render a preview for the first printer of the route the rules give.
8. **A job's status with several deliveries.** Assumed: from stage 1b, every status gains `deliveries`, whatever the number of printers configured, so a client's parsing does not depend on the config. Each entry gives a delivery's `printer`, `status`, `attempts`, `started_at`, `sent_at`, `finished_at` and `error`. The job's `status` follows job-store question 12. Beside the array, the job's own fields read:
8. **A job's status with several deliveries.** Assumed: from stage 1b, every status gains `deliveries`, whatever the number of printers configured, so a client's parsing does not depend on the config. Each entry gives a delivery's `printer`, `status`, `attempts`, `started_at`, `sent_at`, `finished_at` and `error`. The job's `status` follows job-store decision 12. Beside the array, the job's own fields read:
- `attempts`: the sum;
- `started_at` and `sent_at`: the earliest;
- `finished_at`: the latest, once every delivery has finished;
@@ -92,7 +92,7 @@ Before stage 1b:
Before stage 2a:
10. **Expr's version, and the size it adds. Settled** by docs/plans/templates.md decision 1: `github.com/expr-lang/expr` comes in at its latest stable release, v1.18.1 (2026-11-22) at the time of writing, with govulncheck, in whichever of this plan's stage 2a and that plan's stage 1 comes first. v1.18.0 and v1.18.1 fixed five advisories rated High that affect v1.17.8, Kanrisha's pin. The binary grows by about 5.3-5.8 MB (+36-37%) on every target, armv6 included, which that decision and docs/plans/remote-printers.md decision 4 accept.
- About half is Expr itself. The rest is other packages' methods that the linker can no longer drop, because Expr calls `reflect.Value.MethodByName` with a name that is not a constant. GORM has the same effect (job-store question 1). It applies once per binary, so with Expr linked, GORM's extra cost over plain SQL falls to about its own code.
- About half is Expr itself. The rest is other packages' methods that the linker can no longer drop, because Expr calls `reflect.Value.MethodByName` with a name that is not a constant. GORM has the same effect (job-store decision 1). It applies once per binary, so with Expr linked, GORM's extra cost over plain SQL falls to about its own code.
- The size was measured with v1.17.8 from the module cache. The stage that first links Expr into the binary records the size with the version it pins, from the snapshot build.
- Trade-off: a larger tarball and image, and more to load on a Pi.
11. **The config's shape.** Assumed: a `[routing]` section. `[routing.groups]` maps a group's name to its printers. Each `[[routing.rules]]` has `name`, `order`, `when`, `mode`, `to` and `enabled`. A rule's name follows the printer names' rule and is unique, so logs and `route` name one rule. `to` takes a name or a list, as list keys do. `when` is best written as a TOML literal string, so Expr's double quotes need no escaping. Both come from the file only: a list of tables has no variable, and a table of lists does not fit the `name=value` form, as the probe showed.
@@ -139,10 +139,10 @@ Before stage 2a:
19. **Multicast and broadcast.** Assumed:
- Capacity is checked on every target lane under the submit lock. The job is accepted when at least one target lane has room. A delivery whose lane is full is inserted already `failed`, with the error "printer's queue is full", in a synced commit as any failure is. It is logged at WARN by `job_id` and `printer`, and not sent to Sentry, since a full queue is a refusal, not a fault. `Submit` answers `queue_full` only when every target lane is full.
- With all-or-nothing capacity instead, a dead printer's full lane would refuse every broadcast, and every multicast that includes it, though every other printer is fine. A dead lane fills fast, since it drains one delivery per 7-27 s. On the ntfy path `queue_full` makes the subscriber stop reading, so one dead printer would stall a whole subscription, the `urgent-on-desks` example included.
- Each delivery renders on its own lane with its printer's options, so an image is fetched once per delivery. Rendered bytes are never stored (job-store question 8).
- Each delivery renders on its own lane with its printer's options, so an image is fetched once per delivery. Rendered bytes are never stored (job-store decision 8).
- An ntfy subscription's paper budget counts jobs, not deliveries, so a multicast rule prints a budgeted receipt on each printer of its set.
- `copies` applies to each delivery.
- Trade-offs: a job can be `failed` on one printer while it prints on the others; its `status` says so once they finish (job-store question 12), and `deliveries` at once. The same image URL is fetched N times and may answer differently. Lanes render in parallel, so a broadcast with large images holds N renders in memory at once, which matters on a Pi Zero. The budget does not count the second roll.
- Trade-offs: a job can be `failed` on one printer while it prints on the others; its `status` says so once they finish (job-store decision 12), and `deliveries` at once. The same image URL is fetched N times and may answer differently. Lanes render in parallel, so a broadcast with large images holds N renders in memory at once, which matters on a Pi Zero. The budget does not count the second roll.
- Alternatives: all or nothing, which keeps a job whole but lets one dead printer refuse the others' jobs; render once per distinct set of options and share the bytes; one render at a time across the lanes; count deliveries in the budget.
Before stage 2b:
@@ -167,7 +167,7 @@ Before stage 2c:
Before stage 3:
22. **Failover after bytes went out** (job-store question 23). Assumed, the owner's default: the existing retry rule on that printer (`retries`, with the doubling `retry_delay`), then failover to the next printer of the list.
22. **Failover after bytes went out** (job-store decision 23). Assumed, the owner's default: the existing retry rule on that printer (`retries`, with the doubling `retry_delay`), then failover to the next printer of the list.
- The delivery's `sent_to` lists every printer that got a `sending` mark, so a person knows which paper to check.
- A write error after which `Write` had taken nothing counts as nothing sent and fails over at once. That needs `Send` to report what it wrote, which it discards today. The printer stays in `sent_to` all the same: over-reporting is the safe direction, and dropping it would cost one more store write.
- `attempts` counts every attempt on every printer, and each mark's attempt number goes on from the last.
@@ -206,7 +206,7 @@ Before stage 3:
- A move takes the status lock, and job-store phase 2b's delivery lock once that exists. It happens only while the queue is open and the delivery is not cancelled. A failure while the delivery's context has ended (a shutdown, a cancel or its 2-minute bound) never moves it. With a durable store, dialling runs on a context that ends with the daemon, and a cancel ends the delivery's context, so their errors would otherwise look like a dead printer. Shutdown and the cancel follow their own rules, and the bound fails the delivery, as today.
- It renders again only when the next printer's options key differs; with an equal key it keeps its bytes. Each lane computes its key at start from its profile and every `receipt.Options` field, since the options may come to hold fields that cannot be compared.
- A render error moves on only to a printer whose key differs, since it would fail the same way on the others. With none left, the delivery fails.
- A moved delivery counts as taken from its first take until it finishes, so a job never reads `printing`, then `queued`, then `printing` (job-store question 12).
- A moved delivery counts as taken from its first take until it finishes, so a job never reads `printing`, then `queued`, then `printing` (job-store decision 12).
- After a `sending` mark, a moved delivery stays `sending` in the store while it waits on the next lane. A crash then turns it `uncertain` at the restart, and it is never sent, even when its write took nothing. That is the safe direction, as job-store has for a crash between the mark and the write.
- At a clean shutdown, a delivery waiting on a lane after a mark fails with `sent_at` and `sent_to`, with either store. That is job-store's rule for a delivery between retries after reaching `sending`.
- Job-store phase 2b's cancel leaves a delivery with any mark alone, even while it waits on the next printer. One without a mark can be cancelled wherever it waits.
@@ -469,7 +469,7 @@ request ─▶ Submit ─▶ route ─┼─ lane "kitchen": …
- Lock order per lane is job-store's: the printer's slot, then the delivery lock, then the store; the status lock is innermost and never held across a store call.
- `Submit` routes first, outside the locks (stage 2a). Then, under the submit lock, it checks capacity on the target lanes (question 19), commits `Store.Add` with every delivery, and appends each delivery to its lane.
- `Run` starts one worker per lane; shutdown covers every lane, by `Durable()`.
- A store failure stops every lane. The first store error from any lane ends the others, and `Run` returns it, as an errgroup does (job-store question 11). An idle lane must not keep `Run` alive, and no lane may send after the store broke.
- A store failure stops every lane. The first store error from any lane ends the others, and `Run` returns it, as an errgroup does (job-store decision 11). An idle lane must not keep `Run` alive, and no lane may send after the store broke.
- Every worker log line carries `printer`. `OnFailure` gets the printer, and Sentry tags it; never content.
DELIVERIES AND JOB STATUS (stages 1b-3)
@@ -483,7 +483,7 @@ DELIVERIES AND JOB STATUS (stages 1b-3)
```
- `deliveries` from stage 1b (question 8). `route` from stage 2a (question 18), whose `by` is `rule`, `query` or `default`. An anycast delivery's `printers`, its ordered list, and `sent_to` from stage 3 (questions 22 and 26).
- The job's `status` derives from its deliveries by job-store question 12; with one delivery it is that delivery's.
- The job's `status` derives from its deliveries by job-store decision 12; with one delivery it is that delivery's.
- Enums go into `jsonschema` tags, held by printqueue's and the server's schema tests.
`?printer=` AND THE PREVIEW (stages 1b and 2c)
@@ -639,7 +639,7 @@ CONFIG, PACKAGING, DOCKER
- New keys: `[printers.<name>]` (stage 1a), `[routing.groups]` and `[[routing.rules]]` (stage 2a), each with its default, validation, `configs/config.example.toml` entry and docs/configuration.md entry. All are read from the file only.
- Printers and routing are documented in docs/configuration.md, § printers and § routing, not on a page of their own, so the release archives, README's Documentation table and CLAUDE.md's "Read first" need no new entry.
- install.sh and the Dockerfile do not change. A container with named printers or rules mounts a config, as one with subscriptions does.
- The stop timeout must exceed the largest `write_timeout` of any printer plus 10 s, since each lane finishes the write in hand (job-store question 15). docs/install.md says so for the unit, and docs/docker.md for `--stop-timeout` (stage 1a).
- The stop timeout must exceed the largest `write_timeout` of any printer plus 10 s, since each lane finishes the write in hand (job-store decision 15). docs/install.md says so for the unit, and docs/docker.md for `--stop-timeout` (stage 1a).
- The unit gains `ExecReload` in stage 2b.
## Phases
@@ -876,7 +876,7 @@ internal/pkg/config
- No variable sets `routing`; a `UBERBRINGER_ROUTING_*` variable is named for the WARN.
internal/pkg/printqueue
- A multicast job gets one delivery per printer in one `Add`, and its status follows job-store question 12.
- A multicast job gets one delivery per printer in one `Add`, and its status follows job-store decision 12.
- A multicast job with one target lane full is accepted: that delivery is `failed`, "printer's queue is full", in a synced commit, and the others are queued. With every target lane full, `queue_full`.
- The route is stored and restored with the job, and a restore never calls the Router.