fix: validate calls polling arguments like goals does - #49
Open
cnpierrepapi wants to merge 1 commit into
Open
cnpierrepapi wants to merge 1 commit into
cnpierrepapi wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #30. The other half of it, waiting on the result instead of the status, already landed in 1.0.
calls.wait_for_resultpassedinterval_secondsstraight totime.sleep. Zero meant pollingGET /v2/calls/{id}with no delay until the timeout, andnanor a negative number blew up insidetime.sleepwithout saying which argument was wrong.goalsalready has_validate_polling_secondsfor exactly this, so both call paths use it now.create_and_waitchecks before the POST, not after. @cuentapraces07-ops caught this on the issue: checking only insidewait_for_resultmeans a badinterval_secondsstill places the call first. That's the same ordergoals.run_and_waitalready 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.errorsimport line right above the one this adds, so whichever lands second needs a one-line rebase.Checklist
Local checks
I don't have uv on this machine, so I ran the steps from
validate.shdirectly in a venv rather than the script itself: