Record that every install is fresh until v1
The owner decided on 2026-12-01: "No active installs, don't concern self with upgrade paths, we assume until v1 that every install is new/fresh/breaking". The releases plan records it as decision 19 and applies it: - Until v1 any release may break callers, configs, installs and stores, and the CHANGELOG says so once at its top. Entries list what each version has, with no upgrade or migration steps and no Breaking heading. - The release checklist tests fresh installs only: install.sh in Debian and Ubuntu containers, and the Docker image. The upgrade test, the 0.1 config check and the open question about 0.1 hosts go. - No data is migrated. jobstore's schema steps give way to one schema and its version, and a binary refuses a jobs.db of any other version, naming the file and saying to move it aside or remove it. v0.2.0 gains that commit and one that rewrites the docs for fresh installs. The job-store and printers plans now raise the schema version and refuse an earlier store where they planned schema steps, and drop their downgrade notes. Phase 2b's cancelled status goes under Changed. design.md's Why no longer says 0.1 installs are deployed, its 0.1 compatibility bullet becomes the decision, and install.sh migrates nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
515d5ae699
commit
2497157b36
4 files changed
+89
-83
No files matched your search
+28
-20
@@ -8,10 +8,11 @@ in docs/ describe how to use it.
|
||||
## Why
|
||||
|
||||
Scripts and services on the owner's network send short JSON jobs, and one
|
||||
Epson receipt printer prints them. The daemon replaces the 0.1 one on the
|
||||
same endpoint, `POST /api/v1/print` behind a TLS reverse proxy, and 0.1
|
||||
installs are deployed. It is one static binary, which keeps its jobs in a
|
||||
SQLite file of its own, sized for receipt rates on one printer.
|
||||
Epson receipt printer prints them, through `POST /api/v1/print` behind a
|
||||
TLS reverse proxy. No 0.1 install is in use, and until v1 every install
|
||||
is a fresh one (owner, 2026-12-01). It is one static binary, which keeps
|
||||
its jobs in a SQLite file of its own, sized for receipt rates on one
|
||||
printer.
|
||||
|
||||
```text
|
||||
client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (1 worker) ◀──▶ jobstore
|
||||
@@ -233,8 +234,8 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
|
||||
syncs the log's header, three syncs more on a job that should cost
|
||||
one.
|
||||
- Open checks every page (`quick_check`), since SQLite would otherwise
|
||||
meet a damaged page only mid-run, and refuses a schema newer than
|
||||
the binary's.
|
||||
meet a damaged page only mid-run, and refuses a file of any other
|
||||
schema version, naming it: nothing is migrated until v1.
|
||||
- **Shutdown.** With the store, waiting jobs stay queued and print after
|
||||
the next start, in order, however old. A job that has not reached
|
||||
`sending`, still rendering, dialling or waiting to retry, stops and
|
||||
@@ -523,12 +524,15 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
|
||||
schemas allow fields added later. Nothing in the document is written by
|
||||
hand. The server gets the document in its config, so the generator does
|
||||
not build the package that embeds its own output.
|
||||
- **What stays compatible with 0.1.** The endpoint, the HS256 tokens and the
|
||||
config keys stay as they were, though a job with raw elements now needs a
|
||||
token issued with `--raw`. The 0.1 body and its plain-text answer do
|
||||
not. A 0.1 body gets a `400` that points to the element format in
|
||||
`docs/api.md`, instead of being translated. Tokens are read only from the header, because tokens in
|
||||
query strings end up in proxy logs.
|
||||
- **Nothing stays compatible with 0.1 or between releases before v1
|
||||
(owner, 2026-12-01).** His words: "No active installs, don't concern
|
||||
self with upgrade paths, we assume until v1 that every install is
|
||||
new/fresh/breaking". Any release may break callers, configs, installs
|
||||
and stores; the CHANGELOG lists what each version has, with no upgrade
|
||||
or migration steps. A 0.1 body gets a `400` that points to the element
|
||||
format in `docs/api.md`, instead of being translated. Tokens are read
|
||||
only from the header, because tokens in query strings end up in proxy
|
||||
logs.
|
||||
- **Stack choices (owner, 2026-11-29):**
|
||||
- Fiber v3 instead of Echo.
|
||||
- TypeID (UUIDv7) job and request IDs instead of snowflakes. They sort by
|
||||
@@ -560,8 +564,8 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
|
||||
Caddy replaced nginx and acme.sh because it issues and renews
|
||||
certificates itself, so the installer needs no webroot, cron job or
|
||||
certificate paths.
|
||||
- `install.sh` sets up a fresh host, and re-runs upgrade what it set up.
|
||||
It does not migrate hosts set up by the 0.1 script (owner, 2026-11-30).
|
||||
- `install.sh` sets up a fresh host. It migrates nothing, from 0.1 or
|
||||
from an earlier release; a re-run keeps the config.
|
||||
It reads the settings Caddy needs through `uberbringer config get`, so
|
||||
the daemon's own loader checks the config before the service restarts
|
||||
and no TOML is parsed in shell.
|
||||
@@ -716,23 +720,24 @@ Tagged releases follow `docs/plans/releases.md`, which maps these plans
|
||||
onto `vX.Y.Z` tags. The owner decided on 2026-12-01 that a tag comes
|
||||
soon, that every tag is stable with usable features, and that anything
|
||||
not finished stays hidden from users. The same day he accepted the
|
||||
plan's details as proposed (its decisions 1-18):
|
||||
plan's details as proposed (its decisions 1-18), and decided that until
|
||||
v1 every install is a fresh one (its decision 19):
|
||||
|
||||
- v0.2.0 is the first tag: main as it stands, with `[Unreleased]`
|
||||
folded into `[0.2.0]` and written against 0.1.2. v0.2.1 follows as a
|
||||
folded into `[0.2.0]`, listing what it has. v0.2.1 follows as a
|
||||
patch, with ntfy stage 1 and a `/healthz` that reports a printer which
|
||||
stops answering. After that, each feature group is a minor of its own,
|
||||
in the order below, and a patch carries fixes alone.
|
||||
- Each tag goes out first as `vX.Y.Z-rc.N`, and the owner tags the same
|
||||
commit once the plan's checklist passes. The checklist covers the gate,
|
||||
CI on main and the release snapshot, and one smoke receipt on paper
|
||||
with the owner's OK. It also runs install and upgrade tests in podman
|
||||
with the owner's OK. It also runs fresh-install tests in podman
|
||||
containers of Debian and Ubuntu on leil-test-1, under its lease, with
|
||||
a fake printer.
|
||||
- v0.2.0 documents that the TM-T88IV reads `unknown` with `200` while
|
||||
its cover is open, and that a printer stuck after a cut-short receipt
|
||||
needs switching off and on. v0.2.1 fixes the first; the second waits.
|
||||
Its CHANGELOG says under **Breaking** that a printer that does not
|
||||
Its CHANGELOG says that a printer that does not
|
||||
answer status prints nothing unless `printer.confirm = false`. The
|
||||
ARM builds ship once the store's tests pass under QEMU.
|
||||
- A stage lands on main usable, or as library code that nothing calls.
|
||||
@@ -742,8 +747,11 @@ plan's details as proposed (its decisions 1-18):
|
||||
- The module routes' reserved `printer` and `queue.content_bytes` stay.
|
||||
The Docker image is not published. Each release attaches its
|
||||
install.sh.
|
||||
- Whether any 0.1 hosts are still in use is open. Until the owner says
|
||||
they are, no upgrade check for a 0.1-style config runs.
|
||||
- Until v1, any release may break anything, and the CHANGELOG says so
|
||||
once, at its top. Its entries carry no upgrade or migration steps and
|
||||
no **Breaking** heading. No data is migrated: a binary refuses a
|
||||
`jobs.db` of another schema version, naming the file to move aside.
|
||||
The docs describe fresh installs only.
|
||||
|
||||
1. **Job store and print previews**: `docs/plans/job-store.md` (written;
|
||||
the owner accepted every proposed default, 2026-12-01). The store is
|
||||
|
||||
+13
-9
@@ -201,7 +201,7 @@ COMPATIBILITY
|
||||
- Job status gains the `deliveries` array with docs/plans/printers.md stage 1b, for every job, whatever the number of printers (its decision 8).
|
||||
- What prints does not change. TestRenderCompat and TestPaperReceipts keep passing.
|
||||
- The Docker image keeps a job store in `/var/lib/uberbringer`, so a container that cannot write there stops at start (decision 14, **Breaking**).
|
||||
- A downgrade: an older binary refuses `[state] dir` and `queue.content_bytes` as unknown keys and ignores `jobs.db`. The CHANGELOG and docs/configuration.md say so.
|
||||
- No release promises an upgrade or a downgrade until v1, and no data is migrated (docs/plans/releases.md decision 19). A binary refuses a `jobs.db` of another schema version, older or newer, naming the file and saying to move it aside or remove it.
|
||||
|
||||
INVARIANTS
|
||||
1. Nothing reaches the printer unless the whole receipt rendered.
|
||||
@@ -347,7 +347,7 @@ type Store interface {
|
||||
RECORDS (SQLite, decision 1)
|
||||
|
||||
```sql
|
||||
-- PRAGMA user_version = 1 marks this schema; a later schema steps from it.
|
||||
-- PRAGMA user_version = 1 marks this schema; a binary refuses a file of any other version.
|
||||
CREATE TABLE jobs ( -- written once, at insert
|
||||
seq INTEGER PRIMARY KEY, -- submission order
|
||||
id TEXT NOT NULL, -- the job_ TypeID
|
||||
@@ -385,7 +385,7 @@ CREATE TABLE refs ( -- unique jobs, for the duplicate check
|
||||
- IO: the split costs one more small row per job at insert, in the same commit. `deliveries` is a b-tree of its own, so an insert can change one page more than with one table. On leil-test-1 this schema appended 11.46 WAL frames per text job, against 14.35 in the SQLite track's runs with one table.
|
||||
- Statuses are looked up in memory, so neither table needs an index on `id`, `state` or `job_seq`, and updates go by a delivery's `seq`. Each index left out is a b-tree fewer per insert. Pruning deletes a job's row and its deliveries' rows by their `seq`s, which the queue passes to `Finish`.
|
||||
- `Load` reads `deliveries` in `seq` order and attaches each row to its job by `job_seq` in memory.
|
||||
- `sequence` lets an ntfy `message_delete` find a waiting job after a restart too (phase 2b). It holds the topic and the sequence ID as `<topic>/<sequence ID>`, since ntfy's sequence IDs are per topic (`DELETE /<topic>/<sequence_id>`) and one subscription reads several topics; a topic name cannot hold `/`. It is written from stage 1d, so phase 2b needs no schema step and can cancel a job stored before it.
|
||||
- `sequence` lets an ntfy `message_delete` find a waiting job after a restart too (phase 2b). It holds the topic and the sequence ID as `<topic>/<sequence ID>`, since ntfy's sequence IDs are per topic (`DELETE /<topic>/<sequence_id>`) and one subscription reads several topics; a topic name cannot hold `/`. It is written from stage 1d, so phase 2b changes no schema and can cancel a job stored before it.
|
||||
- Content has its own table, so a status update never rewrites a body. `Load` reads each content's length, not the content.
|
||||
- `refs` is pruned to the newest 512 per source in the order they were kept, by `kept`, as the queue forgets them, apart from `jobs`, so pruning statuses never drops a reference. Job IDs do not give that order: one minted after the clock was set back, as on a board whose clock does not run while it is off, sorts before those kept. A reference kept for an earlier job is dropped and kept again as the newest. `refs` is written only for unique jobs, and its unique index on `source` and `ref` is the only index in the store.
|
||||
- Times are Unix nanoseconds, so a status reads the same after a restart as before it.
|
||||
@@ -395,7 +395,7 @@ CREATE TABLE refs ( -- unique jobs, for the duplicate check
|
||||
- The DSN is built through the connector API, or escaped, since `state.dir` may hold spaces, `#` or `?`.
|
||||
- Pragmas at open: `journal_mode=WAL`, `locking_mode=EXCLUSIVE` (decision 3), `synchronous=NORMAL`, `temp_store=MEMORY`, `journal_size_limit` of 4 MiB, `secure_delete=FAST`, and `auto_vacuum=NONE` before the tables exist. `wal_autocheckpoint` stays at 1000.
|
||||
- A synced commit runs `PRAGMA synchronous=FULL`, commits, and restores NORMAL in a defer, so a failed statement never leaves the connection at FULL. `Sending`, `failed`, inserts of unique jobs and, from phase 2b, `cancelled` commit this way.
|
||||
- Open, in order: create the file 0600 if it is missing; set the pragmas; run `PRAGMA quick_check`, which only reads (the whole file, about 2 MiB with text jobs and up to about 48 MiB with images, as the research measured), since SQLite otherwise finds a damaged page only when a statement reads it, mid-run; refuse a `user_version` newer than the binary knows, naming both; run each schema step in one synced transaction that also sets `user_version`; write once, so a second instance fails at once.
|
||||
- Open, in order: create the file 0600 if it is missing; set the pragmas; run `PRAGMA quick_check`, which only reads (the whole file, about 2 MiB with text jobs and up to about 48 MiB with images, as the research measured), since SQLite otherwise finds a damaged page only when a statement reads it, mid-run; give a new file the schema and its `user_version` in one synced transaction, and refuse a file of any other `user_version`, older or newer, naming the file and both versions and saying to move it aside or remove it (docs/plans/releases.md decision 19); write once, so a second instance fails at once.
|
||||
- `Idle` runs `PRAGMA wal_checkpoint(PASSIVE)` once 64 commits, about 20 jobs, have gathered since its last checkpoint. The queue is idle after nearly every job when receipts come one at a time, and a checkpoint costs three syncs (the log, the database, and the log's header at the next commit), so one each time would make a job cost four.
|
||||
- `sqlite.Fdatasync(true)` on Linux. The unit's syscall filter allows `fdatasync`, and on leil-test-1 it cut a synced commit's median from 5.0 to 2.9 ms with the same device writes and flushes (stage 1a).
|
||||
- Nothing else in the process opens the file, since any close drops SQLite's locks.
|
||||
@@ -411,7 +411,7 @@ API
|
||||
- Stage 1c: `status` gains `uncertain`, in the `State` enum's `jsonschema` tag, printqueue's schema test, docs/api.md, swagger.json and the CHANGELOG under **Breaking**. Status gains `sent_at` (name assumed), set once an attempt was about to write to the printer. A store failure in `Submit` is an unexpected error: `500` `internal_error`, logged and reported once, the job not accepted, and the daemon stops (decision 11).
|
||||
- Stage 1d: a job kept in the store answers its status after a restart instead of `job_not_found`.
|
||||
- Phase 2 (decision 16): `POST /api/v1/jobs/list` with `status`, `source`, `before` and `limit` in the JSON body. It answers `{"jobs": [...], "next": "job_..."}`, newest first by sequence number. Bad values answer the new code `400` `invalid_body`. The body is a Go type whose `jsonschema` tags give `status`'s enum and `limit`'s bounds, as every request body's tags do, so the generator needs no change. Job status gains `ref`. `/healthz`'s `queue` gains `uncertain`; the status code still depends on the printer alone.
|
||||
- Phase 2b (decision 17): `DELETE /api/v1/jobs/{id}`, for full tokens, answers `200` with the status, or `409` with the new code `job_started` when no delivery is left to cancel and none is cancelled. `status` gains `cancelled`, a new enum value, so the CHANGELOG lists it under **Breaking**, as it does `uncertain`. `DELETE /api/v1/print` still answers `405`, api.md's example for `method_not_allowed`.
|
||||
- Phase 2b (decision 17): `DELETE /api/v1/jobs/{id}`, for full tokens, answers `200` with the status, or `409` with the new code `job_started` when no delivery is left to cancel and none is cancelled. `status` gains `cancelled`, a new enum value clients may meet, which the CHANGELOG lists under Changed (docs/plans/releases.md decision 19). `DELETE /api/v1/print` still answers `405`, api.md's example for `method_not_allowed`.
|
||||
- Phase 3c (decision 19): `Accept: image/png` on `POST /api/v1/preview` and `POST /api/v1/preview/{module}`. Text stays the answer to `*/*`. A picture over the height cap answers `422` `preview_too_long`. The generator needs a PNG body schema (`contentMediaType: image/png`). The compress middleware sits in front of these routes; phase 3c checks that it leaves PNG alone.
|
||||
- Phase 4 (decision 20): `GET /api/v1/jobs/{id}/preview`, as text, JSON or PNG by `Accept`, as the POST preview answers, with the new code `410` `job_content_expired`.
|
||||
- Every route is an entry in the table in `server/routes.go`, written there in OpenAPI form (`{id}`; api.md writes `:id`), with its case in TestRoutesConform. Every code goes into `server/errors.go`, the table in docs/api.md and the regenerated swagger.json.
|
||||
@@ -439,7 +439,7 @@ DELIVERIES AND SEVERAL PRINTERS
|
||||
- broadcast: to every printer;
|
||||
- anycast: to one printer of an ordered list, as a priority list with failover: the first, on failure the second, then the third.
|
||||
- A job has one or more deliveries, one per printer it goes to, each tracked on its own. A multicast or broadcast job is one job with several deliveries; a unicast or anycast job has one. The state machine under JOB STATES applies to each delivery. The `Store` interface carries deliveries from stage 1c, and the database keeps them in a table of their own from stage 1d (RECORDS), so several deliveries per job need new rows, not new tables. Until the printers plan lands, every job has exactly one delivery, for the printer `default`.
|
||||
- docs/plans/printers.md decision 18 stores the route: `route_by`, `route_rule` and `route_mode` on `jobs`, and `candidates` and `sent_to` on `deliveries`, in stage 1d's first schema or in a step to `user_version` 2. So a restored anycast delivery keeps its list, and a failover after a `sending` mark keeps the record that the first printer got bytes, which TELLING WHICH RECEIPTS PRINTED relies on.
|
||||
- docs/plans/printers.md decision 18 stores the route: `route_by`, `route_rule` and `route_mode` on `jobs`, and `candidates` and `sent_to` on `deliveries`, which raise the schema's version. So a restored anycast delivery keeps its list, and a failover after a `sending` mark keeps the record that the first printer got bytes, which TELLING WHICH RECEIPTS PRINTED relies on.
|
||||
- A job's API `status` derives from its deliveries (decision 12). A delivery counts as taken from when the worker picks it up until it finishes: while it renders, waits for the printer's slot, dials, waits between retries or sends (decision 12):
|
||||
- Cancelled deliveries (phase 2b) are passed over unless every delivery is cancelled; then the job is `cancelled`. The rest of the rule reads the other deliveries.
|
||||
- `queued` while every one waits, none taken and none finished;
|
||||
@@ -704,6 +704,9 @@ internal/pkg/printqueue
|
||||
- `List(filter, before, limit)` from memory, newest first by sequence number; a `before` no longer kept is an error the server maps to `invalid_body`. The count of jobs with a delivery that `Load` turned `uncertain` at the latest start. `Status.Ref`.
|
||||
- The reprint (decisions 24-39): `Reprint(id, meta)` and `ReprintCategory(category, meta)` (names assumed) read a finished job's stored content and submit it as a new job that is not unique and records the one it reprints. A category picks per printer the newest unmarked `done` job for `last`, the newest unmarked `failed` one for `failed`, and every unmarked `uncertain` one, oldest first, for `uncertain`, never a job still waiting or printing; the new job's `reprint_of`, in the store, marks the original. They refuse an unfinished job, content and IDs no longer kept, and an empty category.
|
||||
|
||||
internal/pkg/jobstore
|
||||
- The schema gains `reprint_of` on `jobs`, the ID of the job a reprint copies, empty for any other job (decisions 28 and 32), and its version goes to 2. `Add` writes it, and `Load` reads it back, so the marks survive a restart. A store from an earlier version is refused, as INVARIANTS says; nothing is migrated (docs/plans/releases.md decision 19).
|
||||
|
||||
internal/app/uberbringer/server
|
||||
- The route `POST /api/v1/jobs/list` in the table, for full tokens; its request type, with `status`'s enum and `limit`'s bounds in its `jsonschema` tags; its handler and response type; `invalid_body` in errors.go; `Jobs` gains `List`, and `fakeJobs` with it; its case in TestRoutesConform.
|
||||
- `/healthz`: `queue.uncertain`.
|
||||
@@ -716,6 +719,7 @@ Docs
|
||||
- CHANGELOG. docs/swagger.json regenerated.
|
||||
|
||||
**Tests.**
|
||||
- A `jobs.db` at `user_version` 1, as v0.2.0 writes it, is refused, and the error names the file. A reprint's `reprint_of` survives a close and a reopen.
|
||||
- Filters by status and source, paging with `before`, a `before` no longer kept, the bounds of `limit`, and bad values and an unknown field giving `invalid_body`. An empty body, `{}` and no body give the defaults. `GET /api/v1/jobs/list` answers `404` `job_not_found`, as any path that is not a job's ID does.
|
||||
- A token limited to modules gets `403` `token_scope`.
|
||||
- schema_test: the new enums and `limit`'s bounds held to validation.
|
||||
@@ -736,7 +740,7 @@ Docs
|
||||
|
||||
internal/pkg/printqueue
|
||||
- queue.go:
|
||||
- `StateCancelled`, with `cancelled` in the `State` enum's `jsonschema` tag: a new value clients may meet, so the CHANGELOG lists it under **Breaking**, as it does `uncertain`.
|
||||
- `StateCancelled`, with `cancelled` in the `State` enum's `jsonschema` tag: a new value clients may meet, which the CHANGELOG lists under Changed.
|
||||
- Only a delivery that has not reached `sending` can be cancelled: one waiting, rendering, waiting for the printer's slot, dialling, or between retries that never reached the printer. Cancelling a job cancels those of its deliveries; one that has reached `sending`, or has finished, goes on.
|
||||
- `Cancel(id)` (name assumed) cancels the job's deliveries that have not reached `sending` and returns its status. With none left to cancel it returns the status as it is if any delivery is cancelled, so a repeated cancel answers as the first did, and `ErrStarted` (name assumed) if none is.
|
||||
- `CancelSequence(source, sequence)` (name assumed) cancels those deliveries of each job from that source whose `Meta.Sequence` (stage 1c), its notification, equals `sequence`, and returns the jobs' IDs. It matches in memory, so a job restored after a restart is found too. An empty `sequence` matches nothing, so jobs without one, HTTP and module jobs and digests, are never cancelled by it. A job with nothing left to cancel is passed over without an error.
|
||||
@@ -751,7 +755,7 @@ internal/pkg/printqueue
|
||||
- store.go: `StoredState` gains `cancelled`, and `Store` gains `Cancel(ctx, deliveries []uint64, at time.Time, p Prune) error`, one synced commit. The memory store implements it.
|
||||
|
||||
internal/pkg/jobstore
|
||||
- `Cancel`: one synced transaction that sets each delivery's `state` and `finished_at` and drops the given jobs, deliveries and contents. The `sequence` column is in the schema and written from stage 1d (RECORDS), so there is no schema step.
|
||||
- `Cancel`: one synced transaction that sets each delivery's `state` and `finished_at` and drops the given jobs, deliveries and contents. The `sequence` column is in the schema and written from stage 1d (RECORDS), so the schema does not change.
|
||||
|
||||
internal/pkg/ntfy
|
||||
- subscriber.go:
|
||||
@@ -775,7 +779,7 @@ Docs
|
||||
- docs/api.md: the route table, a "Cancel a job" section, the `job_started` row in the error table, and the Job status section (`cancelled`).
|
||||
- docs/ntfy.md: how a subscription behaves: a `message_delete` cancels the waiting receipts of its notification and drops its held digest rows, also under `min_priority` and past `max_backlog`; a `message_clear` does neither; `min_priority` is applied by the subscriber, which reads every message of its topics.
|
||||
- design.md: the state machine's `cancelled`, its synced commit and the delivery lock; the ntfy subscriptions paragraph (deletes cancel, clears do not, and the subscriber filters priorities itself).
|
||||
- CHANGELOG: under **Breaking**, the `cancelled` status; under Added, `DELETE /api/v1/jobs/{id}` and cancelling by ntfy deletes; under Changed, that a subscription with `min_priority` reads every message and filters itself.
|
||||
- CHANGELOG: under Added, `DELETE /api/v1/jobs/{id}` and cancelling by ntfy deletes; under Changed, the `cancelled` status and that a subscription with `min_priority` reads every message and filters itself.
|
||||
- docs/swagger.json regenerated.
|
||||
|
||||
**Tests.**
|
||||
|
||||
+7
-10
@@ -1,6 +1,6 @@
|
||||
# Plan: several printers, routed by Expr rules
|
||||
|
||||
Status: **planned; nothing is built.** The owner accepted every proposed default on 2026-12-01 (Decisions), and design.md's Planned next item 2 records them. By the owner's rule of 2026-12-01 that API inputs go in the JSON body (design.md, "Inputs go in the JSON body"), a request names its printer in its body, never in a query parameter (decision 7). This plan builds on docs/plans/job-store.md and does not redesign its store. Stages 1a to 3 need that plan's stage 1c: jobs with deliveries, the waiting list, `beforeWrite` and the memory store. None needs its durable store (job-store stage 1d). Where that has shipped, decision 5's restore rule applies to it, and stage 2a adds a schema step (decision 18). Each stage runs in its own session, briefed from its section:
|
||||
Status: **planned; nothing is built.** The owner accepted every proposed default on 2026-12-01 (Decisions), and design.md's Planned next item 2 records them. By the owner's rule of 2026-12-01 that API inputs go in the JSON body (design.md, "Inputs go in the JSON body"), a request names its printer in its body, never in a query parameter (decision 7). This plan builds on docs/plans/job-store.md and does not redesign its store. Stages 1a to 3 need that plan's stage 1c: jobs with deliveries, the waiting list, `beforeWrite` and the memory store. None needs its durable store (job-store stage 1d). Where that has shipped, decision 5's restore rule applies to it, and stage 2a changes its schema (decision 18). Each stage runs in its own session, briefed from its section:
|
||||
- stage 1a follows decisions 1-6, and stage 1b decisions 7-9;
|
||||
- stage 2a follows decisions 10-19, stage 2b decision 20, and stage 2c decision 21;
|
||||
- stage 3 follows decisions 22-26, after decision 23's paper check;
|
||||
@@ -120,7 +120,7 @@ For stage 2a:
|
||||
- Trade-off: a guard of our own around Expr's AST charges every predicate, though only the owner writes routing rules and they see no print content.
|
||||
18. **Storing the decision.** A route is decided once, at `Submit`, and stored; a restore never runs the rules again. The job keeps its `route`: `by` (`rule`; `request` for a printer the request names; or `default`), the rule's name and the mode, and job status shows it. An anycast delivery keeps its ordered list and the printers that got a `sending` mark (stage 3).
|
||||
- A restored anycast delivery's list is therefore not given again by the rules and the config: job-store's `jobs` row keeps no priority, tags or client, and the rules may have changed since. Evaluating stored facts again at restore would cost as many bytes, give another answer after a config change, and put topics on disk.
|
||||
- With SQLite, `jobs` gains `route_by`, `route_rule` and `route_mode`, and `deliveries` gains `candidates` and `sent_to`, names joined by commas, which a name cannot hold. If job-store stage 1d has not shipped when stage 2a starts, these columns join its first schema; otherwise stage 2a adds one schema step to `user_version` 2.
|
||||
- With SQLite, `jobs` gains `route_by`, `route_rule` and `route_mode`, and `deliveries` gains `candidates` and `sent_to`, names joined by commas, which a name cannot hold. Stage 2a adds them to the schema and raises its version. A store from an earlier version is refused, naming the file, and nothing is migrated (docs/plans/releases.md decision 19).
|
||||
- Trade-off: five columns; a job keeps the route it was given after the rules change.
|
||||
19. **Multicast and broadcast.**
|
||||
- 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.
|
||||
@@ -391,10 +391,7 @@ COMPATIBILITY
|
||||
- `/healthz` keeps `status`, `printer` and its code; it gains `printers`. `queue.pending` becomes the total across printers.
|
||||
- `queue.size` bounds each printer's queue, so a host with several printers can hold more jobs (decision 4).
|
||||
- What prints does not change. TestRenderCompat and TestPaperReceipts keep passing; stage 4b changes bytes only for a model whose paper check sets a value.
|
||||
- A downgrade: an older binary refuses `[printers.*]` and `[routing]` as unknown keys. With a durable store:
|
||||
- Between job-store stage 1d and this plan's stage 2a, an older binary opens the store, and its single worker would take every waiting delivery, whatever its printer. The queue must drain first.
|
||||
- From stage 2a's schema step to `user_version` 2, an older binary refuses to open the store, so a downgrade also moves the store aside, by the steps in docs/install.md and docs/docker.md.
|
||||
- docs/install.md and the CHANGELOG say so.
|
||||
- No release promises an upgrade or a downgrade until v1 (docs/plans/releases.md decision 19). An older binary refuses `[printers.*]` and `[routing]` as unknown keys, and from stage 2a a binary refuses a `jobs.db` of another schema version.
|
||||
|
||||
INVARIANTS
|
||||
1. Nothing reaches a printer unless the whole receipt rendered for it, with its own profile and options. A failover to a printer with other options renders in full before it sends.
|
||||
@@ -800,8 +797,8 @@ internal/pkg/printqueue
|
||||
- store.go: `Record.Route`, and `Delivery.Candidates` and `Delivery.SentTo` for stage 3; the memory store keeps them. `Add` takes a delivery inserted `failed`, and then syncs.
|
||||
- schema_test.go: the `by` and `mode` enums.
|
||||
|
||||
internal/pkg/jobstore, if job-store stage 1d has shipped
|
||||
- A schema step to `user_version` 2 with the route and delivery columns (decision 18). Otherwise job-store stage 1d's schema takes them.
|
||||
internal/pkg/jobstore
|
||||
- The route and delivery columns in the schema, whose version goes up by one (decision 18). A store from an earlier version is refused, naming the file (docs/plans/releases.md decision 19).
|
||||
|
||||
internal/pkg/config
|
||||
- config.go:
|
||||
@@ -857,8 +854,8 @@ internal/pkg/printqueue
|
||||
- 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.
|
||||
|
||||
internal/pkg/jobstore, if it exists
|
||||
- The new columns survive a close and a reopen; a database at `user_version` 1 steps to 2.
|
||||
internal/pkg/jobstore
|
||||
- The new columns survive a close and a reopen; a store from the previous version is refused, naming the file.
|
||||
|
||||
internal/app/uberbringer
|
||||
- A bad rule fails the start and `config get`, naming the rule.
|
||||
|
||||
+41
-44
@@ -1,6 +1,6 @@
|
||||
# Plan: tagged releases
|
||||
|
||||
Status: **accepted; no tag is cut.** The owner decided on 2026-12-01 that a tag comes soon, that every tag is stable with usable features, and that anything not finished stays hidden from users. The same day he accepted every proposed default, decisions 1-18 (Decisions), and design.md's Planned next records them. The plan maps what the feature plans build onto `vX.Y.Z` tags, says where each tag can land and what it needs first, and gives the checklist every tag passes. It builds nothing. Only the owner tags; landing and pushing are the coordinator's, on the owner's word. The preparation for v0.2.0 and for v0.2.1 each runs in its own session, briefed from its section. One point stays open: whether any 0.1 hosts are still in use. Until the owner says they are, the upgrade check for a 0.1-style config does not run. Once v0.2.1 is out, the checklist moves into docs/development.md, the rule for keeping main releasable into CLAUDE.md, and the rest of the train into design.md's Planned next, and this plan is deleted.
|
||||
Status: **accepted; no tag is cut.** The owner decided on 2026-12-01 that a tag comes soon, that every tag is stable with usable features, and that anything not finished stays hidden from users. The same day he accepted every proposed default, decisions 1-18, and decided that until v1 every install is a fresh one, decision 19 (Decisions). design.md's Planned next records them. The plan maps what the feature plans build onto `vX.Y.Z` tags, says where each tag can land and what it needs first, and gives the checklist every tag passes. It builds nothing. Only the owner tags; landing and pushing are the coordinator's, on the owner's word. The preparation for v0.2.0 and for v0.2.1 each runs in its own session, briefed from its section. Once v0.2.1 is out, the checklist moves into docs/development.md, the rule for keeping main releasable into CLAUDE.md, and the rest of the train into design.md's Planned next, and this plan is deleted.
|
||||
|
||||
## Decisions (owner, 2026-12-01)
|
||||
|
||||
@@ -14,14 +14,14 @@ be stable with usable features and any not done hidden".
|
||||
The owner accepted the details below on 2026-12-01 ("Accept all"). They
|
||||
are numbered, so the rest of the plan can refer to them.
|
||||
|
||||
1. **The first tag is v0.2.0.** `[Unreleased]` folds into `[0.2.0]`, which takes the tag's date, and the folded entries compare against 0.1.2, the last release.
|
||||
2. **Release candidates.** Every tag goes out first as `vX.Y.Z-rc.N` on the commit meant for the release. Gitea publishes it as a prerelease, which install.sh installs only by name. The install and upgrade tests run against it, and once they pass, the owner tags `vX.Y.Z` on the same commit. A fix moves the commit, and `rc.N+1` follows.
|
||||
1. **The first tag is v0.2.0.** `[Unreleased]` folds into `[0.2.0]`, which takes the tag's date, and lists what 0.2.0 has (decision 19).
|
||||
2. **Release candidates.** Every tag goes out first as `vX.Y.Z-rc.N` on the commit meant for the release. Gitea publishes it as a prerelease, which install.sh installs only by name. The install tests run against it, and once they pass, the owner tags `vX.Y.Z` on the same commit. A fix moves the commit, and `rc.N+1` follows.
|
||||
3. **ntfy stage 1 is v0.2.1,** a patch soon after v0.2.0. v0.2.0 ships the two faults it fixes. A subscription prints an empty card on each reconnect while ntfy writes an error into the stream after `open` (ntfy.md decision 3). A drop or restart mid-replay can lose the rest of that replay (ntfy.md decision 2). Both need the server to fail or the link to drop mid-replay.
|
||||
4. **`/healthz` while the cover is open: v0.2.0 documents it, and v0.2.1 fixes it.** Once a printer has answered a status read since the start, a read it leaves unanswered is `timeout` with `503`. A printer that has never answered stays `unknown` with `200`, so after a restart with the cover already open it reads `unknown` until the cover closes. A status check on the TM-T88IV, with the owner's OK, proves the fix. Until v0.2.1 a monitor sees `200` while the TM-T88IV's cover is open and no job waits, and while the printer is stuck after a cut-short receipt.
|
||||
5. **A printer stuck after a cut-short receipt: v0.2.0 documents it, and the fix waits.** With `printer.confirm`, every later job fails as not ready with nothing sent, and `/healthz` reads `unknown`. Switching the printer off and on clears it, and nothing prints as noise meanwhile. No plan holds a fix. Job-store decision 39 names one, a real-time clear (`DLE DC4` fn 8), and leaves it out of reprints, since it also drops whatever else the printer holds.
|
||||
6. **Printers that do not answer status.** `printer.confirm` is on by default (owner, 2026-12-01; design.md, "Done means the printer confirmed it"). v0.2.0's CHANGELOG says under **Breaking** that a printer that does not answer `DLE EOT` and `GS r 1` prints nothing. Every job then fails as not ready, and `printer.confirm = false` restores printing.
|
||||
6. **Printers that do not answer status.** `printer.confirm` is on by default (owner, 2026-12-01; design.md, "Done means the printer confirmed it"). v0.2.0's CHANGELOG says that a printer that does not answer `DLE EOT` and `GS r 1` prints nothing. Every job then fails as not ready, and `printer.confirm = false` restores printing.
|
||||
7. **The ARM builds.** v0.2.0 ships armv6, armv7 and arm64 with the CHANGELOG's note that the store is untested on ARM hardware. Before the tag, the jobstore and printqueue tests, cross-compiled for all three, run under QEMU's user-mode emulation. Debian's `qemu-user` runs them inside decision 8's Debian container on leil-test-1, under the lease, so the rig itself gains only podman. Emulation catches faults of the instruction set and the Go runtime, not those of a real board, an SD card or its timing.
|
||||
8. **The install and upgrade tests run on leil-test-1,** under the lease, in rootful podman containers. One runs the current Debian stable and one the current Ubuntu LTS, each with systemd as its first process and a fake printer inside. podman comes from AlmaLinux's own repositories for the test and goes afterwards, with the owner's OK as a change to the rig. The same podman builds and runs the Docker image. If the unit's sandbox will not start in a container, a throwaway Debian VM on pve-1 takes over, with the owner's OK. Caddy gets no certificate in a container, since it has no public name, so the test checks that Caddy's config validates and Caddy starts, not HTTPS.
|
||||
8. **The install tests run on leil-test-1,** under the lease, in rootful podman containers. One runs the current Debian stable and one the current Ubuntu LTS, each with systemd as its first process and a fake printer inside. podman comes from AlmaLinux's own repositories for the test and goes afterwards, with the owner's OK as a change to the rig. The same podman builds and runs the Docker image. If the unit's sandbox will not start in a container, a throwaway Debian VM on pve-1 takes over, with the owner's OK. Caddy gets no certificate in a container, since it has no public name, so the test checks that Caddy's config validates and Caddy starts, not HTTPS.
|
||||
9. **`queue.content_bytes` stays as built and documented.** It bounds the content of finished jobs, which job-store phases 2 and 4 read for reprints and previews by ID. Until v0.3.0 nothing reads that content.
|
||||
10. **The reserved `printer` on the module routes stays,** since the owner put it in the module envelope (design.md, "Inputs go in the JSON body"). It is described only as taking `default`, without "for a second printer". v0.3.0's reprint body (job-store decision 30) takes its `printer` the same way until printers stage 1b.
|
||||
11. **How a stage stays hidden.** A stage lands on main either usable, or as library code that nothing in the binary calls. A stage whose own wiring would show a half-made feature stays on its topic branch, and is rebased as main moves. It lands with the stage that makes the feature usable: printers stage 1a with 1b, and remote-printers stages 2 and 3 with 4 (Overview, KEEPING MAIN RELEASABLE). The printers and remote-printers plans say so. No switch is held back in code, and an unexported handler or command that nothing registers would fail staticcheck (`U1000`).
|
||||
@@ -33,6 +33,15 @@ are numbered, so the rest of the plan can refer to them.
|
||||
17. **Docs and plans just outside the binary archives stay.** README.md and api.md keep their links to design.md, whose Planned next describes unfinished work. The source archive, the whole tree at the tag (.goreleaser.yaml:82-84), keeps docs/plans/. The links point at the repository's pages and explain why the daemon works as it does, and a plan says that it is a plan.
|
||||
18. **Each release attaches its tag's install.sh,** with `release.extra_files`, and lists it in `checksums.txt`. README.md and install.md download it from the latest release with curl, or from a named release. Today no doc says where to get it, and the archives do not carry it (.goreleaser.yaml:50-79).
|
||||
|
||||
The owner made one more decision on 2026-12-01. It answers whether any 0.1 hosts are in use:
|
||||
|
||||
19. **Every install is a fresh one until v1 (owner, 2026-12-01).** His words: "No active installs, don't concern self with upgrade paths, we assume until v1 that every install is new/fresh/breaking".
|
||||
- Until v1, any release may break callers, configs, installs and stores. The CHANGELOG says so once, at its top.
|
||||
- The release checklist tests fresh installs only: install.sh in Debian and Ubuntu containers, and the Docker image.
|
||||
- CHANGELOG entries list what each version has, under Added, Changed, Removed, Fixed and Security. They carry no upgrade or migration steps. The **Breaking** heading goes too: every release may break, so it would hold everything.
|
||||
- No data is migrated. A binary that meets a `jobs.db` of another schema version, older or newer, refuses it with an error that names the file and says to move it aside or remove it. A schema change raises the version; there are no schema steps.
|
||||
- The docs describe fresh installs, with no upgrade or downgrade notes and no promise of compatibility with 0.1.
|
||||
|
||||
## Investigation findings
|
||||
|
||||
Checked on main at 188230b, offline. leil-test-1 had one read-only look, which needs no lease. Nothing was printed, the printer was not contacted, and no `config.toml` was read.
|
||||
@@ -43,28 +52,15 @@ WHERE THINGS STAND
|
||||
- CHANGELOG.md has `[Unreleased]` (8-175) above `[0.2.0] - 2026-11-30` (177-513), which was never tagged. Its links already compare `v0.1.2...v0.2.0` and `v0.2.0...main` (532-533). install.md:20-23 and install.sh:8-10 name v0.2.0 as the first release they install, and design.md:3 calls the code version 0.2.0.
|
||||
- The JSON-body series has landed. The module routes take `copies` and `printer` in an envelope, `{"payload": {...}, "copies": 2, "printer": "default"}`, and a query string on any route answers `400` `invalid_query` (design.md:505-514). The series edited the `[0.2.0]` entries in place, since no tag carries the module query.
|
||||
- main also records the owner's job-store decisions 25-39, the details of reprinting, and plans the job list as `POST /api/v1/jobs/list`.
|
||||
- Job-store phase 1 is done. Its schema has had no migration step because no release has written a `jobs.db`. From the first tag on, the schema changes only by a schema step.
|
||||
- Job-store phase 1 is done. jobstore's `Open` creates a new file at `user_version` 1 through a list of schema steps, and refuses a newer file, naming it (open.go:55-66, 249-266). With decision 19 the steps go: a file of any other version is refused.
|
||||
- `.gitea/workflows/release.yml` has never run on a tag, since none has been pushed while it exists. Its secrets, `TOKEN_GITEA` and `SENTRY_DSN` (release.yml:59-66), are untested.
|
||||
|
||||
WHAT A USER OF 0.1.2 MEETS
|
||||
- **Breaking**, from `[0.2.0]` and `[Unreleased]` as they stand:
|
||||
- `{"elements": [...]}` in place of `{"data": [...]}` (CHANGELOG.md:185-188).
|
||||
- `202` with a JSON job and a `job_` TypeID in place of `200` and text (189-191).
|
||||
- JSON errors with a `code` (192-194).
|
||||
- Tokens from the `Authorization` header only (195-197).
|
||||
- install.sh sets up a fresh host behind Caddy and does not upgrade a 0.1 host (201-202; design.md:563-564).
|
||||
- `printer.address` required, unknown keys refused, `api.secret` at least 32 bytes (203-207), and `config.toml` no longer tracked (208-210).
|
||||
- A query string on any route answers `400` `invalid_query` (198-200).
|
||||
- A job with `raw` elements needs a token issued with `--raw` (49-53).
|
||||
- A printer must answer `DLE EOT` and `GS r 1`, or `printer.confirm = false` must be set, and `GS a 0` turns the printer's automatic status off for other clients (16-36).
|
||||
- Under Security, the API secret in 0.1.x's tracked `config.toml` must be replaced (493-499).
|
||||
- Entries written against 0.2.0 that read differently against 0.1.2, which had no job status, no queue and no Dockerfile:
|
||||
- `uncertain` (12-15) is one of the statuses, not a change to them.
|
||||
- Waiting jobs after a restart (37-42) and the shutdown rule (264-265) are what the queue does, with or without `state.dir`.
|
||||
- The Docker image's store (43-48) belongs with the image itself (272).
|
||||
- The blank lines before the cut (54-60) are part of a new layout, since no 0.1 job decodes.
|
||||
- The digest's reference (162-166), the QR width (167-170) and the docs (171-175) are part of their features.
|
||||
- "Going back to 0.2.0" (80-83; configuration.md:212-215) names a release that does not exist, and install.sh refuses anything older than v0.2.0.
|
||||
THE CHANGELOG AND THE UPGRADE NOTES
|
||||
- `[Unreleased]` is written as changes to an untagged 0.2.0, and `[0.2.0]` as changes to 0.1. Both have a **Breaking** heading (CHANGELOG.md:10, 183), and the top says that breaking changes are listed under it (3-6).
|
||||
- Upgrade and 0.1 notes, which decision 19 drops:
|
||||
- in CHANGELOG.md: "Going back to 0.2.0" (80-83), the advice to read **Breaking** before upgrading a 0.1 install (179-181), what 0.1 answered or accepted (189-197), the 0.1 install script and config (201-210), "0.1 config files load as before" (365), and what a 0.1 install must change under Security (493-503);
|
||||
- in docs: configuration.md's "Going back to 0.2.0" (212-215); install.md's 0.1 host (5-6), its older config without `state.dir` (36-43) and "Re-running the script upgrades the install" (56-58); "a newer version" in install.md's and docker.md's "A job store that will not open"; docker.md's "after a pull or an upgrade" (65-66); and README.md's "and upgrading" (48).
|
||||
- The Security entry that 0.1.x's tracked `config.toml` held an API secret, still readable in the history (493-494), stays as a fact: that secret is public.
|
||||
|
||||
THE FOLLOW-UPS FROM JOB-STORE STAGE 1D
|
||||
- **A cut-short receipt.** When a write stops part-way, through a kill, a power cut or a dropped link, the printer can wait inside an image command for bytes that never come, and answers no status until it is switched off and on. With `printer.confirm`, the ready wait then sends nothing (design.md:73-77), and each job fails as not ready. `/healthz` reads `unknown` with `200`. `Status` gets no answer within its 2-s `statusTimeout` and reports the printer as one that does not answer status (printer.go:19, 531-535; handlers.go:250-252). configuration.md:265-269 still says the next receipt prints as noise, which holds only with `printer.confirm = false`. Decision 5.
|
||||
@@ -81,9 +77,7 @@ The search covered README.md, every doc the archives carry (.goreleaser.yaml:50-
|
||||
| `unknown_printer` | errors.go:30 | Keep: the module routes answer it for any other printer name. |
|
||||
| `invalid_query` | errors.go:29 | Keep: it answers a query string on any route. |
|
||||
| `queue.content_bytes`, whose content nothing reads until job-store phase 2 | configuration.md:178; config.example.toml:152; queue.go:808 | Keep (decision 9). |
|
||||
| "Going back to 0.2.0" | configuration.md:212-215; CHANGELOG.md:80-83 | Hide: the fold drops it. |
|
||||
| "An older config without that setting", a config without `state.dir` that no release wrote | install.md:36-38 | Hide: v0.2.0's work drops it. |
|
||||
| 0.1 users sent to "README § Quick start", which has nothing for a 0.1 host | CHANGELOG.md:201-202 | Fix in the fold. |
|
||||
| Upgrade, downgrade and 0.1 notes | THE CHANGELOG AND THE UPGRADE NOTES, above | Hide: v0.2.0's work drops them (decision 19). |
|
||||
| "v0.2.0 or later" | install.md:20-23; install.sh:8-10, 170-171 | Keep: true once v0.2.0 is tagged (decision 1). |
|
||||
| An open cover said to give `503`, and a cover flag the TM-T88IV never sends | api.md:237-238, 280-281; CHANGELOG.md:243-244 | Fix the docs before v0.2.0 (decision 4). |
|
||||
| A stuck printer said to print the next receipt as noise | configuration.md:265-269 | Fix the doc before v0.2.0 (decision 5). |
|
||||
@@ -96,7 +90,7 @@ THE RELEASE TOOLING
|
||||
- release.yml runs on `v*` tags, refuses a tag whose commit is not on main (release.yml:24-31), checks that the Go release is the one go.mod names (38-46), and runs goreleaser 2.20.3 (50-64). It runs no gate: test.yml does, on every branch push, main's included (test.yml:7-9), and security.yml runs govulncheck on pushes to main and weekly (security.yml:6-10).
|
||||
- goreleaser builds linux amd64, armv6, armv7 and arm64 without cgo (.goreleaser.yaml:17-40). It puts the docs it lists in each archive (42-80) and publishes `-rc.N` tags as prereleases (94-96). The release notes start with a link to the CHANGELOG at the tag (97-100).
|
||||
- A tag can come only from main, so any tag, a patch included, carries everything on main. There is no release branch. A feature stage that lands between a minor and its patch turns the patch into a minor.
|
||||
- install.sh installs Gitea's `latest`, the newest release that is neither a draft nor a prerelease (install.sh:37-39). A re-run upgrades and keeps the config, an edited Caddyfile and unit drop-ins (11-13), and reads the config with the new binary before it restarts the service (247-261).
|
||||
- install.sh installs Gitea's `latest`, the newest release that is neither a draft nor a prerelease (install.sh:37-39). A re-run replaces the binary and keeps the config, an edited Caddyfile and unit drop-ins (11-13), and reads the config with the new binary before it restarts the service (247-261).
|
||||
- No image is published. docs/docker.md:7-12 has users build it from the Dockerfile, which sets `state.dir` to `/var/lib/uberbringer` (Dockerfile:45-46).
|
||||
|
||||
TEST HOSTS
|
||||
@@ -109,12 +103,11 @@ WHERE THIS IS UNSURE
|
||||
- Whether release.yml works on a tag, and whether its secrets hold. The first release candidate shows it (decision 2).
|
||||
- Whether Gitea serves `releases/download/latest/...` as install.sh's comment says. It was not checked; step 9 of the release checklist covers it.
|
||||
- Whether the unit's sandbox starts inside a podman container with systemd. Decision 8 falls back to a VM if not.
|
||||
- Whether 0.1 hosts are still in use. The upgrade check for a 0.1-style config runs only if the owner says so.
|
||||
|
||||
## Overview
|
||||
|
||||
VERSIONING
|
||||
- Semantic Versioning, in 0.x. A minor, `v0.Y.0`, carries new features and anything under **Breaking**. A patch, `v0.Y.Z`, carries fixes alone: no new key, route, field, enum value, error code or command, and nothing under **Breaking**. CHANGELOG.md:3-6 already says a minor may break callers until 1.0.
|
||||
- Semantic Versioning, in 0.x. A minor, `v0.Y.0`, carries new features and any change that breaks a caller, config, install or store. A patch, `v0.Y.Z`, carries fixes alone: no new key, route, field, enum value, error code or command, and nothing that breaks. Until v1 any release may break anything, and the CHANGELOG says so at its top (decision 19).
|
||||
- Tags are `vX.Y.Z` on main, cut by the owner, each after a release candidate (decision 2).
|
||||
- In the last commit before a tag, `[Unreleased]` becomes the version's section, dated the day the owner means to tag, and an empty `[Unreleased]` stays above it. If the tag slips, a one-line commit moves the date.
|
||||
|
||||
@@ -124,10 +117,10 @@ THE TRAIN
|
||||
|-----|------------------|--------|-------------|
|
||||
| v0.2.0 | Everything on main: elements and blocks, previews, the note, notify and ntfy modules, scoped tokens, ntfy subscriptions, jobs that survive a restart, confirmed jobs, the Caddy installer, the hardened unit, the Docker image | What main has | Phases, v0.2.0 |
|
||||
| v0.2.1 | A subscriber that keeps its replay and prints nothing for ntfy's errors; `/healthz` that reports a printer that stops answering | ntfy stage 1; the fix of decision 4 | Phases, v0.2.1 |
|
||||
| v0.3.0 | The job history (`POST /api/v1/jobs/list`), a job's `ref`, the `uncertain` count in `/healthz`, reprints by ID and by category, cancelling waiting jobs over HTTP and by ntfy deletes; `cancelled` under **Breaking** | job-store phases 2 and 2b | jobs.db's first schema step, to `user_version` 2, for `reprint_of` and the mark (job-store decisions 28 and 32), which phase 2 must add, since v0.2.0 ships the store, and which job-store.md does not name yet. 2b needs no step and can go alone first, as v0.3.0, if the owner wants cancelling sooner |
|
||||
| v0.3.0 | The job history (`POST /api/v1/jobs/list`), a job's `ref`, the `uncertain` count in `/healthz`, reprints by ID and by category, cancelling waiting jobs over HTTP and by ntfy deletes; `cancelled`, a new status value | job-store phases 2 and 2b | Nothing outside the plan. Phase 2's `reprint_of` raises `jobs.db`'s schema version, so v0.3.0 refuses v0.2.0's store (decision 19). 2b changes no schema and can go alone first, as v0.3.0, if the owner wants cancelling sooner |
|
||||
| v0.4.0 | Image previews as PNG, and previews of stored jobs by ID | job-store phases 3a-3c and 4 | A bitmap font that meets job-store decision 19; phase 3a stops and asks the owner otherwise |
|
||||
| v0.5.0 | Named printers, each chosen per request; `deliveries` in job status; `/healthz` per printer | printers stages 1a and 1b | job-store stage 1c, which is done |
|
||||
| v0.6.0 | Routing rules in Expr: unicast, multicast and broadcast, a reload on SIGHUP, and `uberbringer route` | printers stages 2a-2c | Expr, which adds 5.3-5.8 MB to the binary (printers decision 10); a schema step for printers decision 18's columns, which becomes `user_version` 3 after phase 2's step; printers.md:121 still says 2 |
|
||||
| v0.6.0 | Routing rules in Expr: unicast, multicast and broadcast, a reload on SIGHUP, and `uberbringer route` | printers stages 2a-2c | Expr, which adds 5.3-5.8 MB to the binary (printers decision 10). Printers decision 18's columns raise `jobs.db`'s schema version (decision 19) |
|
||||
| v0.7.0 | Anycast with ordered failover | printers stage 3 | Printers decision 23's paper check before the stage starts |
|
||||
| v0.8.0 | Remote printers through an agent, `install.sh --agent` | remote-printers stages 1-5 | printers stages 1a and 1b, and stage 3 for anycast to remote printers; a test host behind Caddy (remote-printers stage 2) |
|
||||
| v0.9.0 | Templates served as modules, rules for ntfy messages, and their digests | templates stages 1-3 | Expr, from printers stage 2a or templates stage 1, whichever lands first |
|
||||
@@ -145,7 +138,7 @@ KEEPING MAIN RELEASABLE
|
||||
1. A stage lands on main in one of two shapes. Usable: wired, with its docs and CHANGELOG entries. Or library code that nothing in the binary calls, with its tests and no docs or CHANGELOG entry.
|
||||
2. A stage whose own wiring would show a half-made feature stays on its topic branch, rebased onto main as main moves, and lands with the stage that makes the feature usable. Such wiring is a config key that configures what no request reaches, a route for a peer that does not exist yet, or a command that has nothing to drive.
|
||||
3. No doc, schema description, error message or CHANGELOG entry describes planned work as if it exists, and the binary archives carry no plan. A stage that adds a user doc under docs/ adds it to the archives' file list (.goreleaser.yaml:50-79) and to CLAUDE.md's list of docs.
|
||||
4. Once a tag has shipped something, it stays or changes under **Breaking**: config keys, routes, fields, enum values, error codes and commands. A change to `jobs.db`'s schema comes as a schema step, and the CHANGELOG says that older versions then refuse the store. A plan that adds a column names its step.
|
||||
4. Until v1, a later minor may change or remove anything a tag shipped, and its CHANGELOG entry says what the version has (decision 19). A change to `jobs.db`'s schema raises its version, and a plan that changes the schema says so.
|
||||
- Where each plan can stop with main releasable:
|
||||
- job-store: after each of phases 2, 2b, 3a, 3b, 3c and 4. Phases 3a and 3b are library code, so nothing shows until 3c.
|
||||
- printers: stage 1a lands with 1b, since 1a's `[printers.<name>]` tables configure printers that no request reaches. After 1b, after each of 2a, 2b, 2c and 3, and after 4a and each 4b.
|
||||
@@ -159,15 +152,13 @@ Every tag passes it, the patches included. The session preparing the tag checks
|
||||
1. The tag's stages have landed on main, each with its own paper checks passed, and main is pushed. test.yml and security.yml have passed on main's latest commit, the one the tag will name.
|
||||
2. go.mod's go line names the latest Go release. If a newer one is out, the bump comes first, with the tool modules (CLAUDE.md, Go version).
|
||||
3. The full gate on that commit, as CLAUDE.md's Gate lays it out, with `go tool govulncheck ./...` and `goreleaser release --snapshot --clean`. The snapshot builds four tarballs, and each lists the docs that .goreleaser.yaml names.
|
||||
4. Docs: README.md and the docs under docs/ describe what the tag ships and nothing it does not (KEEPING MAIN RELEASABLE). The CHANGELOG's section is complete and dated, its **Breaking** says what a caller, config or install must do, and its compare links name the new tag.
|
||||
4. Docs: README.md and the docs under docs/ describe what the tag ships and nothing it does not (KEEPING MAIN RELEASABLE). The CHANGELOG's section is complete and dated, lists what the version has with no upgrade or migration steps (decision 19), and its compare links name the new tag.
|
||||
5. Paper, with the owner's OK, one receipt at a time, waiting for his report (decision 15).
|
||||
6. The owner pushes `vX.Y.Z-rc.N` on that commit. The prerelease page then shows the four tarballs, install.sh (decision 18), the source archive and `checksums.txt`, and its notes link to the CHANGELOG at the tag.
|
||||
7. The install and upgrade tests, on the test host of decision 8, under the lease, leaving it as found:
|
||||
7. The install tests, on the test host of decision 8, under the lease, leaving it as found. Fresh installs only (decision 19):
|
||||
- A fake printer in each test's network, a scratch program that answers `DLE EOT` and `GS r 1` as the TM-T88IV does. In the install containers it listens on 127.0.0.1:9100, which install.sh takes as the printer's address. Never the live printer.
|
||||
- A fresh install with `UBERBRINGER_VERSION` set to the candidate, on Debian and on Ubuntu. The service runs as `uberbringer`; the config is 0640 `root:uberbringer`; `initial-token` is 0600; `/var/lib/uberbringer` is 0700 and `jobs.db` 0600; Caddy's config validates and Caddy starts; `uberbringer version` names the candidate; a job sent to `127.0.0.1:8080` reads `done`. The job's token comes from `initial-token` into a 0600 header file that curl reads (`-H @file`), never onto the command line or into output.
|
||||
- A re-run with the same version keeps the config and a drop-in, and restarts the service.
|
||||
- An upgrade: the previous tag installed by name, with `printer.retries` raised in its config so that jobs outlast a stopped printer. With the fake printer stopped, a few jobs are sent and the service is stopped, so they wait in `jobs.db`. Then the fake printer starts, and the candidate's install.sh runs with the candidate. The waiting jobs print once each, in order, and their statuses and the config are kept. For v0.2.0, whose previous tag is v0.1.2, install.sh does not upgrade. Only if the owner says 0.1 hosts are still in use: a 0.1-style config with a `[printer]` section with `address`, and a fresh secret that is never printed, loads with `uberbringer config get` (CHANGELOG.md:203-207, 365-366).
|
||||
- The image: built with podman from the candidate's commit, run with a named volume and `--stop-timeout 40`. It runs in a podman pod beside a fake printer of its own, with its config from a 0600 env file whose secret is never printed. A job reads `done`; a new container on the same volume keeps its status. From v0.2.1 on, the previous tag's image runs first and is stopped with a job left waiting, as above, and the new one prints it once.
|
||||
- The image: built with podman from the candidate's commit, run with a named volume and `--stop-timeout 40`. It runs in a podman pod beside a fake printer of its own, with its config from a 0600 env file whose secret is never printed. A job reads `done`, and a new container of the same image on the same volume keeps its status.
|
||||
8. For v0.2.0 alone: the ARM run of decision 7.
|
||||
9. The owner pushes `vX.Y.Z` on the same commit. The release page shows its assets. Then the session, on decision 8's host under the lease, fetches install.sh as README.md says and runs it without a version in a fresh container. It installs the tag as `latest`.
|
||||
|
||||
@@ -175,15 +166,17 @@ Every tag passes it, the patches included. The session preparing the tag checks
|
||||
|
||||
### v0.2.0: the first tag
|
||||
|
||||
**Goal.** A user can install a tagged release of everything main holds, with install.sh, the tarballs or the Docker image, and upgrade from it later. The JSON-body series has landed (decision 16). Needs the ARM run of decision 7. Decisions 1, 2, 4-10 and 14-18.
|
||||
**Goal.** A user can install a tagged release of everything main holds, with install.sh, the tarballs or the Docker image. The JSON-body series has landed (decision 16). Needs the ARM run of decision 7. Decisions 1, 2, 4-10 and 14-19.
|
||||
|
||||
**Work.** One session, briefed from this section:
|
||||
- docs/api.md § Health: a printer that answers no status reads `unknown` with `200`. On the TM-T88IV that includes an open cover while no job waits, and a printer stuck inside a cut-short receipt. While a job waits for the printer, the reading is `503` `timeout`. api.md:237-238 changes with it. The cover flag (api.md:280-281; CHANGELOG.md:243-244) is not sent by the TM-T88IV, whose cover stops its status answers. design.md's status section (478-488) records that.
|
||||
- docs/configuration.md § Logs (265-269): with `printer.confirm`, a stuck printer gets nothing sent, and each job fails as not ready, until it is switched off and on. With `printer.confirm = false`, it prints the next receipt as noise.
|
||||
- The module routes' `printer`, in its doc comment (handlers_modules.go:35-36) and api.md:649: it takes only `default` (decision 10). swagger.json is regenerated.
|
||||
- install.sh's download (decision 18): `release.extra_files` and `checksum.extra_files` in .goreleaser.yaml; README.md § Quick start and install.md show the download; a CHANGELOG entry under Added.
|
||||
- internal/pkg/jobstore (decision 19): `Open` creates a new file at the binary's schema version and refuses a file of any other version, older or newer, with an error that names the file and says to move it aside or remove it. The list of schema steps becomes one schema and its version.
|
||||
- The docs describe fresh installs (decision 19): the upgrade, downgrade and 0.1 notes in install.md, docker.md, configuration.md and README.md go (Investigation findings, THE CHANGELOG AND THE UPGRADE NOTES). install.md's "Upgrading and changing the config" becomes "Changing the config". "A job store that will not open" says "another version" in place of "a newer version".
|
||||
- design.md's ARM paragraph (261-264) and the CHANGELOG's ARM entry: the store's tests pass under emulation, which is not hardware.
|
||||
- CHANGELOG.md: `[Unreleased]` folds into `[0.2.0]`, dated the day the owner means to tag. Each folded entry compares against 0.1.2 (Investigation findings, WHAT A USER OF 0.1.2 MEETS). **Breaking** keeps only what breaks a 0.1.2 caller, config or install, and decision 6's wording joins it. The rest moves under Added or Changed, into the features they belong to. The "Going back to 0.2.0" entry goes, with configuration.md:212-215. The entry at CHANGELOG.md:201-202 says what a 0.1 host does instead of pointing at the quick start. install.md:36-38's older config goes.
|
||||
- CHANGELOG.md: `[Unreleased]` folds into `[0.2.0]`, dated the day the owner means to tag. The section lists what 0.2.0 has, under Added, Changed, Removed, Fixed and Security, with no **Breaking** heading and no upgrade or migration steps (decision 19); decision 6's note joins Changed. The 0.1 and upgrade notes go. The top says once that until v1 any release may break callers, configs, installs and stores.
|
||||
- This plan's Status, in the last commit: v0.2.0 is ready to tag.
|
||||
|
||||
**Commits.**
|
||||
@@ -191,10 +184,14 @@ Every tag passes it, the patches included. The session preparing the tag checks
|
||||
2. Describe a printer stuck after a cut-short receipt
|
||||
3. Describe the module routes' printer as taking only default
|
||||
4. Attach install.sh to each release
|
||||
5. Record the ARM builds' store tests under emulation
|
||||
6. Write the 0.2.0 changelog against 0.1.2
|
||||
5. Refuse a job store of another schema version
|
||||
6. Describe fresh installs only
|
||||
7. Record the ARM builds' store tests under emulation
|
||||
8. List what 0.2.0 has in its changelog
|
||||
|
||||
**Tests.** None beyond the gate, with the release snapshot for commit 4; the rest is docs. The ARM run of decision 7 is recorded in commit 5.
|
||||
**Tests.**
|
||||
- jobstore: a new file opens at the binary's version; a file at an older or a newer version is refused, and the error names the file and says to move it aside; the file is left as it was.
|
||||
- The release snapshot for commit 4. The ARM run of decision 7 is recorded in commit 7. The rest is docs.
|
||||
|
||||
**Done when.**
|
||||
- The full gate passes on each commit.
|
||||
|
||||
Reference in new issue
Block a user