CedarCopilot wants to merge 0 commits into staging from feat/crm-mapping-date-prefix
Live on prod, no production signal yet
Strict CloudWatch fallback found 84 recent prod failure log lines for [UpdateExternalCrmWorkflow] Driver update failed (Step updateOpportunityField failed: HTTP 400: [{\), but the same failure had 144 log lines in the comparable pre-deploy baseline. Libra is not blaming this PR.
Libra has verdicts on 0 of 1 tracked behaviors on prod; 1 is still being checked. Libra checks hourly for 3 days after each deploy.
Adds complex (template) field mappings , template / prefix / transformations , to the update_crm_field_mappings config-write change, so a user can shape what Cedar pushes to their CRM through the tool (editing their own connection) instead of hand-editing connection metadata.
Motivating use case: prepend a date stamp to Salesforce next steps , e.g. 8/19: Follow up with procurement , so a manager can see next-step freshness in their forecast view. Achieved with template:"{nextSteps}", prefix:"{today}: ", transformations:{today:{type:"date",format:"M/d"}}.
Everything downstream already supported complex mappings , the push mapper (mapCedarFieldsToCrm) evaluates template/prefix/transformations and applies the prefix idempotently, and CrmFieldMappingSchema already validates the complex shape. The config-write path just never exposed those fields. So this is plumbing only: no runtime/mapper change, no DB migration (fieldMappings is JSONB).
Because the MCP config-write tool reuses the exact exported ConfigChange union, the schema is edited in one place and both surfaces inherit it.
external-crm-field-mapping.ts , export FieldTransformationSchema so the tool reuses the exact transform shape (no re-declare/drift).applyConfigChangeTool.ts , add optional template / prefix / transformations to update_crm_field_mappings; thread them through; document in the change + tool description.connection-config.ts (updateCrmFieldMappings):
cedarFieldName XOR template (complex mappings identify their field via {placeholder} tokens, not cedarFieldName);prefix/transformations without a template;cedarFieldName behind (and vice-versa);pushEnabled keeps an existing allowedValues);CrmFieldMappingSchema before persisting , the first write-time validation on this path.cedarFieldName is dropped; and that prefix without template is rejected.applyConfigChangeTool.test.ts 10/10 pass (2 new).🤖 Generated with Claude Code
This PR exposes complex CRM template mappings through the account config-write tool and adds shared-schema validation during persistence.
The PR should not merge until complex template placeholders are validated, because a typo can be accepted and then silently prevent the intended CRM update.
The new write surface persists arbitrary template placeholders even though the downstream mapper only acts on recognized Cedar fields; the relative import is an additional non-blocking convention issue.
Files Needing Attention: apps/server/src/services/integrations/connection-config.ts; apps/server/src/mastra/skills/account-config/tools/applyConfigChangeTool.ts
| Filename | Overview |
|---|---|
| apps/server/src/services/integrations/connection-config.ts | Adds simple/complex conversion and final shape validation, but complex templates can persist unknown placeholders that later suppress CRM updates. |
| apps/server/src/mastra/skills/account-config/tools/applyConfigChangeTool.ts | Exposes complex mapp |
Libra has not measured any production surfaces for this change yet.