Two-parameter subtask handler completes without TypeError 🟥

This commit is contained in:
Daniel Roth 2026-06-10 08:22:43 +00:00
parent c1dda41857
commit 51cf545776
3 changed files with 24 additions and 1 deletions

View file

@ -15,11 +15,14 @@ from orchestration.audit_generator_orchestrator import AuditGeneratorOrchestrato
from orchestration.audit_generator_unit_of_work import AuditGeneratorUnitOfWork
from utilities.aws_lambda.subtask_handler import subtask_handler
@subtask_handler()
def handler(body: dict[str, Any], context: Any) -> None:
trigger = AuditGeneratorTriggerRequest.model_validate(body)
boto3_client: Any = boto3.client # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]
boto3_client: Any = (
boto3.client
) # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]
boto_s3: Any = boto3_client("s3")
bucket = os.environ["S3_BUCKET_NAME"]
s3_client = S3Client(boto_s3_client=boto_s3, bucket=bucket)

View file

@ -25,5 +25,6 @@ testpaths =
etl/epc_clean/tests
etl/hubspot/tests
etl/spatial/tests
tests/
markers =
integration: mark a test as an integration test

View file

@ -228,6 +228,25 @@ def test_subtask_handler_records_cloudwatch_url_on_subtask(
assert "$255B$2524LATEST$255D" in saved_url
def test_subtask_handler_completes_subtask_without_orchestrator_parameter(
harness: Harness,
) -> None:
# arrange
task, subtask = harness.orchestrator.create_task_with_subtask(
task_source="manual:test"
)
@subtask_handler(orchestrator_cm=harness.factory)
def handler(body: dict[str, Any], context: Any) -> None:
return None
# act
handler(_direct_event(task.id, subtask.id), context=None)
# assert
assert harness.subtasks.get(subtask.id).status is SubTaskStatus.COMPLETE
def test_subtask_handler_leaves_cloudwatch_url_unset_outside_lambda(
harness: Harness, monkeypatch: pytest.MonkeyPatch
) -> None: