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