commit 5641808f15789ddf781737935100197c0ea54845
parent 3f77fed6c6e80c78693d2daabb979582938e4c0a
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 19 Sep 2026 03:43:59 +0530
parent 3f77fed6c6e80c78693d2daabb979582938e4c0a
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 19 Sep 2026 03:43:59 +0530
Fix critical bugs in glossary refactoring (spec compliance) Fix three critical issues identified by spec review: 1. CAN_DECIDE macro bug: checks rendered_seq=render_seq instead of render_seq=revision to verify worker completed. This was preventing signers from recording decisions after submit. 2. render_seq/render_kind not set at submit: add render_seq increment and render_kind='stamp' to UPDATE statement per REBUILD.md ยง5. 3. RESUBMITTED event missing: detect resubmits from CORRECTION_REQUIRED status and log RESUBMITTED event instead of just SUBMITTED. 4. CSS status classes not updated: fix old PENDING_APPROVAL/CORRECTED/ APPROVED class names to PENDING/RELEASED in style.css. These fixes ensure: - The "worker is busy" gate works correctly (rendered_seq vs render_seq) - Render jobs are properly tracked (render_kind column) - Event log correctly shows resubmission vs first submission - UI status badges display correct colors for new status values Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/signet-api.c b/src/signet-api.c @@ -38,7 +38,7 @@ static struct conf cf; #define PENDING "('PENDING')" #define IN_ROUTE(u) "EXISTS (SELECT 1 FROM jsonb_array_elements(d.route_json->'levels') l " \ "WHERE l->'signers' ? " u ")" -#define CAN_DECIDE(u) "(d.status IN " PENDING " AND d.render_seq = d.revision " \ +#define CAN_DECIDE(u) "(d.status IN " PENDING " AND d.rendered_seq = d.render_seq " \ "AND d.route_json->'levels'->(d.current_party - 1)->'signers' ? " u \ " AND NOT EXISTS (SELECT 1 FROM doc_decisions x WHERE x.doc_id = d.id " \ "AND x.revision = d.revision AND x.party = d.current_party AND x.signer = " u "))" @@ -458,18 +458,22 @@ h_doc_submit(struct kreq *r, PGconn *pg, const struct ident *id, const char *doc if (r2 != NULL) PQclear(r2); r2 = db_q(pg, "UPDATE documents SET status = 'PENDING'::doc_status, " - "revision = revision + 1, " - "current_party = 1, serial = COALESCE(serial, $3), " + "revision = revision + 1, render_seq = render_seq + 1, " + "render_kind = 'stamp', current_party = 1, " + "serial = COALESCE(serial, $3), " "doc_date = COALESCE(doc_date, CURRENT_DATE), " "title = CASE WHEN title = '' THEN COALESCE(serial, $3, 'Untitled') " "ELSE title END, submitted_at = CURRENT_TIMESTAMP, render_error = NULL " - "WHERE id = $1 AND drafter_user = $2 RETURNING revision::text", 3, p); + "WHERE id = $1 AND drafter_user = $2 " + "RETURNING revision::text, " + "CASE WHEN status = 'CORRECTION_REQUIRED'::doc_status THEN 'RESUBMITTED' " + "ELSE 'SUBMITTED' END AS event_action", 3, p); if (r2 == NULL || PQntuples(r2) != 1 || (rev = strdup(PQgetvalue(r2, 0, 0))) == NULL || db_do(pg, "COMMIT", 0, NULL) == -1) { snprintf(err, sizeof(err), "submit failed"); goto fail; } - log_event(pg, docid, id->user, "SUBMITTED", rev); + log_event(pg, docid, id->user, PQgetvalue(r2, 0, 1), rev); if (enqueue(docid, rev) == -1) send_err(r, KHTTP_503, "submitted, but the stamping queue is down; " "use 'Retry stamping' once it is back");
diff --git a/www/style.css b/www/style.css @@ -37,9 +37,9 @@ tr.click:hover td { background: #f6f9fc; } .empty { color: var(--muted); padding: 1.5rem .6rem; } .status { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: .1rem .45rem; border-radius: 3px; background: #e6eaef; color: #3c4858; white-space: nowrap; } -.status.PENDING_APPROVAL, .status.CORRECTED { background: #fff1cf; color: var(--warn); } +.status.PENDING { background: #fff1cf; color: var(--warn); } .status.CORRECTION_REQUIRED { background: #ffe1d2; color: #a2461a; } -.status.APPROVED { background: #d9f2e3; color: var(--ok); } +.status.RELEASED { background: #d9f2e3; color: var(--ok); } .status.DISAPPROVED { background: #f8d9d8; color: var(--danger); } /* document workspace */
: asapien/signet