Skip to content

feat(builder): aggregate StreamBuilder validation errors into ValidationError (closes #631) - #681

Open
Ranjeet2063 wants to merge 1 commit into
conduit-protocol:mainfrom
Ranjeet2063:feat/issue-631-streambuilder-aggregate-validation-errors
Open

feat(builder): aggregate StreamBuilder validation errors into ValidationError (closes #631)#681
Ranjeet2063 wants to merge 1 commit into
conduit-protocol:mainfrom
Ranjeet2063:feat/issue-631-streambuilder-aggregate-validation-errors

Conversation

@Ranjeet2063

Copy link
Copy Markdown

Summary

Aggregates all parameter and required-field problems encountered during stream configuration into a single ValidationError carrying a .issues[] array, instead of terminating prematurely on the first invalid setter call (closes #631).

Changes

  • src/errors.ts:
    • Added ValidationIssue interface (field?: string, message: string).
    • Added ValidationError class extending Error with readonly issues: readonly ValidationIssue[] and human-friendly structured summaries.
    • Registered ValidationError in isConduitError().
  • src/builder.ts:
    • StreamBuilder setters store raw inputs without throwing immediately on invocation, enabling clean fluent chaining.
    • Added public validate(): ValidationIssue[] method for non-throwing validation inspection.
    • build() evaluates all field rules in aggregate and throws ValidationError with all detected issues in .issues[].
    • toContractArgs() surfaces missing ratePerSecond via ValidationError.
  • src/index.ts:
    • Re-exported ValidationError and ValidationIssue.
  • src/tests/stream-builder-validation-aggregate.test.ts:
    • 10/10 new unit tests verifying multi-issue collection, missing/invalid field aggregation, chaining safety, and error summary formatting.

Verification

  • 100% passing tests in src/tests/stream-builder-validation-aggregate.test.ts (10/10).
  • Full regression suite verified across builder and error test files (48/48).
  • Clean TypeScript typecheck (tsc --noEmit).
  • Zero ESLint errors.
  • Successful ESM and CJS production Rollup builds.

Copilot AI lite review requested due to automatic review settings September 5, 2026 22:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StreamBuilder: aggregate validation errors

2 participants