Recipe formula validation fails with constraint violation when linking CAD specifications

We’re encountering formula validation failures when updating recipes that link to CAD specification documents. The system rejects valid ingredient proportions with constraint violations that don’t make sense given our formula validation constraints.

The issue appears related to dynamic constraint evaluation - when a recipe references a CAD spec for dimensional tolerances, the validator can’t properly resolve the linked values. CAD specification linking works fine for static formulas, but fails with calculated ingredients.


Formula Constraint Violation: Ingredient ratio exceeds specification
at wt.formula.FormulaValidator.validate(FormulaValidator.java:445)
Linked CAD spec: tolerance=±0.05mm, actual=0.03mm

Constraint cache synchronization might be the culprit - the cached tolerance values don’t match the current CAD spec version. Has anyone successfully implemented dynamic formula validation with CAD-linked specifications?

Are you using expression-based constraints or hard-coded values? Expression-based constraints should dynamically resolve CAD spec values at validation time, but they require proper configuration of the formula engine’s expression evaluator. If you’re using hard-coded constraint values, those will never update automatically when CAD specs change.

Your CAD specification linking might be using the wrong reference type. There are two ways to link CAD specs to formulas - by object reference or by specification number. Object references lock to a specific version, while specification number references always use the latest. Check your recipe template configuration to see which reference type is being used.

I’ve seen this exact error message. The problem is that the tolerance comparison is using absolute values instead of relative percentages, causing false constraint violations.

This is a known issue with dynamic constraint evaluation when CAD specs are involved. The formula validator caches constraint values at the time of initial recipe creation, but doesn’t automatically update when the linked CAD spec changes. You need to manually refresh the constraint cache or implement a listener that updates formula constraints when CAD specs are revised.

The constraint cache synchronization is definitely your problem. When a CAD specification is updated, the formula validator doesn’t receive a notification to invalidate its cached constraints. We implemented a custom event listener that monitors CAD spec updates and triggers constraint recalculation for all dependent recipes. Without this, you’ll constantly have mismatches between CAD specs and formula validation rules. The listener needs to be registered at the site level and handle both major and minor CAD spec revisions.

Check which version of the CAD spec your recipe is linked to. If it’s pointing to an older revision, the tolerance values will be stale. You need to ensure that formula validation constraints pull from the latest approved CAD spec version, not whatever version was current when the recipe was created. This requires configuring the versioning rules in your recipe template.

Your recipe formula validation issue requires addressing all four key areas - formula validation constraints, dynamic constraint evaluation, CAD specification linking, and constraint cache synchronization:

1. Formula Validation Constraints Configuration The constraint definition must use dynamic expressions, not static values. Modify your recipe type definition:


<ConstraintExpression name="toleranceCheck">
  value="${linkedCADSpec.tolerance}"
  dynamic="true" cacheRefresh="onDemand"
</ConstraintExpression>

This ensures constraints are evaluated at validation time, not cached at creation time.

2. Dynamic Constraint Evaluation Setup Enable the dynamic evaluator in site.xconf:


<Property name="wt.formula.constraint.evaluationMode" value="dynamic"/>
<Property name="wt.formula.constraint.resolveLinks" value="true"/>

The resolveLinks property is critical - it forces the validator to fetch current values from linked CAD specs rather than using cached references.

3. CAD Specification Linking Configuration Your recipe-to-CAD-spec links must use ‘latest version’ semantics:

  • In the recipe template, set the CAD spec link type to ‘DynamicReference’
  • Configure version selection rule: ‘Latest Released’ or ‘Latest in State’
  • This ensures validation always uses current CAD spec data

Update existing recipes with this script:


// Pseudocode - Update recipe CAD links:
1. Query all recipes with CAD spec links
2. For each recipe, get current CAD spec reference
3. Replace static reference with dynamic reference
4. Update link configuration to use latest version
5. Trigger constraint cache refresh
// See Recipe Management Guide Section 7.4

4. Constraint Cache Synchronization Implement automatic cache invalidation when CAD specs change. Create an event listener:

Register in site.xconf:


<Service name="CADSpecUpdateListener"
  class="com.custom.formula.CADSpecEventHandler"/>

The listener should:

  • Monitor CAD specification update events
  • Identify all recipes linking to the updated spec
  • Invalidate constraint cache for those recipes
  • Optionally trigger re-validation if recipes are in active workflows

Immediate Fix for Your Specific Error: Your error shows tolerance=±0.05mm with actual=0.03mm, which should pass but fails. This indicates the constraint is comparing absolute values incorrectly. Check your constraint expression:

Incorrect:


actualValue <= toleranceValue

Correct:


abs(actualValue - nominalValue) <= toleranceValue

The validator needs to compare deviation from nominal, not raw values.

Validation and Testing: After implementing these changes:

  1. Create a test recipe with CAD spec link
  2. Validate the recipe - should pass
  3. Update the linked CAD spec tolerance values
  4. Re-validate the recipe without modification
  5. Verify it uses new tolerance values from CAD spec

The combination of dynamic evaluation, proper linking configuration, and cache synchronization will resolve your constraint violation issues. The event listener is the long-term solution for keeping formulas synchronized with evolving CAD specifications.