Record the owner's acceptance of the printers plan

The owner accepted every proposed default of docs/plans/printers.md on
2026-12-01. Its open questions become numbered decisions, without the
alternatives, and design.md's Planned next item 2 records them.
Decisions 6, 10 and 17 keep the wording that the remote-printers and
templates plans had already settled. Decision 14 amends the owner's
earlier wording: a rule that fails to compile stops the start rather
than being skipped.

The plan's acceptance edits are made, and its list of them goes.
formatters.md loses its open question, which the routing example
answers, and points to this plan for a second printer and per-model
line spacing, without the printer pool's tests. job-store.md points to
these decisions for the deliveries array, the stored route, failover
after a sending mark, the lanes and their content bound, and a printer
removed from the config. Its invariant 2 speaks of the job's bytes,
since an anycast check sends DLE EOT before the mark. Its findings
confirm the TM-m50II's command list and the power-on part of the
automatic-status side finding. Phase 2b, phases 3c and 4 and phase 5
say how they meet several printers.

The other plans cite printers decisions in place of questions, and
templates decision 1 now follows printers decisions 12, 14, 15 and 17
rather than leaning on assumed defaults.

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:07:58 -06:00
1 parent f302b76ef4
commit 68bce4db59
6 files changed
+224 -263

No files matched your search

