Skip to content

Commit 6296007

Browse files
committed
fix(core): make stream_validate backend/ctx keyword-only
Prevents positional confusion and makes future parameter additions to the signature non-breaking for existing subclass overrides. Assisted-by: Claude Code
1 parent e1e0556 commit 6296007

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

mellea/core/requirement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ async def validate(
284284
)
285285

286286
async def stream_validate(
287-
self, chunk: str, backend: Backend, ctx: Context
287+
self, chunk: str, *, backend: Backend, ctx: Context
288288
) -> PartialValidationResult:
289289
"""Hook for per-chunk streaming validation.
290290

test/core/test_stream_validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_stream_validate_is_coroutine():
3232
async def test_subclass_can_return_pass():
3333
class PassRequirement(Requirement):
3434
async def stream_validate(
35-
self, chunk: str, backend: Backend, ctx: Context
35+
self, chunk: str, *, backend: Backend, ctx: Context
3636
) -> PartialValidationResult:
3737
return PartialValidationResult("pass")
3838

@@ -45,7 +45,7 @@ async def stream_validate(
4545
async def test_subclass_can_return_fail():
4646
class FailRequirement(Requirement):
4747
async def stream_validate(
48-
self, chunk: str, backend: Backend, ctx: Context
48+
self, chunk: str, *, backend: Backend, ctx: Context
4949
) -> PartialValidationResult:
5050
if "bad" in chunk:
5151
return PartialValidationResult("fail", reason="bad word detected")

0 commit comments

Comments
 (0)