Skip to content

test: add unit tests for 8 untested modules (batch 3)#191

Merged
teknium1 merged 3 commits intoNousResearch:mainfrom
0xbyt4:test/expand-coverage-3
Mar 1, 2026
Merged

test: add unit tests for 8 untested modules (batch 3)#191
teknium1 merged 3 commits intoNousResearch:mainfrom
0xbyt4:test/expand-coverage-3

Conversation

@0xbyt4
Copy link
Copy Markdown
Contributor

@0xbyt4 0xbyt4 commented Feb 28, 2026

Summary

  • Add 143 unit tests across 8 previously untested modules
  • Covers tools, gateway, and the new honcho_integration package

New Test Files

File Module Tests Key Coverage
tests/tools/test_debug_helpers.py tools/debug_helpers.py 13 DebugSession enable/disable, log, save to JSON, session info
tests/tools/test_skills_guard.py tools/skills_guard.py 42 Threat pattern detection, trust levels, install policy, structural checks
tests/tools/test_skills_sync.py tools/skills_sync.py 13 Manifest CRUD, skill discovery, fresh install vs update sync
tests/gateway/test_sticker_cache.py gateway/sticker_cache.py 17 Cache CRUD, exact injection text format, edge cases
tests/gateway/test_channel_directory.py gateway/channel_directory.py 16 Channel resolution (exact, prefix, guild-qualified), display formatting
tests/gateway/test_hooks.py gateway/hooks.py 14 Hook discovery, sync/async emit, wildcard matching, error isolation
tests/gateway/test_mirror.py gateway/mirror.py 10 Session lookup, JSONL append, mirror_to_session flow
tests/honcho_integration/test_client.py honcho_integration/client.py 20 Config from env/file, host block override, session name resolution
New test files (143 tests total):
- tools/debug_helpers.py: DebugSession enable/disable, log, save, session info
- tools/skills_guard.py: scan_file, scan_skill, trust levels, install policy, structural checks
- tools/skills_sync.py: manifest read/write, skill discovery, sync logic
- gateway/sticker_cache.py: cache CRUD, sticker injection text builders
- gateway/channel_directory.py: channel resolution, display formatting, session building
- gateway/hooks.py: hook discovery, sync/async emit, wildcard matching
- gateway/mirror.py: session lookup, JSONL append, mirror_to_session
- honcho_integration/client.py: config from env/file, session name resolution, linked workspaces

Also documents a gap in skills_guard: multi-word prompt injection
variants like "ignore all prior instructions" bypass the regex scanner.
Replace loose "contains" checks with exact output matching for
build_sticker_injection and build_animated_sticker_injection.
Add edge cases: set_name without emoji, empty description, empty emoji.
@teknium1 teknium1 merged commit 3b74563 into NousResearch:main Mar 1, 2026
teknium1 added a commit that referenced this pull request Mar 1, 2026
Remove loop_scope="function" parameter from async test decorators in
test_hooks.py. This matches the existing convention in the repo
(test_telegram_documents.py) and avoids requiring pytest-asyncio 0.23+.

All 144 new tests from PR #191 now pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants