: 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 
# 07: Template and series lifecycle: retire, unlink, delete

**What to build:** An admin can retire a template or a series so drafters no
longer see it, while everything already made from it keeps working. A
retired series keeps its pattern and counters forever and can never be
deleted or re-patterned once a serial has been issued. A template can be
deleted only after an admin has unlinked every document made from it;
documents are self-contained copies, so unlinking loses nothing but the
back-reference. Templates carry their parties (with default signers) and
zones into new documents.

See `docs/REBUILD.md` §2 (`retired_at`), §5 (templates and series endpoints,
`/docs/<id>/unlink`), §8 (admin views), §9 step 9.

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

**Status:** ready-for-agent

- [ ] Retire endpoints for templates and series (admin); retired items are hidden from drafters and cannot be used to create or submit; admin listings show them with the retired date
- [ ] There is no series delete or re-pattern endpoint at all; submit against a retired series is refused; a retired series' counters keep counting for already-submitted documents' resubmits (serial unchanged)
- [ ] Template listing includes the count of linked documents; delete is refused with 409 while any document links; unlink (admin) clears the back-reference and logs `UNLINKED`; delete then removes the template row and PDF
- [ ] A new document from a template carries parties, default signers and zones
- [ ] Client: retire buttons in the templates and series views, delete with the linked count and the 409 message, unlink from the document side panel (admin)
- [ ] e2e step 9 passes; suite ends with "all passed"