Skip to content

test(tools+skills): add unit tests for uncovered modules#23

Open
haowu1234 wants to merge 1 commit into
agentic-in:mainfrom
haowu1234:feat/tools-skills-tests
Open

test(tools+skills): add unit tests for uncovered modules#23
haowu1234 wants to merge 1 commit into
agentic-in:mainfrom
haowu1234:feat/tools-skills-tests

Conversation

@haowu1234
Copy link
Copy Markdown
Contributor

Summary

Add 314 unit tests across 10 new test files covering previously untested tools and skills packages, addressing the "tools/skills ζ΅‹θ―•ηΌΊε€± ε›žε½’ι£Žι™©" finding from the code audit.

Coverage Added

Tier Test File Source Module Tests
1 test_handler_support handler_support.py 55
1 test_tool_result_storage tool_result_storage.py 12
1 test_skill_provenance provenance.py 32
2 test_tool_runtime runtime.py (tools) 37
2 test_skill_runtime runtime.py (skills) 78
2 test_code_execution_validation handlers_code_execution.py 20
3 test_handlers_continuity handlers_continuity.py 21
3 test_handlers_diary handlers_diary.py 10
3 test_handlers_skills handlers_skills.py 22
3 test_handlers_sub_agents handlers_sub_agents.py 27

Key Invariants Verified

  • Path traversal security in resolve_allowed_path β€” blocked ../../etc/passwd, fallback roots
  • AST validation in _validate_python_snippet β€” blocked os, subprocess, eval, exec, open(), dunder attrs
  • Budget enforcement in enforce_tool_observation_budget β€” observation shortening, persisted-output skip
  • Round-trip serialization for PublicSkillSourceDescriptor ↔ metadata
  • Scope matching in SkillScope.matches β€” personal_model_id, state_id, surface_id, surface_kind, mode
  • Approval flow in ToolRuntime β€” approved/denied/deferred, approval_class=none bypass, lifecycle events

Before β†’ After

  • tools package: 3 β†’ 9 test files
  • skills package: 3 β†’ 6 test files (excluding builtin_packages/)

@netlify
Copy link
Copy Markdown

netlify Bot commented May 17, 2026

βœ… Deploy Preview for rad-granita-26ed35 ready!

Name Link
πŸ”¨ Latest commit 99e9439
πŸ” Latest deploy log https://app.netlify.com/projects/rad-granita-26ed35/deploys/6a097dac90bd660008e9742d
😎 Deploy Preview https://deploy-preview-23--rad-granita-26ed35.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
πŸ€– Make changes Run an agent on this branch

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>
@haowu1234 haowu1234 force-pushed the feat/tools-skills-tests branch from e60230e to 99e9439 Compare May 17, 2026 08:34
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.

1 participant