dograh/api/tests
Rushil f4c5954a39
feat: add tool test panel for HTTP API tools (#547)
* feat: add tool test panel for HTTP API tools

Lets developers run a saved HTTP API tool against its real endpoint
from the tool detail page, without needing a live call. Reuses the
production execute_http_tool path so test behavior matches call-time
behavior.

- New POST /tools/{tool_uuid}/test route
- Test panel with per-parameter typed inputs and auto-detected
  context variable inputs (from preset parameter templates)
- Validate parameter name uniqueness on save, matching the existing
  transferParameters check
- Fix stale FunctionCallsFromLLMInfoFrame import causing test
  collection failures against pipecat-ai 1.5.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: revert local-venv pipecat drift fix, apply ruff import formatting

test_custom_tools.py and test_unregistered_function_call.py were edited
locally to drop FunctionCallsFromLLMInfoFrame after hitting an
ImportError — that error was from a stale local pipecat-ai package, not
a real drift. CI's pipecat build emits this frame and the test asserted
on it, so removing it broke test_llm_calls_custom_tool_handler and its
unregistered-call counterpart. Reverted both files to match main.

Also applied ruff's import-sort/format fix to test_mcp_tool_route.py to
clear the drift-check job (split the aliased import into its own
`from ... import (...)` block, wrapped a long monkeypatch.setattr call).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: avoid pytest collecting test_tool import as a test, sync OpenAPI spec

pytest's default discovery matches any top-level test_* name in a test
module, including imported functions — importing the route handler as
`test_tool as test_tool_route` still matched the pattern, so pytest
tried to run it as a test and failed injecting fixtures for tool_uuid/
request/user. Renamed the alias to call_test_tool_route.

Also regenerated docs/api-reference/openapi.json for the new
POST /tools/{tool_uuid}/test route and its two schemas (couldn't run
the dump script locally — pipecat-ai version mismatch documented
separately — so hand-built the diff to exactly match FastAPI's
get_openapi() output format, verified against neighboring routes).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: address cubic review findings on test panel

- Resolve dotted context-variable keys into nested objects before
  posting the test request. render_template's get_nested_value walks
  nested dicts, so a flat key like "runtime_configuration.realtime_model"
  never matched — templates referencing nested context always resolved
  to empty.
- Restrict isHttpApiTool to an explicit category equality check instead
  of inferring it from exclusions. native/integration tools are
  currently disabled in the create-tool UI so this wasn't reachable
  today, but the exclusion list silently goes stale as new categories
  are added.
- Stop showing a green success badge for non-2xx responses.
  execute_http_tool returns status: "success" for any HTTP exchange
  that completes, regardless of status code — only transport-level
  errors (timeout, connection failure) get status: "error". The test
  panel now checks status_code is in the 2xx range before treating the
  call as a success.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: address second round of cubic/greptile findings

- Guard setNestedValue against prototype-pollution keys (__proto__,
  constructor, prototype) in the dotted context-var path before
  traversing.
- Normalize status to "error" in the test route when the upstream
  status_code is >= 400. execute_http_tool only distinguishes
  transport-level failures (timeout, connection error) from
  "success" — a completed 4xx/5xx exchange still came back as
  "success" from the executor.
- Seed testArgValues defaults for number/boolean parameters via a
  useEffect keyed on the parameters array, so a required number or
  boolean field isn't silently omitted from the test request if the
  user never touches its input.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: only seed test-arg defaults for required number/boolean params

Seeding optional number/boolean parameters silently changed the test
request — an optional boolean flag the tester never touched was sent
as true, which can flip upstream behavior unintentionally. Restrict
seeding to required parameters.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: match whitespace and fallback-filter syntax in context var detection

extractContextVars required an exact {{initial_context.foo}} with no
whitespace and no filter suffix, but the backend's TEMPLATE_VAR_PATTERN
(and render_template) accepts {{ initial_context.foo }} and
{{initial_context.foo | fallback:value}}. A preset parameter saved with
either of those forms resolved fine in production but showed no input
in the test panel, so testing always sent it empty context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(tool-test): add hint and request_* fields to ToolTestResponse

Extends ToolTestResponse with hint, request_method, request_url,
request_body, and request_params so the frontend can surface what was
actually sent and a human-readable hint about why a test call failed.

* feat(tool-test): add status-code hints and request_method/url/body/params to test_tool()

* style: ruff-format test_mcp_tool_route.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(tool-test): wire hint banner and request block into result panel

Backend has returned hint/request_method/request_url/request_body/
request_params since d45ea851/60aaf31d but the frontend never
displayed them. Extends ToolTestResult with the new fields and renders
an amber hint banner (for 400/401/403/404/405/408/409/415/422/429/5xx)
plus a Request block above the response showing exactly what was sent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tool-test): include resolved preset params in request_body/params

Found via live GET/POST testing: the Request preview showed only the
model-provided arguments, not what execute_http_tool actually sends.
execute_http_tool merges resolved_arguments = {**arguments,
**preset_arguments} before building the outbound body/params — preset
params (e.g. {{initial_context.metadata.channel}}) are invisible to
the model but still go out on the wire. The preview now mirrors that
merge via the same _resolve_preset_parameters helper, so a dev sees
exactly what was sent, not just what the model provided.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(tool-test): add generateSampleValue helper for sample-fill button

* feat(tool-test): add Fill sample values button for arguments and context vars

Moved generateSampleValue out of page.tsx into a sibling helpers module:
Next.js's typed-route checker rejects extra named exports on a page.tsx
file (tsc error TS2344 on .next/types), so the helper and its test import
now live in testPanelHelpers.ts instead.

* feat(tool-test): add JSON edit modal state and handlers

* feat(tool-test): collapsed preview + edit modal for object/array test parameters

* fix(tool-test): validate JSON on modal open, not just on edit

Opening the JSON edit modal on an untouched object/array param (no value
yet in testArgValues) loaded an empty draft with jsonEditError hardcoded
to null, so Save was enabled despite invalid JSON and silently no-op'd on
click. Now runs the same JSON.parse check used by the live textarea
validation when the modal opens.

* chore: regenerate openapi.json for ToolTestResponse hint/request_* fields

drift-check on PR #547 was failing because the earlier hint/request_method/
request_url/request_body/request_params fields added to ToolTestResponse
were never reflected in the dumped spec. Regenerated via
scripts.dump_docs_openapi.

* fix(tool-test): serialize object/array args for GET/DELETE query params, add unsaved-changes banner

httpx raises a TypeError when a query param value is a dict/list, which
was silently caught and surfaced as a generic tool-execution error —
this is what actually broke test requests, not just the "[object
Object]" display. JSON-stringify object/array arguments before they
become query params, in both the live execute_http_tool() path and the
test route's request_params display shaping.

Also adds an unsaved-changes warning banner above Test Tool, shown
when the live form state diverges from the last-saved HTTP API config,
since Test Tool always runs the saved config.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(tool-test): keep empty request body in preview; normalize headers in snapshot

- POST/PUT/PATCH with no arguments now shows `{}` in the request body
  preview instead of null — matches what execute_http_tool actually sends
  over the wire (json={})
- buildHttpToolTestSnapshot normalizes headers from KeyValueItem[] to a
  deduped key→value map before serializing, matching the shape saved to
  the backend; duplicate header keys no longer cause a false unsaved-
  changes warning

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(tool-test): update assertion for empty POST body preview

