MD.OFFICE
FAL

Daily Log - 2026-04-29

Dynaforms: Dependent Fields (Ownership Fixes, Reentrancy Guards & Hardening)

Achievements

  • P0 Reentrancy Guard: Engineered a direct Set-based cycle guard around evaluateAndApply() to actively detect and prevent infinite evaluation loops (stack overflows) triggered by cyclically mapped clearOnHide rules.
  • Runtime Ownership Decoupling: Hardened boundaries to completely prevent the renderer engine from actively mutating the builder's stored authored configurations (required, hidden). Effects are now cleanly projected as ephemeral DOM overlays.
  • Robust Documentation: Drafted a comprehensive, senior-level end-to-end overview document (docs/dynaforms-dependent-fields-builder-renderer-flow.md) capturing engine mechanics, testing gaps, and architectural risk surfaces for subsequent phases.
  • Evaluator Unit Coverage: Aggressively expanded unit test suites covering the strict operational semantics of contains, type coercion fallbacks, non-numeric boundary guards, and empty/notEmpty validations.

Decisions

  • Immutable Authored Truth: Enforced that the Builder's raw JSON configurations represent absolute immutable ground truth; the Renderer merely overlays validations onto controls instead of modifying config.required natively.
  • Focused Doc Maintenance: Rather than leaving conflicting implementation documentation, explicitly added history tracking noting the current lack of a dedicated dependency-engine.service.jest.spec.ts in-repo while prioritizing functional evaluator utility coverage first.
  • Lightweight Cycle Protection: Chose a basic try/finally block around a memory Set for in-flight dependency tracking over heavy directed graph analysis for maximum performance with minimum operational overhead.

Technical Details

  • Modified: dependency-engine.service.ts -> Implemented evaluationInProgress: Set<string> for cycle protection, and shifted state updates to use memory streams instead of JSON config overwrites.
  • Added: docs/dynaforms-dependent-fields-builder-renderer-flow.md -> Master reference for dependency flows and architecture.
  • Modified: dependency-evaluator.util.jest.spec.ts -> Added comprehensive edge-case boundaries testing.
  • Modified: field-wrapper.component.html -> Wired the * required indicator to reflect live Angular control validity states before polling static config fallbacks.