: asapien/signet

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 
# 06: Facsimile overlay at sign-off, release in the worker with the full audit page

**What to build:** When a zone party signs off, the worker draws that
signer's enrolled facsimile at the recorded placement onto the stamped copy,
so the next party sees every signature given so far. When the last party
signs off, the worker overlays the final facsimile, appends the audit page —
the document's whole event log across all revisions, plus the SHA-256 of the
pages before it — and writes the release; only then does the document become
`RELEASED`. Imprints are never re-rendered after submit, so a seal or font
replaced on the DAM mid-route cannot change a pending or released document.
Retry works for stamping, signing and release. The client auto-fits the
placement box to the signer's facsimile proportions and shows "rendering…"
while any render job is outstanding.

See `docs/REBUILD.md` §5 (`/decide` job enqueueing, `/rerender`, `render()`
deletion), §6 (`sign`, `release` jobs, audit lines), §8 (auto-fit, polling),
§9 steps 5–6, §12.

**Blocked by:** 04 (parties, zones, decisions), 05 (facsimile enrolment).

**Status:** ready-for-agent

- [ ] Zone sign-off enqueues a `sign` job; the worker overlays one PNG at the placement (fit inside it, proportions kept, centred) onto the stamped copy atomically and logs `SIGNED`
- [ ] Last sign-off enqueues a `release` job; the worker overlays if needed, builds the audit lines from the document and every event (all revisions, with comments), renders the release, sets `RELEASED`, `final_sha256`, `released_at` in one statement, removes the stamped copy, logs `RELEASED`; the API's synchronous release path is deleted
- [ ] The next party can decide only once the previous sign job has rendered; the stamped copy fetched by a later signer contains the earlier facsimile
- [ ] Failure of a sign or release job sets `render_error`; retry re-enqueues the stored kind and is allowed for the drafter (stamp), the current/last signer or admin (sign/release), 403 otherwise
- [ ] Client: placement box starts at the auto fit from `GET /me` size, adjustable within the zone and minimum; polling while `rendering`; retry button shown to whoever may retry
- [ ] Replacing the seal file on the DAM after submit leaves the stamped copy and the release byte-identical
- [ ] e2e: image count grows on the stamped copy after the zone sign-off; release text contains `SUBMITTED`, `SIGNED`, `RELEASED` and, on the corrected document, the correction comment; ends with "all passed"
- [ ] Visual check: placement box and rendered facsimile coincide; earlier facsimile visible to the next party