Skip to content

Code Review Phase 3: Domain Layer — Pure Business Logic #24

@jitu5

Description

@jitu5

Code Review Phase 3: Domain Layer — Pure Business Logic

Purpose: Review the framework-agnostic business logic. This layer has zero React or Redux dependencies — it contains the graph algorithms and ID generation that the rest of the app relies on.

Prerequisites: Phase 1 (Type System)
Estimated time: 1 hour
Files: 4


Files to Review (in order)

Implementation

Tests


Key Concepts

  • TypeScript function overloads (generateId(type: 'node'): NodeId) provide type-narrowed return types from a single function
  • The bipartite graph constraint means connections must alternate between nodes and datasets — never node-to-node or dataset-to-dataset
  • buildDependencyGraph collapses the bipartite graph into an effective node-to-node dependency graph for cycle detection

Focus Areas

  • generateNodeId() now uses crypto.randomUUID() with a Date.now() + random fallback for environments without crypto support. Verify the fallback is adequate.
  • In detectCycleDFS: when a cycle is found, is the cycle path correctly extracted? Verify the DFS implementation handles all edge cases.
  • parseIdType identifies connections by checking if string contains BOTH node- and dataset- — could this misfire on edge cases?
  • findOrphanedNodes and findOrphanedDatasets use a Set for O(1) lookup — verify correctness
  • Are the domain functions properly unit-testable? (No hidden dependencies on React, Redux, or browser APIs?)
  • generateCopyId adds a random suffix — verify the format is consistent with ID type guards in ids.ts
  • Review PipelineGraph.test.ts — do the 27 tests cover all edge cases (empty graph, single node, self-loop, diamond dependency)?

Next: Phase 4 (Redux Store & Slices) — depends on this phase

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-reviewStructured code review phases

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions