Skip to content

fix: validate calls polling arguments like goals does - #49

Open
cnpierrepapi wants to merge 1 commit into
CALLE-AI:mainfrom
cnpierrepapi:fix/validate-call-polling-seconds
Open

cnpierrepapi wants to merge 1 commit into
CALLE-AI:mainfrom
cnpierrepapi:fix/validate-call-polling-seconds

Conversation

@cnpierrepapi

Copy link
Copy Markdown

Summary

Closes #30. The other half of it, waiting on the result instead of the status, already landed in 1.0.

calls.wait_for_result passed interval_seconds straight to time.sleep. Zero meant polling GET /v2/calls/{id} with no delay until the timeout, and nan or a negative number blew up inside time.sleep without saying which argument was wrong. goals already has _validate_polling_seconds for exactly this, so both call paths use it now.

create_and_wait checks before the POST, not after. @cuentapraces07-ops caught this on the issue: checking only inside wait_for_result means a bad interval_seconds still places the call first. That's the same order goals.run_and_wait already uses.

16 new tests, the same 8 bad values for each method, each checking the error names the argument and that no request went out. All 16 fail on main and pass here.

Heads up that #45 edits the calle.errors import line right above the one this adds, so whichever lands second needs a one-line rebase.

Checklist

  • I kept this change within the supported server SDK scope.
  • I did not add browser/client-side patterns that expose CALL-E API keys.
  • I did not include private collaboration links or unconfirmed public repository references.
  • I updated tests, examples, or docs when behavior changed.
  • I updated the changelog when the change affects package users.
  • I ran the relevant local checks.

Local checks

I don't have uv on this machine, so I ran the steps from validate.sh directly in a venv rather than the script itself:

pytest -q                               81 passed
ruff check .    (locked 0.15.15)        All checks passed
mypy src/calle                          no issues in 6 source files
scripts/check_public_repo_hygiene.py    passed

calls.wait_for_result passed interval_seconds straight to time.sleep, so
0 polled GET /v2/calls/{id} with no delay until the timeout, and nan or a
negative value failed inside time.sleep without naming the argument.
create_and_wait also sent the create POST before anything was checked.

Reuse goals' _validate_polling_seconds in both, and in create_and_wait
check before the POST so a bad argument never places a call.

Refs CALLE-AI#30

This branch has not been deployed

No deployments
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.

calls.wait_for_result differs from goals.wait_for_result twice, and goals is right both times

1 participant