Activity Log - 2025-11-25

Analysis

  • Completed Column Mapping Feature (Cycle 4: Edge Mapping):

    • Extended the CSV Import modal to support edge column mapping (Source/Target fields)
    • Key decisions captured in extensive technical review:
      • Optional types (source?, target?) for form-like state where values start undefined
      • Namespacing of mapping state (node vs edge) considered but deferred
      • No state persistence across modal reopens (complexity outweighs benefit)
    • Identified validation logic gap: isMappingValid was not updated for edge validation (bug documented)
    • Implemented referential integrity: edges check against validNodes (not all nodes), so edges referencing dropped nodes are also dropped
  • Created Comprehensive Technical Review Document (1600+ lines):

    • Executive summary, architectural overview, detailed code analysis
    • Performance analysis (parallel parsing opportunity, deduplication via Map)
    • Security & validation considerations
    • Complete problem/solution breakdown for 4 critical issues encountered
    • This serves as a template for future feature reviews
  • Documented Learnings:

    • TypeScript Best Practices:
      • Avoid Non-Null Assertions (!) - use explicit guards or destructuring
      • “Parse, Don’t Validate”: Transform loose input into strict types at the boundary
      • Use Type Predicates (isNode(n)) instead of as Node[] for type safety
    • React Patterns:
      • Controlled vs Uncontrolled: Start with Controlled for critical UI components
      • Animation Cleanup: Use onAnimationEnd instead of setTimeout to avoid magic numbers
    • Refactoring Insights:
      • Key-based Reset pattern for robust state reset in controlled components
      • Layered Architecture: Domain (parsing), State (hook), and UI layers
      • Explicit State Clearing on validation failure (YAGNI on unused complexity)
  • Created Refinement Plan for Post-Cycle Polish:

    • Phase 1: Structural refactoring (group state, fix animation cleanup)
    • Phase 2: Core logic changes (make edge file mandatory, strict typing, ID sanitization)
    • Phase 3: Validation & polish (fix Source!=Target validation, limit warnings display)

Raw Commits

Repository: meaningfool/lineage-graph-app Commit: [8d429aa5001e0c14767fcef421dc37832a453117] Merge branch ‘feat/column-mapping’ Description: Learnings & Insights:

TypeScript Best Practices

  • Avoid Non-Null Assertions (!): Use explicit guards or destructuring.
  • Parse, Don’t Validate: Transform loose input into strict types at the boundary.
  • Type Predicates: Use isNode(n) instead of as Node[] for type safety.

React Patterns

  • Controlled vs Uncontrolled: Start with Controlled for critical UI components.
  • Animation Cleanup: Use onAnimationEnd instead of setTimeout to avoid magic numbers.

Refactoring & Polish (Cycle 4)

  • Key-based Reset: Adopted the ‘Key-based Reset’ pattern (Controlled Component) for robust state reset.
  • Layered Architecture: Refactored into Domain (parsing), State (hook), and UI layers.
  • Explicit State Clearing: Explicitly clear invalid state on validation failure.
  • YAGNI: Removed unused ‘Controlled Mode’ complexity.