Skip to content

test: add unit tests for 8 untested core modules#60

Merged
teknium1 merged 2 commits into
NousResearch:mainfrom
0xbyt4:test/expand-coverage
Feb 27, 2026
Merged

test: add unit tests for 8 untested core modules#60
teknium1 merged 2 commits into
NousResearch:mainfrom
0xbyt4:test/expand-coverage

Conversation

@0xbyt4

@0xbyt4 0xbyt4 commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds 210 new unit tests covering 8 previously untested modules
  • Total test suite: 380 passing, 0 failing
  • Increases coverage from ~10% to meaningful coverage of core logic

Modules Tested

Module Tests What's covered
cron/jobs.py 34 Schedule parsing (duration, interval, cron, ISO), job CRUD, due-job detection
tools/memory_tool.py 32 Security scanning (injection, exfil, unicode), MemoryStore add/replace/remove, persistence, dispatcher
toolsets.py 19 Toolset resolution, cycle detection, validation, custom toolsets, structural consistency
tools/file_operations.py 37 Write deny list, result dataclasses (ReadResult, WriteResult, etc.), shell helpers
agent/prompt_builder.py 24 Context injection scanning, content truncation, skill description parsing, context file discovery
agent/model_metadata.py 16 Token estimation, default context lengths, API fetch with cache mocking
hermes_state.py 28 SessionDB SQLite CRUD, FTS5 full-text search, export, prune, schema/WAL validation

Test plan

  • uv run pytest tests/ -v — 380 passed, 3 skipped (croniter optional), 0 failed

Add comprehensive test coverage for:
- cron/jobs.py: schedule parsing, job CRUD, due-job detection (34 tests)
- tools/memory_tool.py: security scanning, MemoryStore ops, dispatcher (32 tests)
- toolsets.py: resolution, validation, composition, cycle detection (19 tests)
- tools/file_operations.py: write deny list, result dataclasses, helpers (37 tests)
- agent/prompt_builder.py: context scanning, truncation, skills index (24 tests)
- agent/model_metadata.py: token estimation, context lengths (16 tests)
- hermes_state.py: SessionDB SQLite CRUD, FTS5 search, export, prune (28 tests)

Total: 210 new tests, all passing (380 total suite).
These tests documented the macOS symlink bypass bug with
platform-conditional assertions. The fix and proper regression
tests are in PR NousResearch#61 (tests/tools/test_write_deny.py), so remove
them here to avoid ordering conflicts between the two PRs.
@teknium1 teknium1 merged commit 274e623 into NousResearch:main Feb 27, 2026
sudo-yf pushed a commit to sudo-yf/hermes-agent that referenced this pull request Apr 5, 2026
…ults (NousResearch#60)

The sessions table in the CLI state.db does not have a 'profile' column --
selecting s.profile caused an OperationalError which was silently caught by
'except Exception: return []', making get_cli_sessions() always return empty.

Fix: remove s.profile from the SELECT (it doesn't exist in the CLI schema)
and derive the profile from get_active_profile_name() instead, which is the
right value anyway since the CLI DB has no profile concept.

Co-authored-by: Nathan Esquenazi <nesquena@gmail.com>
linxule added a commit to linxule/hermes-agent that referenced this pull request Apr 27, 2026
…k variant

Parity port from linxule/hermes-kimi-plugin@93476f5 — same four fixes plus
the NousResearch#60 fold-in:

1. connect# off-by-one: counter + ts now bumped pre-dispatch in
   _group_subscribe_once so the gap log inside _on_group_event reads the
   correct connect# (matches the subscribe-stream-live log emitted moments
   later). Subscribe-live log + backoff clamp stay post-dispatch as the
   operator-visible recovery announcement.

2. Monotonic clock: arrival-time tracking + since-reconnect correlation
   now use time.monotonic() (immune to NTP/leap-second/VM-suspend).

3. _BoundedLRU shared cap: _last_arrival_time_per_room gets its own
   _ARRIVAL_TIME_CACHE_DEFAULT_MAX (10000), so eviction can't blind
   Phase 0 gap detection under cardinality pressure.

4. Anchor-only-on-first-page in list_group_messages: pageToken and
   start_message_id/end_message_id are now mutually-exclusive cursoring
   modes.

Fold-in (NousResearch#60): _fetch_group_message uses max_pages=2 for tight-range
pagination resilience.

Tests: 200 passing on fork (194 unit + 6 plugin-integration). Same +10/-1
delta as standalone. Existing handler-exception test updated to reflect
new pre-dispatch state semantic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
test: add unit tests for 8 untested core modules
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
test: add unit tests for 8 untested core modules
MickaelV0 added a commit to Roxabi/hermes-agent that referenced this pull request May 24, 2026
The upstream image entrypoint runs as root and tries to `su hermes`,
which fails under our DropCapability=all (no CAP_SETUID). Force the
container to start as uid 10000 directly via User= alongside UserNS=.
The earlier comment ("starts directly as hermes") was inaccurate —
verified 2026-05-22 on digest 9d0a12c0… that removing User= produces
"error: failed switching to 'hermes': operation not permitted" and a
crashloop.

Also update CLAUDE.md provider wiring: llmcli now joins roxabi.network
(llmCLI NousResearch#60 resolved), so the canonical path is `llmcli:18091` via
container-name DNS — not `host.containers.internal:18091`, which is no
longer reachable from bridge containers (curl returns 000).

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

Copy link
Copy Markdown

Implemented in commit d997e70 (Render semantic KB write receipts) on codex/system-elegance-offline-control-plane.

What changed:

  • Hermes KB journeys now render compact semantic write receipt packets with prod write status, publication status, reconciliation status, transaction id, changed paths, object ids, and operation ids.
  • Added aliases for offline/status packet variants and redaction tests for source bodies, login/account strings, URLs, tokens, and private paths.
  • Kept Hermes as a mobile/Telegram renderer only; no durable write logic moved into Hermes.

Verification:

  • uv run --with pytest-timeout pytest tests/plugins/test_kb_journeys.py -k semantic_write_receipt -q -> 2 passed
  • uv run --with pytest-timeout pytest tests/plugins/test_kb_journeys.py -q -> 57 passed
  • python -m compileall plugins/kb_journeys/__init__.py tests/plugins/test_kb_journeys.py -> passed
  • git diff --check -> passed

Remaining gates: no live Telegram canary or prod MCP packet replay was run. Renderer aliases may need a small follow-up if kb-engine emits a packet type spelling outside the tested set.

Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
test: add unit tests for 8 untested core modules
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.

3 participants