Skip to content

Add validation failure and exception tracking with nested scope support to CommandScope#2166

Merged
einari merged 3 commits into
mainfrom
feat/command-scope-validation-failures-exceptions
Apr 24, 2026
Merged

Add validation failure and exception tracking with nested scope support to CommandScope#2166
einari merged 3 commits into
mainfrom
feat/command-scope-validation-failures-exceptions

Conversation

@einari
Copy link
Copy Markdown
Contributor

@einari einari commented Apr 24, 2026

Added

  • hasValidationFailures and hasExceptions boolean properties on ICommandScope and CommandScopeImplementation — aggregate across the scope and all nested child scopes
  • validationFailures (ReadonlyMap<ICommand, ValidationResult[]>) and exceptions (ReadonlyMap<ICommand, string[]>) maps for per-command inspection of the most recent execution result
  • addChildScope on ICommandScope; child scopes self-register with their parent on construction so nesting is fully automatic — commands always bind to the nearest enclosing <CommandScope>
  • Validation failures and exceptions are cleared per-command before each re-execution so state always reflects the latest result
  • Comprehensive specs covering all new behaviors (89 passing)
  • Updated scope.md documentation with nested-scope explanation, validation/exception sections, and extended API table

einari added 3 commits April 24, 2026 14:43
… CommandScope

- ICommandScope gains hasValidationFailures, hasExceptions, validationFailures,
  exceptions, and addChildScope members
- CommandScopeImplementation tracks per-command ValidationResult[] and exception
  message[] maps; clears them before each re-execution of that command
- hasValidationFailures and hasExceptions recurse into registered child scopes
  so an outer scope always reflects the aggregate state of the full hierarchy
- Child scopes self-register with their parent on construction via addChildScope
- CommandScope.tsx default context stub updated with no-op implementations
- when_executing_command_with_validation_failure: failures stored per command
- when_executing_command_with_exception: exception messages stored per command
- when_executing_command_again_after_validation_failure: cleared on re-execution
- when_executing_command_again_after_exception: cleared on re-execution
- when_child_scope_has_validation_failure: parent aggregates child failures
- when_child_scope_has_exception: parent aggregates child exceptions
- when_command_registers_to_nearest_scope: commands bind to nearest scope only
- when_parent_and_child_scopes_have_validation_failures: each scope owns its own
@einari einari added the minor label Apr 24, 2026
@einari einari merged commit 83d156e into main Apr 24, 2026
7 of 8 checks passed
@einari einari deleted the feat/command-scope-validation-failures-exceptions branch April 24, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant