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
formulaproperty while ignoring the rule-based configuration (useRulesanddefaultFormulaId). -
Improved Validation Consistency: Aligned the design-time save validation with the real-time UI validation logic in
DynaformService. -
Refined Codebase Documentation: Updated
dynaforms-history.mdto document the fix and provide context for future maintenance. -
Code Cleanup: Assisted in refining the formatting and indentation of
BuilderValidationOrchestratorServicefor 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
outputTypefor formula fields, enabling accurate type-checking for rules referencing other formulas. -
Stable Runtime Evaluation: Refined the
evaluateComparisonlogic to returnfalseon type mismatches instead of throwing errors, ensuring the Renderer remains stable without requiring complex error handling.
Changes
- Modified: builder-validation-orchestrator.service.ts
- Updated
isUnconfiguredFormulaFieldto account foruseRules. - Applied formatting fixes for better alignment and readability.
- Updated
- Modified: right-panel-static.component.ts
- Implemented
getRuleConditionErrorfor unified structural and type validation. - Updated
updateFormulaFieldSuggestionsto captureoutputTypefor formula fields. - Integrated proactive validation into
saveRuleFromConfiguratorwith toast feedback.
- Implemented
- Modified: formula-rule-evaluator.util.ts
- Simplified static value comparison logic (numeric-only).
- Reverted error-throwing to return
falsefor 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 Datewhere one field was empty produced massive negative timestamps (e.g.,-177230340000) due to JavaScript'snull-to-0coercion. - Solution: Implemented explicit null-guards in the backend
FormulaController.ts. Arithmetic operations involvingDateobjects now returnnullif 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 Datewere blocked as "Invalid Addition". - Solution: Refactored
validateDateArithmeticinFormulaBuilderComponent. Removed overly restrictive catch-all guards and implemented a smarter regex-based check that distinguishes between invalidDate + Datesums and valid mixed-math durations.
3. Technical History Internal Documentation
- Action: Updated
docs/dynaforms-history.mdwith granular details on the architectural decisions and solutions for today's tasks, maintaining the project's documentation standards.
Summary of Changes
- Backend:
FormulaController.tslogic hardened for date arithmetic. - Frontend:
FormulaBuilderComponentvalidation 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) inMatrixComponent.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
- Modified: matrix.component.ts
- Removed
{ emitEvent: false }fromcontrol.setValue()calls for row, column, and group sums incalculateTotal().
- Removed
- Created: demo_playbook.md
- Created: matrix_demo_example.md