test(tools+skills): add unit tests for uncovered modules#23
Open
haowu1234 wants to merge 1 commit into
Open
Conversation
β Deploy Preview for rad-granita-26ed35 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Add 314 new unit tests across 10 test files covering previously untested tools and skills packages: Tier 1 - Pure logic (no external deps): - test_handler_support: coerce_bool/int/env/choices, optional_string, truncate, join_parts, resolve_allowed_path (path traversal security), normalized_url, tool_summary - test_tool_result_storage: maybe_persist_tool_result, budget enforcement, file persistence, pinned thresholds, OSError fallback - test_skill_provenance: PublicSkillSourceDescriptor, InstalledSkillProvenance, round-trip serialization, install_bucket_for_source_descriptor, skill_provenance_fields Tier 2 - Core runtime (minimal mocking): - test_tool_runtime: ToolDefinition, InMemoryToolRegistry/Executor, CallableApprovalGateway, ToolRuntime lifecycle (register, invoke, approve/deny, subscribe, manifest loading) - test_skill_runtime: SkillScope.matches, InMemorySkillCatalog, SkillRuntime lifecycle, _split_frontmatter, _frontmatter_bool, load_skill_package_definition - test_code_execution_validation: _validate_python_snippet AST checks (blocked imports, blocked builtins, dunder attributes, safe code) Tier 3 - Handler logic (surface mocking): - test_handlers_continuity: run_todo_action (add/list/update/complete/ remove/clear), run_cron_action null check - test_handlers_diary: run_diary_write/list, entry_date parsing, source_episode_ids - test_handlers_skills: run_skill_list/view/manage, source priority sorting, required skill references - test_handlers_sub_agents: run_sub_agents_action (run/start/status/ list), task_list parsing, string_list helpers Signed-off-by: haowu1234 <13258260125@163.com>
e60230e to
99e9439
Compare
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
Add 314 unit tests across 10 new test files covering previously untested
toolsandskillspackages, addressing the "tools/skills ζ΅θ―ηΌΊε€± εε½ι£ι©" finding from the code audit.Coverage Added
test_handler_supporthandler_support.pytest_tool_result_storagetool_result_storage.pytest_skill_provenanceprovenance.pytest_tool_runtimeruntime.py(tools)test_skill_runtimeruntime.py(skills)test_code_execution_validationhandlers_code_execution.pytest_handlers_continuityhandlers_continuity.pytest_handlers_diaryhandlers_diary.pytest_handlers_skillshandlers_skills.pytest_handlers_sub_agentshandlers_sub_agents.pyKey Invariants Verified
resolve_allowed_pathβ blocked../../etc/passwd, fallback roots_validate_python_snippetβ blockedos,subprocess,eval,exec,open(), dunder attrsenforce_tool_observation_budgetβ observation shortening, persisted-output skipPublicSkillSourceDescriptorβ metadataSkillScope.matchesβ personal_model_id, state_id, surface_id, surface_kind, modeToolRuntimeβ approved/denied/deferred, approval_class=none bypass, lifecycle eventsBefore β After
toolspackage: 3 β 9 test filesskillspackage: 3 β 6 test files (excluding builtin_packages/)