MD.OFFICE
FAL

Daily Log - 2026-03-13

Achievements

  • Fixed "Unconfigured Formula" Validation Bug: Resolved an issue where formula fields using conditional logic (Rules) were incorrectly flagged as "Unconfigured" during template save. This was caused by the orchestrator naively checking the formula property while ignoring the rule-based configuration (useRules and defaultFormulaId).

  • Improved Validation Consistency: Aligned the design-time save validation with the real-time UI validation logic in DynaformService.

  • Refined Codebase Documentation: Updated dynaforms-history.md to document the fix and provide context for future maintenance.

  • Code Cleanup: Assisted in refining the formatting and indentation of BuilderValidationOrchestratorService for better readability.

  • Unified Rule Type Validation: Implemented a comprehensive validation system in the Builder (RightPanelStaticComponent) to block invalid rule configurations during design-time. This prevents users from saving mismatched comparisons (e.g., Date vs Number).

  • Improved Formula Metadata: Enhanced field suggestion logic to capture outputType for formula fields, enabling accurate type-checking for rules referencing other formulas.

  • Stable Runtime Evaluation: Refined the evaluateComparison logic to return false on type mismatches instead of throwing errors, ensuring the Renderer remains stable without requiring complex error handling.

Changes

  • Modified: builder-validation-orchestrator.service.ts
    • Updated isUnconfiguredFormulaField to account for useRules.
    • Applied formatting fixes for better alignment and readability.
  • Modified: right-panel-static.component.ts
    • Implemented getRuleConditionError for unified structural and type validation.
    • Updated updateFormulaFieldSuggestions to capture outputType for formula fields.
    • Integrated proactive validation into saveRuleFromConfigurator with toast feedback.
  • Modified: formula-rule-evaluator.util.ts
    • Simplified static value comparison logic (numeric-only).
    • Reverted error-throwing to return false for silent/safe runtime failure on type mismatches.
  • Modified: formula-field.component.ts
    • Cleaned up redundant toast logic/imports and relied on Builder-side validation for user feedback.

[2026-03-13] Dynaforms: Date Formula Robustness & Validation Fixes

Key Achievements

1. Date Formula Safeguards (Missing Operands)

  • Problem: Incomplete formulas like @End Date - @Start Date where one field was empty produced massive negative timestamps (e.g., -177230340000) due to JavaScript's null-to-0 coercion.
  • Solution: Implemented explicit null-guards in the backend FormulaController.ts. Arithmetic operations involving Date objects now return null if any operand is missing, ensuring the UI remains clean until all inputs are provided.

2. Flexible Date Arithmetic Validation

  • Problem: Valid formulas such as @Start Date + 10 - @End Date were blocked as "Invalid Addition".
  • Solution: Refactored validateDateArithmetic in FormulaBuilderComponent. Removed overly restrictive catch-all guards and implemented a smarter regex-based check that distinguishes between invalid Date + Date sums and valid mixed-math durations.

3. Technical History Internal Documentation

  • Action: Updated docs/dynaforms-history.md with granular details on the architectural decisions and solutions for today's tasks, maintaining the project's documentation standards.

Summary of Changes

  • Backend: FormulaController.ts logic hardened for date arithmetic.
  • Frontend: FormulaBuilderComponent validation logic refactored for flexibility.
  • Documentation: Comprehensive updates to technical history.
  • Reactive Matrix Sum Formulas: Resolved a critical reactivity bug where formulas referencing Matrix sums were not updating. By enabling event emission (emitEvent: true) in MatrixComponent.calculateTotal, we ensured that any change in matrix cell data or row structure (iterative) immediately triggers dependent formula re-evaluations.
  • Client Demo Ready Assets: Created a comprehensive Demo Playbook (7 scenarios) and a ready-to-use Matrix Demo Example to facilitate a professional client presentation today.

Changes