Skip to content

refactor(api): type tool parameter cache payload#35133

Open
carlos4s wants to merge 1 commit intolanggenius:mainfrom
carlos4s:refactor/34878-tool-parameter-cache-types
Open

refactor(api): type tool parameter cache payload#35133
carlos4s wants to merge 1 commit intolanggenius:mainfrom
carlos4s:refactor/34878-tool-parameter-cache-types

Conversation

@carlos4s
Copy link
Copy Markdown
Contributor

Part of #34878

Summary

  • add ToolParameterCachePayload in api/core/helper/tool_parameter_cache.py
  • replace dict[str, Any] cache payloads with dict[str, object]
  • update ToolParameterConfigurationManager to use the typed cache payload
  • centralize secret-parameter string narrowing before masking, encryption, and decryption
  • add explicit -> None return types for cache deletion helpers

Files changed

  • api/core/helper/tool_parameter_cache.py
  • api/core/tools/utils/configuration.py

@carlos4s carlos4s requested a review from QuantumGhost as a code owner April 14, 2026 03:20
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-04-14 03:21:31.626514789 +0000
+++ /tmp/pyrefly_pr.txt	2026-04-14 03:21:21.619296709 +0000
@@ -3955,6 +3955,8 @@
   --> tests/unit_tests/core/external_data_tool/test_base.py:49:17
 ERROR Class member `ConcreteTool.query` overrides parent class `ExternalDataTool` in an inconsistent manner [bad-override]
   --> tests/unit_tests/core/external_data_tool/test_base.py:61:17
+ERROR Argument `dict[str, str]` is not assignable to parameter `parameters` with type `dict[str, object]` in function `core.helper.tool_parameter_cache.ToolParameterCache.set` [bad-argument-type]
+  --> tests/unit_tests/core/helper/test_tool_parameter_cache.py:67:15
 ERROR Argument `None` is not assignable to parameter `schema` with type `dict[Unknown, Unknown]` in function `core.llm_generator.output_parser.structured_output.remove_additional_properties` [bad-argument-type]
   --> tests/unit_tests/core/llm_generator/output_parser/test_structured_output.py:50:38
 ERROR Argument `list[@_]` is not assignable to parameter `schema` with type `dict[Unknown, Unknown]` in function `core.llm_generator.output_parser.structured_output.remove_additional_properties` [bad-argument-type]

@carlos4s
Copy link
Copy Markdown
Contributor Author

Hi, @asukaminato0721
I am really sorry for many pings.
Can you review my PR as well as previous PRs (#35120 #34855)?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant