1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Ticket 10 — render-job contract
Implemented and targeted checks run on 2026-11-10. This is not full product
acceptance or production approval; tickets 11–14 remain open.
## Changes
- Document jobs carry `doc_id`, `revision`, `seq` and `kind`. Submit and
non-final zone sign-off enqueue only after the database transaction commits.
A post-commit queue outage returns 503 without undoing the committed action;
kind-aware retry can enqueue it later.
- The worker validates payloads and locks the matching pending document row
for its revision, sequence and kind. Stale, duplicate, malformed and already
failed jobs do not rerender or append outcome events.
- Output publication, completion/error update and outcome event are serialized
with API transitions. The update must return one row and the event/update
transaction must commit before the job is acknowledged. Database failures
retain work; startup and lost-acknowledgement recovery drain `:processing`.
- Sign renders read the last committed immutable `render-<seq>.pdf`, never the
possibly already-published `stamped.pdf`. Publication uses a temporary hard
link plus rename; after commit the previous immutable base is removed. Replay
after publication but before database commit therefore cannot double-stamp.
This does not add a history of cached copies; only the current base is needed
after success. Interrupted attempts can leave orphan scratch files; automatic
orphan cleanup is not implemented here.
- Retry increments render sequence without changing revision, preserves stored
kind, and is authorized for drafter/admin on stamp, current/preceding signer
or admin on sign/release. Completed work is not retryable. The API exposes
`rendered_seq`, `render_kind`, `rendering` and `can_retry`; browser polling,
errors and retry controls use those fields.
- Enrolment jobs are handled separately, without requiring a document id. Inbox
data survives a failed database transaction. Worker read permissions and
inbox ownership in the dev harness are corrected; stored facsimiles remain
worker-owned mode 0600.
Enabling real sign dispatch required narrow prerequisite fixes: retain layout
JSON through placement validation (removing a use-after-free), select the party
that just signed, read configured `sig_dir`, supply renderer scratch directory,
and convert reference pixels to PDF points. Broader placement validation and
final-party handling remain ticket 11.
## Verification
Clean Alpine image build with `-Wall -Wextra`: no compiler warnings.
Targeted regression entrypoint:
```sh
podman exec signet-ticket10-final sh /src/test/e2e.sh render-contract
```
Result: **`render contract: all passed`**. It verifies:
- submit/sign payloads, outstanding-render metadata and authorization;
- completed/malformed jobs, plus stale revision/sequence/kind jobs while newer
work is still outstanding;
- missing-facsimile failure and signer retry with sequence greater than revision;
- a real PostgreSQL trigger failure on completion after PDF publication;
- retained work and recovery from the processing list after worker restart;
- no duplicate facsimile images or committed worker sign events on replay;
- release dispatch and retry produce an explicit `RELEASE_FAILED`, not false
release success while the worker release branch is unimplemented;
- Redis LPUSH denial after commit returns 503 and leaves retryable work;
- an enrol job with no document id is activated by the worker.
Browser regression (dev-only Playwright Core, installed outside the repository):
```sh
PLAYWRIGHT_MODULE=/tmp/signet-ticket10-browser/node_modules/playwright-core/index.mjs \
node test/render-progress.mjs
```
Result: polling for a sequence greater than revision, stopping on error,
permission-controlled retry and completion **passed** in Chrome. API responses
are intercepted for this browser state test; the shell test exercises the real
API and worker. `node --check`, `sh -n` and `git diff --check` also pass.
Two-page edit/proof/stamped visual comparison was performed using synthetic
fixtures. Both pages retain their text positions; the non-final party's
facsimile appears inside its page-2 zone and page 1 is unchanged by sign-off.
Browser screenshots temporarily expanded the scroll containers for capture;
this is not a CSS/layout acceptance pass. The draft's browser-local date and
submitted database date differed across time zones, as expected for this run;
this check does not establish timezone policy or all text-fitting cases.
Local evidence (temporary, not committed):
- `/tmp/signet-ticket10-build-final.log` — clean image build
- `/tmp/signet-ticket10-build-incremental.log` — subsequent renderer cleanup build
- `/tmp/signet-ticket10-tests-final.log` — targeted shell regression
- `/tmp/signet-ticket10-browser-final.log` — browser state regression
- `/tmp/signet-ticket10-visual-final.log` — visual fixture id
- `/tmp/signet-ticket10-browser/{edit,proof,stamped}-{1,2}.png` — captures
## Limits and next work
- The default legacy `test/e2e.sh` flow was not certified by this task. It
contains assertions incompatible with current code/model (missing-header
401 despite the existing admin fallback, signatures already present before
sign-off, and synchronous final release). Do not report a full suite pass.
Reconcile that acceptance flow as part of ticket 11; do not weaken the model.
- API-side final release still exists. No final-party overlay/audit-history or
sequential file-visibility acceptance is claimed here (ticket 11).
- Submit-time PIM/DAM snapshotting is still missing (ticket 12). Stamp retries
still reread those mutable sources.
- This is one serial worker; concurrent workers sharing the processing list
are not supported or tested. Row locking intentionally covers rendering on
the small target machine.
- Old payloads lacking kind/sequence are rejected rather than guessed. Existing
pending documents from an older dev run require explicit retry/new payloads.
- Provider-specific authentication setup is not part of Signet. The app's
forwarded-identity trust boundary and fail-closed handling remain ticket 13;
the deployment administrator owns their authentication server.