test_tool_test_no_arguments_leaves_body_and_params_none expected
request_body=None for a POST with no arguments. The fix to preserve {}
in the preview makes request_body={} the correct assertion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(tools): refine HTTP tool testing

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Abhishek Kumar <abhishek@a6k.me>
2026-07-18 16:00:50 +05:30
..
dto_fixtures fix: disable duplicate trigger nodes in workflow builder (#402) 2026-06-19 15:59:30 +05:30
integrations fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30
support feat(mcp): generic MCP tool source with per-node function filtering (#301) 2026-05-19 16:10:00 +05:30
telephony fix: scope workflow run to org rather than user 2026-07-10 16:52:43 +05:30
__init__.py Initial Commit 🚀 🚀 2025-09-09 14:37:32 +05:30
conftest.py feat: add Tuner Integration to Dograh (#311) 2026-05-20 14:37:33 +05:30
test_active_calls.py fix: scope workflow run to org rather than user 2026-07-10 16:52:43 +05:30
test_add_call_disposition_code.py fix: add disposition codes in workflows 2026-03-27 19:20:05 +05:30
test_agent_stream_route.py fix: increase concurrency limit an handle it across all call paths (#508) 2026-07-09 18:29:01 +05:30
test_aggregation_fix.py Fix/multiple generation (#104) 2026-01-03 12:59:18 +05:30
test_ai_model_configuration_v2.py fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30
test_auth_depends.py chore: cleaup mps v1 billing (#507) 2026-07-07 18:38:29 +05:30
test_auth_routes.py feat(auth): gate OSS signup behind ENABLE_SIGNUP flag (#514) 2026-07-13 14:08:25 +05:30
test_azure_realtime_wrapper.py fix: fix speech to speech model transitions (#545) 2026-07-15 18:36:36 +05:30
test_azure_speech_service_factory.py fix: fix speech to speech model transitions (#545) 2026-07-15 18:36:36 +05:30
test_backfill_org_model_configuration_v2_migration.py fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30
test_call_concurrency.py fix: increase concurrency limit an handle it across all call paths (#508) 2026-07-09 18:29:01 +05:30
test_camb_tts_integration.py feat: add support for self hosted llm models 2026-03-24 17:50:45 +05:30
test_campaign_call_dispatcher.py fix: increase concurrency limit an handle it across all call paths (#508) 2026-07-09 18:29:01 +05:30
test_campaign_tasks.py chore: return formatted transcript url 2026-05-26 13:24:12 +05:30
test_cartesia_stt_service_factory.py feat: add cartesia ink 2 in STT models 2026-06-28 10:22:36 +05:30
test_cartesia_tts_service_factory.py fix: add language field to CartesiaTTSConfiguration and pass to Cartesia TTS service (#442) 2026-06-18 13:23:27 +05:30
test_circuit_breaker.py fix: increase concurrency limit an handle it across all call paths (#508) 2026-07-09 18:29:01 +05:30
test_custom_tools.py feat: add tool test panel for HTTP API tools (#547) 2026-07-18 16:00:50 +05:30
test_custom_tools_context_integration.py feat: add headless mode, redesign floating widget, refactor lifecycle callbacks (#268) 2026-05-07 12:23:41 +05:30
test_deepgram_flux_service_factory.py feat: add custom sarvam tts voice (#449) 2026-06-18 12:33:21 +05:30
test_display_options_evaluator.py feat: refactor node spec and add mcp tools (#244) 2026-04-21 07:56:16 +05:30
test_dograh_embedding_service.py chore: cleaup mps v1 billing (#507) 2026-07-07 18:38:29 +05:30
test_dograh_managed_correlation.py chore: bump pipecat submodule to 1.4.0 2026-06-18 12:17:36 +05:30
test_dograh_sdk.py feat: add test mode for API trigger 2026-04-25 16:30:26 +05:30
test_dograh_sdk_typed.py feat: add Tuner Integration to Dograh (#311) 2026-05-20 14:37:33 +05:30
test_dograh_stt_service_factory.py feat: add cartesia ink 2 in STT models 2026-06-28 10:22:36 +05:30
test_dto.py feat: add Tuner Integration to Dograh (#311) 2026-05-20 14:37:33 +05:30
test_elevenlabs_stt_service_factory.py feat: add ElevenLabs realtime STT provider support (#512) (#522) 2026-07-13 14:47:07 +05:30
test_from_number_pool_isolation.py fix: increase concurrency limit an handle it across all call paths (#508) 2026-07-09 18:29:01 +05:30
test_gemini_json_schema_adapter.py fix: fix speech to speech model transitions (#545) 2026-07-15 18:36:36 +05:30
test_gemini_live_reconnect_tool_results.py fix: fix speech to speech model transitions (#545) 2026-07-15 18:36:36 +05:30
test_get_backend_endpoints.py fix: BACKEND_API_ENDPOINT resolution from env and cloudflared tunnel (#135) 2026-01-29 14:06:08 +05:30
test_google_stt_service_factory.py feat: add google stt and tts. add folders to organize agents 2026-05-22 14:36:50 +05:30
test_google_tts_service_factory.py feat: add google stt and tts. add folders to organize agents 2026-05-22 14:36:50 +05:30
test_google_vertex_llm_service_factory.py fix: support Gemini JSON schema tools (#463) 2026-06-24 18:50:44 +05:30
test_grok_realtime_wrapper.py fix: fix speech to speech model transitions (#545) 2026-07-15 18:36:36 +05:30
test_huggingface_stt_service_factory.py feat: add huggingface inferece provider endpoint 2026-06-15 22:56:01 +05:30
test_inworld_tts_service_factory.py feat: add Inworld TTS provider support (#420) 2026-06-19 13:23:27 +05:30
test_is_private_ip_candidate.py feat: add chat based testing for voice agent (#308) 2026-05-21 15:20:02 +05:30
test_json_parser.py fix: fix OPENAI_API_KEY bug in retrieval 2026-01-17 18:12:56 +05:30
test_knowledge_base_processing_embeddings.py fix: enable knowledge base with Dograh config v2 2026-06-25 22:21:11 +05:30
test_layout.py feat: refactor node spec and add mcp tools (#244) 2026-04-21 07:56:16 +05:30
test_masked_key_rejection.py fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30
test_mcp_auth.py feat(mcp): generic MCP tool source with per-node function filtering (#301) 2026-05-19 16:10:00 +05:30
test_mcp_create_workflow.py fix: disable duplicate trigger nodes in workflow builder (#402) 2026-06-19 15:59:30 +05:30
test_mcp_custom_tool_manager.py feat(mcp): generic MCP tool source with per-node function filtering (#301) 2026-05-19 16:10:00 +05:30
test_mcp_docs_search.py feat(mcp): add search_docs tool over docs corpus (closes #295) (#316) 2026-05-20 18:20:35 +05:30
test_mcp_get_workflow.py fix: fix projection to TS when fetching agnet in MCP 2026-05-23 14:45:50 +05:30
test_mcp_instructions_drift.py test(mcp): guard instructions.py against tool drift 2026-05-20 18:44:18 +05:30
test_mcp_integration.py chore: update pipecat to 1.3.0 (#379) 2026-05-29 16:19:42 +05:30
test_mcp_save_workflow.py fix: disable duplicate trigger nodes in workflow builder (#402) 2026-06-19 15:59:30 +05:30
test_mcp_tool_creation.py feat: create tools using MCP 2026-05-31 16:50:44 +05:30
test_mcp_tool_definition.py feat(mcp): generic MCP tool source with per-node function filtering (#301) 2026-05-19 16:10:00 +05:30
test_mcp_tool_route.py feat: add tool test panel for HTTP API tools (#547) 2026-07-18 16:00:50 +05:30
test_mcp_tool_session.py feat(mcp): generic MCP tool source with per-node function filtering (#301) 2026-05-19 16:10:00 +05:30
test_message_sanitization.py fix timestamps in tuner accumelator (#335) 2026-05-21 07:43:50 +05:30
test_minimax_service_factory.py feat: add xai grok as realtime model 2026-05-22 18:04:59 +05:30
test_model_configuration_pricing.py feat: show model pricing in configuration UI (#528) 2026-07-13 14:20:24 +05:30
test_mps_service_key_client.py feat: show model pricing in configuration UI (#528) 2026-07-13 14:20:24 +05:30
test_node_specs.py chore: add docs url for integration nodes 2026-07-15 18:54:07 +05:30
test_onboarding_state.py feat: UI refresh and user onboarding (#430) 2026-06-17 19:49:33 +05:30
test_openai_realtime_initial_context.py fix: fix speech to speech model transitions (#545) 2026-07-15 18:36:36 +05:30
test_openai_tts_service_factory.py feat: add huggingface inferece provider endpoint 2026-06-15 22:56:01 +05:30
test_organization_usage_billing.py chore: cleaup mps v1 billing (#507) 2026-07-07 18:38:29 +05:30
test_pipecat_engine_callbacks.py feat: abort immediately on max call duration exceed 2026-05-31 13:21:37 +05:30
test_pipecat_engine_context_update.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_pipecat_engine_end_call.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_pipecat_engine_node_switch_with_user_speech.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_pipecat_engine_tool_calls.py fix: fix speech to speech model transitions (#545) 2026-07-15 18:36:36 +05:30
test_pipecat_engine_transition_mute.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_pipecat_engine_variable_extraction.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_pipeline_cancellation.py chore: update pipecat to 1.3.0 (#379) 2026-05-29 16:19:42 +05:30
test_posthog_client.py chore: fix phantom user creation in posthog 2026-06-19 21:08:09 +05:30
test_pre_call_fetch.py chore: update docs for pre-call data fetch 2026-06-05 14:16:56 +05:30
test_public_agent_routes.py fix: scope workflow run to org rather than user 2026-07-10 16:52:43 +05:30
test_public_embed_cors.py fix: increase concurrency limit an handle it across all call paths (#508) 2026-07-09 18:29:01 +05:30
test_public_signaling_origin.py fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30
test_qa_analysis_non_dict_response.py fix: disable duplicate trigger nodes in workflow builder (#402) 2026-06-19 15:59:30 +05:30
test_quota_service.py fix(quota): fail closed when quota verification errors (#331) (#523) 2026-07-15 13:03:42 +05:30
test_realtime_feedback_events.py Fix realtime feedback event correlation (#534) 2026-07-14 19:49:58 +05:30
test_realtime_feedback_observer.py Fix realtime feedback event correlation (#534) 2026-07-14 19:49:58 +05:30
test_realtime_message_append.py feat: add openai realtime models (#298) 2026-05-16 18:05:23 +05:30
test_recording_router_processor.py feat: add headless mode, redesign floating widget, refactor lifecycle callbacks (#268) 2026-05-07 12:23:41 +05:30
test_resolve_effective_config.py feat: billing and credit management v2 (#429) 2026-06-12 14:55:30 +05:30
test_run_integrations_webhook.py feat(webhooks): durable retrying delivery for final webhooks (#478) 2026-07-02 21:44:14 +05:30
test_run_pipeline_realtime_turn_config.py feat: better interrupt strategies (#479) 2026-06-30 14:52:17 +05:30
test_run_usage_response.py feat: billing and credit management v2 (#429) 2026-06-12 14:55:30 +05:30
test_s3_signed_url.py feat: persist split user and bot audio 2026-06-16 15:19:49 +05:30
test_sarvam_service_factory.py feat: add custom sarvam tts voice (#449) 2026-06-18 12:33:21 +05:30
test_sdk_sync.py feat: refactor node spec and add mcp tools (#244) 2026-04-21 07:56:16 +05:30
test_smallest_service_factory.py feat: add Smallest AI TTS and STT provider integration (#444) 2026-06-17 12:55:53 +05:30
test_speaches_service_factory.py feat: add Rime TTS 2026-04-07 14:05:47 +05:30
test_telephony_factory.py fix: force FORCE_TURN_RELAY for local IPs in setup 2026-05-16 18:37:38 +05:30
test_telephony_routes.py fix: scope workflow run to org rather than user 2026-07-10 16:52:43 +05:30
test_template_renderer.py Fix realtime initial greeting handling (#481) 2026-06-29 17:25:42 +05:30
test_text_and_audio_playback.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_text_chat_logs.py feat: add chat based testing for voice agent (#308) 2026-05-21 15:20:02 +05:30
test_text_chat_session_service.py fix: disable duplicate trigger nodes in workflow builder (#402) 2026-06-19 15:59:30 +05:30
test_tool_schema.py fix: error on empty destination when creating a default transfer tool 2026-07-13 16:44:14 +05:30
test_trigger_path_validation.py fix(workflow): detect duplicate trigger paths when first node has no id (#409) 2026-06-19 13:53:34 +05:30
test_ts_bridge.py fix: fix projection to TS when fetching agnet in MCP 2026-05-23 14:45:50 +05:30
test_tts_endframe_with_audio_write_failure.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_ultravox_realtime_wrapper.py fix: fix speech to speech model transitions (#545) 2026-07-15 18:36:36 +05:30
test_unregistered_function_call.py Bump Pipecat to 1.5.0 (#530) 2026-07-13 18:33:18 +05:30
test_user_configuration_upsert.py chore: update documentation 2026-06-19 18:11:35 +05:30
test_user_configuration_validation.py fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30
test_user_configured_service_url_security.py feat: allow overriding base URL of OpenAI STT and TTS (#377) 2026-06-02 12:06:58 +05:30
test_user_email_case_insensitive.py fix: make email lookup case-insensitive in get_user_by_email (#397) 2026-06-02 13:43:20 +05:30
test_user_idle_handler.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_user_muting_during_bot_speech.py chore: refactor status processor (#465) 2026-06-24 22:07:35 +05:30
test_voicemail_detector.py chore: update pipecat to 1.3.0 (#379) 2026-05-29 16:19:42 +05:30
test_webrtc_signaling_concurrency.py fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30
test_workflow_configurations_schema.py fix: increase concurrency limit an handle it across all call paths (#508) 2026-07-09 18:29:01 +05:30
test_workflow_create_route.py fix: disable duplicate trigger nodes in workflow builder (#402) 2026-06-19 15:59:30 +05:30
test_workflow_graph_constraints.py chore: cleaup mps v1 billing (#507) 2026-07-07 18:38:29 +05:30
test_workflow_list_route.py fix: validate workflow status filter to prevent 500 on invalid enum value (#450) 2026-06-18 08:39:59 +05:30
test_workflow_qa_masking.py feat: add Tuner Integration to Dograh (#311) 2026-05-20 14:37:33 +05:30
test_workflow_run_billing.py chore: cleaup mps v1 billing (#507) 2026-07-07 18:38:29 +05:30
test_workflow_text_chat.py fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30
test_workflow_versioning.py fix: reject misrouted smallwebrtc runs on the telephony websocket (#468) 2026-06-26 19:37:40 +05:30
test_xai_tts_service_factory.py fix: fix org scoped access for resources (#517) 2026-07-09 23:04:33 +05:30