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
Next: Phase 7 (Utilities & Hooks)
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
Files to Review (in order)
Type definitions
src/utils/validation/types.ts—ValidationError,ValidationResult,InputValidationResulttypes (canonical source forValidationError)Input validation (real-time, form-level)
src/utils/validation/inputValidation.ts— Real-time name validation, Python keyword blocklistStrategy Pattern validators
src/utils/validation/validators/CircularDependencyValidator.ts— Wraps PipelineGraph cycle detectionsrc/utils/validation/validators/DuplicateNameValidator.ts— Case-insensitive name collision checkingsrc/utils/validation/validators/EmptyNameValidator.ts— Checks for unnamed componentssrc/utils/validation/validators/InvalidNameValidator.ts— Name format checking (snake_case for datasets)src/utils/validation/validators/MissingCodeValidator.ts— Warns about nodes without function codesrc/utils/validation/validators/MissingConfigValidator.ts— Warns about datasets without configsrc/utils/validation/validators/OrphanedNodeValidator.ts— Warns about unconnected nodessrc/utils/validation/validators/OrphanedDatasetValidator.ts— Warns about unconnected datasetssrc/utils/validation/validators/index.ts— Registry factory (trimmed from 8 methods to 3)Orchestration
src/utils/validation/pipelineValidation.ts— Thin wrapper delegating to ValidatorRegistrysrc/utils/validation/index.ts— Barrel exportTests
src/utils/validation.test.ts— 29 tests: input validation (node names, dataset names, keywords)src/utils/validation/validators/validators.test.ts— 41 tests: all 8 Strategy Pattern validatorsKey Concepts
Validatorinterface withvalidate(state: RootState): ValidationError[]ValidatorRegistrycollects validators and runs them all, splitting results by severity (error vs warning)pipelineValidation.tsis a 27-line thin wrapper that delegates to the ValidatorRegistry — it is the single public API for pipeline validationValidationErroris defined inutils/validation/types.tsas the single canonical source (previously duplicated intypes/kedro.ts)Focus Areas
pipelineValidation.tsis now a thin 27-line wrapper delegating toValidatorRegistry. Verify it correctly passes through all errors and warnings.ValidatorRegistrywas trimmed from 8 methods to 3 (factory, validateAll, singleton getter). Verify the public API is sufficient.validateNodeNameallows spaces in names, butvalidateDatasetNamerequires strict snake_case — is this intentional and documented?getDefaultValidatorRegistryuses a module-level singleton — is this safe with HMR/testing?src/utils/validation.tsis a deprecated re-export shim. It is still imported by several files. Verify whether this shim should be removed and imports updated to./validation/indexdirectly.PYTHON_KEYWORDSis imported byinfrastructure/export/helpers.ts— this cross-layer dependency couples validation to export. Evaluate whetherPYTHON_KEYWORDSshould live inconstants/instead.getConnectionsArrayhelper instead of duplicating connection mapping logic.validators.test.ts— do the 41 tests cover all 8 validators with both positive and negative cases?validation.test.ts— does it cover edge cases like empty strings, unicode, Python keywords?