+10 -10
View File
@@ -1,6 +1,6 @@
# Plan: remote printers, reached through an agent
Status: **planned; nothing is built.** The owner accepted every proposed default on 2026-11-30 (Decisions), and design.md's Planned next item 3 records them. This plan builds on docs/plans/job-store.md and docs/plans/printers.md and redesigns neither. It fills the seam that printers.md leaves for remote printers (printers question 6, and its Architecture section THE SEAM FOR REMOTE PRINTERS). Stage 1 needs nothing from those plans. Stage 2 needs printers stage 1a, for its key kind for a table of named tables. Stage 3 needs job-store stage 1c, for `beforeWrite` in `printer.Client`. Stage 4 needs printers stages 1a and 1b and job-store stage 1c. Its anycast part needs printers stage 3; whichever of the two lands second builds that part. Stage 6 waits for the owner's word and job-store phase 5. Each stage runs in its own session, briefed from its section, in the order listed. Every check on a real printer needs the owner's OK. Whichever stage finishes last deletes this plan, its findings with it, and design.md's Planned next item 3.
Status: **planned; nothing is built.** The owner accepted every proposed default on 2026-11-30 (Decisions), and design.md's Planned next item 3 records them. This plan builds on docs/plans/job-store.md and docs/plans/printers.md and redesigns neither. It fills the seam that printers.md leaves for remote printers (printers decision 6, and its Architecture section THE SEAM FOR REMOTE PRINTERS). Stage 1 needs nothing from those plans. Stage 2 needs printers stage 1a, for its key kind for a table of named tables. Stage 3 needs job-store stage 1c, for `beforeWrite` in `printer.Client`. Stage 4 needs printers stages 1a and 1b and job-store stage 1c. Its anycast part needs printers stage 3; whichever of the two lands second builds that part. Stage 6 waits for the owner's word and job-store phase 5. Each stage runs in its own session, briefed from its section, in the order listed. Every check on a real printer needs the owner's OK. Whichever stage finishes last deletes this plan, its findings with it, and design.md's Planned next item 3.
## Decisions (owner, 2026-11-30)
@@ -42,7 +42,7 @@ For stage 1:
For stage 2:
4. **One binary.** the agent is the same binary, run as `uberbringer agent`. One build, one release, one image and one set of licence notices, and the agent reuses `printer`, `escpos`, the config loader and the logging.
- Trade-off: the agent carries the whole server, about 20 MB once Expr is linked (printers question 10), on boards where it uses a fraction of it.
- Trade-off: the agent carries the whole server, about 20 MB once Expr is linked (printers decision 10), on boards where it uses a fraction of it.
5. **The WebSocket libraries.** main serves the link with `github.com/gofiber/contrib/v3/websocket` (v1.3.1, the Fiber v3 middleware), and the agent dials with the `Dialer` of `github.com/fasthttp/websocket` (v1.5.12), the library that middleware is built on. One implementation then serves both ends, and both are pure Go.
- The middleware refuses a request without an `Origin` header unless `AllowEmptyOrigin` is set. The agent sends none, so the setting is on. Main refuses a request that carries one instead (decision 7).
- Trade-off: fasthttp/websocket has had no release since 2025-01-01. A fault there reaches both ends.
@@ -66,7 +66,7 @@ For stage 2:
- fasthttp clears the connection's deadlines when it hands over an upgraded connection, so `webserver.read_timeout` (15 s) and `idle_timeout` (60 s) no longer apply to it; the link sets its own.
- 20 s stays under nginx's default 60-s read timeout for a proxied WebSocket, for a main behind an operator's nginx, and under the idle limits common in home routers' NAT.
- Trade-off: about 6 small frames a minute per agent, both ways, while idle.
10. **`/healthz` and the agents.** `/healthz` gains `agents`, one entry per configured agent, sorted by name: `name`, `connected` and `since`, the time of the last connect or disconnect. A remote printer's entry in `printers` gains `agent`. No address, version or token subject appears, since the route is public. The code still follows the default printer alone (printers question 9).
10. **`/healthz` and the agents.** `/healthz` gains `agents`, one entry per configured agent, sorted by name: `name`, `connected` and `since`, the time of the last connect or disconnect. A remote printer's entry in `printers` gains `agent`. No address, version or token subject appears, since the route is public. The code still follows the default printer alone (printers decision 9).
- Trade-off: the public route shows agent names, as it shows printer names.
For stage 3:
@@ -74,7 +74,7 @@ For stage 3:
11. **The agent's config, and printer names on both sides.**
- The agent reads its own file, `/etc/uberbringer/agent.toml`, which holds `[agent]`, `[agent.printers.<name>]`, `[log]` and `[sentry]` only. Any other section is an unknown key, so a main config given to the agent fails at start with a clear message.
- `[agent]`: `url` (main's base URL), `name`, `token_file`, `ca_file` (empty: the system roots), `state_dir` (empty: a journal in memory, decision 13) and `max_job_bytes` (decision 3). Each scalar key also reads `UBERBRINGER_AGENT_<KEY>`.
- `[agent.printers.<name>]`: `address` and `port` (9100) only, from the file only, as printers question 2 has for named tables. The agent writes only to printers its own file lists, so a compromised main cannot use it to reach other hosts on the remote network.
- `[agent.printers.<name>]`: `address` and `port` (9100) only, from the file only, as printers decision 2 has for named tables. The agent writes only to printers its own file lists, so a compromised main cannot use it to reach other hosts on the remote network.
- A printer has one name, main's. The agent's tables use the names that main's printer tables use. `Hello` lists the names, never the addresses. A remote printer main configures that the agent does not list reads as `unreachable` with a WARN; a name the agent lists that main does not use draws a WARN and is ignored.
- Timeouts stay on main (decision 16), which owns each job's time budget and sends them with each request.
- Trade-off: a container agent mounts a config, since its printers come from the file. Renaming a printer means editing both files.
@@ -103,7 +103,7 @@ For stage 4:
- A remote printer keeps the layout keys (`model`, `codepage`, `paper_width`, `columns`, `box_line_spacing`, `cut_feed`), the timeouts (`dial_timeout`, `write_timeout`, sent to the agent with each attempt) and the retry keys (`retries`, `retry_delay`). `address` and `port` are refused beside `agent`; they belong to the agent's file.
- A remote printer's `dial_timeout` is at most 30 s and its `write_timeout` at most 60 s. The agent caps what it receives at the same values, which agentproto holds, so the agent's stop timeout can be set without main's config (decision 21).
- `[printer]` may be remote, so a main on a hosted server can serve printers that are all behind agents. `printer.address` is then required only when `agent` is empty. `UBERBRINGER_PRINTER_AGENT` sets the key; `[agents.*]` comes from the file only.
- The address rule of printers question 3 applies to local printers only; main cannot see where a remote one is. The agent refuses two of its own printers at one address and port.
- The address rule of printers decision 3 applies to local printers only; main cannot see where a remote one is. The agent refuses two of its own printers at one address and port.
- Trade-off: a printer's keys are split across two files.
17. **A remote send and its outcomes.** the sequence under Architecture, A REMOTE SEND. An attempt ends in one of four outcomes:
- `done`: written in full.
@@ -115,12 +115,12 @@ For stage 4:
- This adds one path that writes `uncertain` during a run; job-store writes it only at start. A lost lazy write of it still reads `uncertain` after a restart, so it needs no sync.
- Trade-off: a receipt that printed but whose answer was lost needs a person to check the paper.
18. **Deliveries while an agent is offline.** a lane whose printer's agent is offline takes nothing; its deliveries wait queued, in order, and are taken once the agent is back, however long that is, as job-store decision 6 has waiting jobs print however old.
- Its printers are marked down while the agent is offline, and so is a printer the agent does not list, for as long as it does not (printers question 24). Anycast passes over them and moves the anycast deliveries waiting on those lanes on.
- Its printers are marked down while the agent is offline, and so is a printer the agent does not list, for as long as it does not (printers decision 24). Anycast passes over them and moves the anycast deliveries waiting on those lanes on.
- The wait never holds an anycast delivery. A lane whose agent is offline counts an anycast delivery it would take as failed before any byte, so it moves on, even when every printer of its list is marked down.
- `queue.size` still bounds each lane, so `Submit` answers `queue_full` once a lane is full. With the memory store, the waiting deliveries are lost at main's restart, as today.
- An attempt in hand when the link drops is resolved as decision 17 says; it is not counted as a retry.
- Trade-off: after a long outage the backlog prints at once, stale receipts included.
19. **Status through the agent.** on demand. Main sends `Status` with its deadline. The agent reads `DLE EOT` with its `printer.Client`, reads a not-ready answer again after 750 ms (printers question 23's settle function), and answers with the decoded status. Main's 3-s bound for `/healthz` holds; a missed deadline is `timeout`, never a fault.
19. **Status through the agent.** on demand. Main sends `Status` with its deadline. The agent reads `DLE EOT` with its `printer.Client`, reads a not-ready answer again after 750 ms (printers decision 23's settle function), and answers with the decoded status. Main's 3-s bound for `/healthz` holds; a missed deadline is `timeout`, never a fault.
- An agent that is offline, or that does not list the printer, reads `unreachable` (`503` for the default printer). Concurrent reads of one remote printer share one request.
- The request carries the model, so a TM-T88VII's `GS r 1` (printers stage 4a) is read at the agent as at main.
- Trade-off: each `/healthz` call costs a round trip and a printer connection at the remote site, as it costs a connection locally. Status is read one round trip later than locally.
@@ -201,7 +201,7 @@ THE REPOSITORY TODAY
WHERE THE REPORTS DISAGREE OR ARE UNSURE
- Whether Caddy's `request_body max_size` reaches an upgraded connection: not stated, and assumed not; stage 2 checks it.
- Whether a printer behind a UB-E02 or UB-E03 takes the connection and holds the bytes while it is offline: printers question 23's paper check. It decides the anycast check at the agent too.
- Whether a printer behind a UB-E02 or UB-E03 takes the connection and holds the bytes while it is offline: printers decision 23's paper check. It decides the anycast check at the agent too.
- The time of a synced append on an SD card, which bounds decision 15's wait at the agent and main's own mark: job-store stage 1a measures main's; the agent's journal is not measured.
- The round trip to a remote site and its effect on `/healthz`'s 3-s bound: not measured.
- fasthttp/websocket's long gap since its last release: no advisory was found, and none was searched for beyond the module proxy. Stage 2 runs govulncheck.
@@ -313,7 +313,7 @@ MESSAGES (stage 1; decision 2)
| `query` | main | attempt keys |
| `query_reply` | agent | journal ID, `oldest`; per key: an outcome, or `none` for no record |
- An attempt key is the job's ID, main's printer name and the attempt number: `job_…/shop-front/3`. Main's store already holds all three, so it can ask after its own restart (decision 20). Each delivery's attempt numbers are unique, and attempt numbers go on across the printers of an anycast list (printers question 22).
- An attempt key is the job's ID, main's printer name and the attempt number: `job_…/shop-front/3`. Main's store already holds all three, so it can ask after its own restart (decision 20). Each delivery's attempt numbers are unique, and attempt numbers go on across the printers of an anycast list (printers decision 22).
- The agent sends an error's class and a text without the printer's address; its own log keeps the whole error. No message carries an address.
- `Data` arrives in order on one stream. Offset 0 starts a new buffer for its printer, dropping an unfinished one. Any other offset that does not follow, or bytes past `max_job_bytes`, is a protocol error.
- Outcomes are strings. A missing, empty or unknown outcome reads as `unknown`; `none` is explicit and appears only in `query_reply`.
@@ -371,7 +371,7 @@ STATUS (stage 4; decision 19)
OFFLINE AGENTS (stage 4; decision 18)
- A lane whose printer is remote waits, before it takes a delivery, until its agent is connected and lists that printer. printqueue gains an optional interface on a `Sender` for that wait (`Gate`, name assumed); a local printer does not implement it, and its lane behaves as today.
- The wait holds unicast and multicast deliveries only. An anycast delivery at a closed gate counts as failed before any byte and moves on (decision 18).
- On a link's loss, main marks the agent's printers down for as long as it is offline, and a printer the agent does not list for as long as it does not (printers question 24). That moves anycast deliveries on.
- On a link's loss, main marks the agent's printers down for as long as it is offline, and a printer the agent does not list for as long as it does not (printers decision 24). That moves anycast deliveries on.
- Deliveries keep their order. A delivery's 2-minute bound starts when it is taken, so waiting for an agent does not use it up.
SHUTDOWN AND RESTARTS