8000 Add a guard behavior for validation and authorization by kzu · Pull Request #291 · devlooped/stunts · GitHub
[go: up one dir, main page]

Skip to content

Add a guard behavior for validation and authorization - #291

Merged
kzu merged 1 commit into
mainfrom
dev/guard
Oct 12, 2026
Merged

kzu merged 1 commit into
mainfrom
dev/guard

Conversation

@kzu
@kzu kzu commented Oct 12, 2026
Copy link
Copy Markdown
Member

Summary

  • Add GuardBehavior in Stunts.Extensions. A predicate returns an exception to fail the call, or null to continue, and it does not call the rest of the pipeline.
  • A synchronous member throws that exception on the caller thread. A Task or ValueTask member returns a faulted awaitable of the same type, so the target does not run.

Test plan

  • Pipeline tests cover a rejected call, an accepted call, void, Task, Task<T>, ValueTask, ValueTask<T>, and OperationCanceledException
  • The generated-stunt scenario checks that the caller observes ArgumentNullException and that an accepted call runs the target once

Fixes #268

@kzu kzu added the enhancement New feature or request label Oct 12, 2026
@kzu
kzu enabled auto-merge (rebase) October 12, 2026 20:39
@kzu
kzu merged commit adb9325 into main Oct 12, 2026
@kzu
kzu deleted the dev/guard branch October 12, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a guard behavior for validation and authorization

1 participant

0