: 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 
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 
TASK 4 HANDOFF: Party-based Signing and Signature Zones
========================================================

Session Date: 2026-09-19
Status: ~85% complete - Ready for render layer completion

COMMITS THIS SESSION
====================
1661b11 - Task 4 client: party-based route editor and signature zones
47dc7de - Task 4 worker: dispatch framework for stamp/sign/release jobs  
9973e16 - Task 4 API: party-based routing and sequential decisions
924584c - Task 4 schema foundation: parties, signature zones, placement (prior)

WHAT'S DONE
===========
✅ API Layer (100%)
   - Party route validation
   - Signature zone imprint type
   - Sequential party signing logic in /decide
   - Job enqueueing for sign and release

✅ Worker Framework (100%)
   - Job dispatch recognizes stamp|sign|release kinds
   - Proper status tracking with rendered_seq
   - Event logging for all job types

✅ Client Layer (100%)
   - Party editor component
   - Signature zone props (party, min_w, min_h)
   - Placement input in decide flow
   - Docs list shows party progress

WHAT NEEDS WORK
===============
⚠️ Render Layer (0% - placeholders only)
   - render_sign(): overlay facsimile PNG at placement coords
   - render_release(): build audit page from doc_events
   - Actual PDF generation using qpdf

⚠️ Placement Validation (0%)
   - Bounds checking (coords inside zone)
   - Min dimension enforcement
   - Coordinate scaling for page size

⚠️ Interactive Placement UI (0%)
   - Visual zone display
   - Draggable/resizable placement box
   - Auto-fit using facsimile dimensions

ARCHITECTURE CONFIRMED
======================
- Parties model: route has array of {name, signer}
- Sequential: party signs in order, current_party++
- Jobs: stamp → proof+stamped, sign → overlay, release → audit
- Placement: JSONB with page, coords, ref_w, ref_h

TESTING CHECKLIST
=================
✅ API validation (routes, zones, submittable)
✅ Party advancement (manager→CEO flow)
✅ Placement requirements (zone → placement required)
✅ Decision recording (SIGNOFF with placement)
✅ Job enqueueing (sign and release jobs created)

⚠️ PDF rendering (not verified - jobs are placeholders)
⚠️ Audit page content (not verified - placeholder only)
⚠️ Full e2e PDF output (needs render implementation)

NEXT STEPS (in order)
====================
1. Implement render_sign() to overlay facsimile
   - Load signer's PNG from sig_dir
   - Create overlay PDF with image at placement coords
   - Use qpdf to merge onto stamped.pdf
   - Estimated: 2-3 hours

2. Implement render_release() audit page
   - Query doc_events for all sign-offs
   - Build audit lines with party names, signers, timestamps
   - Render as new PDF page
   - Merge to create final.pdf
   - Estimated: 2-3 hours

3. Add placement validation
   - Check coords inside zone bounds
   - Enforce min_w × min_h
   - Return 409 if invalid
   - Estimated: 30 min

4. Run e2e test and verify PDF outputs
   - Check page counts
   - Verify signatures appear
   - Check audit page format
   - Estimated: 1 hour

5. Polish (optional for ship)
   - Interactive placement UI
   - Facsimile enrollment (Task 5)
   - Auto-fit logic

CRITICAL FILES FOR NEXT SESSION
================================
src/render.c  - Add render_sign() and update render_release()
src/render.h  - Add function declarations if needed
src/signetd.c - Implement sign/release job handlers
test/e2e.sh   - Already updated to party format

All changes are working and committed. Ready to proceed!