Skip to content

AcksWithinEvaluator

autogen.beta.network.hub.expectations.AcksWithinEvaluator #

Fire when invitees haven't acked within params.seconds.

Only meaningful while the session is in PENDING state. Returns one violation listing every still-pending invitee.

name class-attribute instance-attribute #

name = 'acks_within'

evaluate #

evaluate(expectation, context)
Source code in autogen/beta/network/hub/expectations.py
def evaluate(
    self,
    expectation: Expectation,
    context: ExpectationContext,
) -> Violation | None:
    if context.metadata.state != SessionState.PENDING:
        return None
    seconds = float(expectation.params.get("seconds", 30))
    elapsed = context.now_seconds - _parse_iso_seconds(context.metadata.created_at)
    if elapsed < seconds:
        return None
    if not context.metadata.pending_acks:
        return None
    return Violation(
        expectation=expectation,
        violator_ids=list(context.metadata.pending_acks),
        detail={
            "elapsed_seconds": elapsed,
            "threshold_seconds": seconds,
        },
    )