Skip to content

Code Review Phase 6: Validation Engine #27

@jitu5

Description

@jitu5

Code Review Phase 6: Validation Engine

Purpose: Review the pipeline validation system — both real-time input validation (form-level) and pipeline-level validation (export-blocking). Uses the Strategy Pattern with a ValidatorRegistry.

Prerequisites: Phases 1, 3 (Types, Domain Layer)
Estimated time: 1.5 hours
Files: 16


Validation Flow

  User clicks "Export" or "View Code"
         │
         ▼
  ┌─────────────────────────────┐
  │   ValidatorRegistry.run()   │
  │                             │
  │  ┌───────────────────────┐  │
  │  │ EmptyNameValidator    │──┼──▶ error
  │  │ InvalidNameValidator  │──┼──▶ error
  │  │ DuplicateNameValidator│──┼──▶ error
  │  │ CircularDepValidator  │──┼──▶ error  ◀── uses PipelineGraph
  │  │ OrphanedNodeValidator │──┼──▶ warning
  │  │ OrphanedDatasetValid. │──┼──▶ warning
  │  │ MissingCodeValidator  │──┼──▶ warning
  │  │ MissingConfigValidator│──┼──▶ warning
  │  └───────────────────────┘  │
  └──────────────┬──────────────┘
                 │
        ┌────────┴────────┐
        ▼                 ▼
   Has errors?        No errors
   Show panel        Proceed to export

Files to Review (in order)

Type definitions

Input validation (real-time, form-level)

Strategy Pattern validators

Orchestration

Tests


Key Concepts

  • Strategy Pattern: each validator implements the Validator interface with validate(state: RootState): ValidationError[]
  • ValidatorRegistry collects validators and runs them all, splitting results by severity (error vs warning)
  • pipelineValidation.ts is a 27-line thin wrapper that delegates to the ValidatorRegistry — it is the single public API for pipeline validation
  • ValidationError is defined in utils/validation/types.ts as the single canonical source (previously duplicated in types/kedro.ts)

Focus Areas

  • pipelineValidation.ts is now a thin 27-line wrapper delegating to ValidatorRegistry. Verify it correctly passes through all errors and warnings.
  • ValidatorRegistry was trimmed from 8 methods to 3 (factory, validateAll, singleton getter). Verify the public API is sufficient.
  • validateNodeName allows spaces in names, but validateDatasetName requires strict snake_case — is this intentional and documented?
  • getDefaultValidatorRegistry uses a module-level singleton — is this safe with HMR/testing?
  • src/utils/validation.ts is a deprecated re-export shim. It is still imported by several files. Verify whether this shim should be removed and imports updated to ./validation/index directly.
  • PYTHON_KEYWORDS is imported by infrastructure/export/helpers.ts — this cross-layer dependency couples validation to export. Evaluate whether PYTHON_KEYWORDS should live in constants/ instead.
  • Each validator now uses a shared getConnectionsArray helper instead of duplicating connection mapping logic.
  • Review validators.test.ts — do the 41 tests cover all 8 validators with both positive and negative cases?
  • Review validation.test.ts — does it cover edge cases like empty strings, unicode, Python keywords?

Next: Phase 7 (Utilities & Hooks)

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