From 8b6a387cf6af8977dbc81fd0be5c9f742c477867 Mon Sep 17 00:00:00 2001 From: Yashas Date: Tue, 8 Sep 2026 11:43:52 +0530 Subject: [PATCH] form: stop asking for what the workflow computes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `documents_status` was a dropdown — not yet / partially / all uploaded — put to the person who had just attached the files. It asked them to tell the system what it could see for itself. Not cosmetic. That field gates the AND-join that wakes Engage after an upload (55). Left on its default, the lead sits in Document Pending with all three documents attached and nothing happening, and it reads as the AI having stalled rather than as a form field nobody filled. It is derived in the trigger now (75), from the files themselves, after the commit and before the join reads it — server-side, because a value computed only in the browser would be right on screen and absent to the API. `documents_notes` goes with it: the same script writes what is still missing, and a person overwriting that would be arguing with the file list. So both are declared derived and no form asks for them, with or without a lead behind it. Matched on the base id, so every per-activity suffix is covered rather than the two that happen to exist today. --- src/api/config.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/api/config.js b/src/api/config.js index e075119..a4daff7 100644 --- a/src/api/config.js +++ b/src/api/config.js @@ -263,6 +263,25 @@ export const LINE_FIELDS = { // leads carry one too — a company-owned vehicle has an owner with a name. } +/** + * Fields the workflow computes for itself, which a form must therefore not ask + * for. Matched on the base id, so every per-activity suffix is covered. + * + * `documents_status` is the one that matters. It gates the AND-join that wakes + * Engage after an upload (55), and it was rendered as a dropdown — asking the + * person who had just attached three files to tell the system what it could + * see. Left unset, the lead sits in Document Pending with everything attached + * and nothing happening, and it reads as the AI having stalled. It is derived + * in the trigger now (75), from the files themselves. + * + * `documents_notes` goes with it: the same script writes what is still missing, + * and a person overwriting that would be arguing with the file list. + */ +export const DERIVED_FIELDS = new Set([ + 'documents_status', + 'documents_notes', +]) + /** * Form field ids carry a per-form suffix — `doc_rc` arrives as `doc_rc_2`, `pan` * as `pan_3` — so a field is matched on the id with that suffix removed. No @@ -305,6 +324,9 @@ export function leadLine(lead) { * line to filter on. */ export function fieldApplies(fieldId, lead) { + // Computed by the workflow — never asked for, on any form, whether or not + // there is a lead behind it. + if (DERIVED_FIELDS.has(baseFieldId(fieldId))) return false if (!lead) return true const on = leadLine(lead) if (!on) return true