2026-03-21 Daily Log
Save-Time Stale Formula Reference Validation
Achievements
- Implemented Stale Reference Detection: Added logic in
BuilderValidationOrchestratorServiceto detect when a formula field references another formula whose rule branches have been modified to produce mixed output types. - Enhanced Save Validation Flow: Integrated the cross-formula reference check seamlessly into the existing single-pass traversal (
analyzeDuplicateLabelFormulaAndButtonSignals), preventing the need for an additional DOM/tree walk during save. - Separation of Concerns: Refactored the collection of formula elements during traversal. The traversal now purely collects all formula elements, leaving the filtering (e.g., finding unconfigured formulas vs. checking stale references) to dedicated, pure analysis functions.
- Precise Error Reporting: Upgraded the validation modal message to explicitly name both the referencing formula and the referenced (problematic) formula, drastically improving UX and making the errors immediately actionable for the user.
- Type Safety: Expanded the
BuilderValidationIssue.errorTypeunion to include'staleFormulaRef'and synced the local inline types incenter-panel.component.ts.
Decisions
- Stateless Validation: Chose to compute the stale reference state dynamically on every save rather than tracking dirty state changes across sessions.
- Granular Error Types: Decided to introduce a distinct
staleFormulaReferror type instead of reusing the genericformula(unconfigured) error type. This ensures that the structural policy (blocking saves) remains unified while the semantic classification (why it's blocked) remains distinct and extensible. - Optimized Tree Iteration: Used a two-loop post-traversal analysis over a very small, grouped subset of formula elements to resolve dependencies without adding overhead to the main element tree walk.
- Separation of Concerns in Traversal: Chose to derive
unconfiguredFormulaElementsvia a standard array filter after the main element tree traversal, rather than checkingisUnconfiguredFormulaField(el)inside the traversal loop. This keeps the traversal purely focused on collecting structural data, leaving the evaluation of semantic business rules to the specific analysis functions.
Files Modified
src/ifile-teapot-web-dynaforms/services/builder-validation-orchestrator.service.tssrc/ifile-teapot-web-dynaforms/components/dynaform-builder/center-panel/center-panel.component.tsdocs/dynaforms-history.md