: 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 
31 
32 
33 
34 
# 04: Parties, signature zones, sequential decisions

**What to build:** The route is an ordered list of parties (*Manager*,
*Partner*), each with exactly one signer chosen by the drafter. The drafter
reserves at most one signature zone per party, with a minimum size; a party
with no zone is check-only. Parties act strictly one after another: only the
current party's signer can see the pending document or decide, and the next
party cannot until the one before has signed off. A sign-off on a zone party
carries a placement that must lie inside the zone and meet the minimum size;
it is recorded with the decision (drawing it is ticket 06). Correction requests
restart the route from the first party; disapproval is terminal; a user may
draft and sign their own document. The old `levels`/`any`/`all` route,
username-referenced signature boxes and stamp-at-submit facsimiles are gone.

Release still runs through the existing synchronous path at the last sign-off
(audit page listing the released revision's sign-offs); ticket 06 moves it.

See `docs/REBUILD.md` §2 (`doc_decisions`, `current_party`), §4 (route and
zone JSON), §5 (`/save`, `/decide`, `/docs`, `GET /docs/<id>`), §8 (parties
editor, zone props, decision bar).

**Blocked by:** 02 (rename and render gate).

**Status:** ready-for-agent

- [ ] Save validates: 1–20 parties with unique safe names and safe signer names; every zone names a party in the route; at most one zone per party; `min_w × min_h` fits inside the zone
- [ ] Submit rejects a party without a signer; sets `current_party = 1`
- [ ] Only the current party's signer can decide (409 otherwise); a signer at a later party gets 404 on the document
- [ ] Check-only sign-off advances `current_party` with no render job; zone sign-off requires a placement on the zone's page, inside the zone, at least the minimum size, and stores it with the decision
- [ ] Correction request → `CORRECTION_REQUIRED`, resubmit → revision+1, `current_party = 1`, `RESUBMITTED` event, same serial and document date; disapproval → `DISAPPROVED`, comment required, delete refused
- [ ] Last party's sign-off releases through the existing path; `RELEASED` with `final_sha256`
- [ ] Client: parties editor (name + signer, add/remove/reorder), zone palette item with party dropdown and min size, decision bar with the three decisions, placement box for zone parties constrained to the zone (an `<area>` like any imprint), dashboard "Waiting on" column
- [ ] Templates created from a document carry parties and zones
- [ ] e2e covers validation cases, the two-party happy path, the correction round, the disapproval, and a self-service one-party document; ends with "all passed"