Skip to content

test: add unit tests for trajectory_compressor#203

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
0xbyt4:test/trajectory-compressor
Mar 5, 2026
Merged

test: add unit tests for trajectory_compressor#203
teknium1 merged 1 commit into
NousResearch:mainfrom
0xbyt4:test/trajectory-compressor

Conversation

@0xbyt4

@0xbyt4 0xbyt4 commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add 25 unit tests for trajectory_compressor.py covering the pure logic (no external API/tokenizer needed in tests).

Test plan

  • 25 tests covering:
    • CompressionConfig: defaults, from_yaml (full, partial, empty YAML)
    • TrajectoryMetrics: to_dict, default values
    • AggregateMetrics: add_trajectory_metrics, to_dict (empty, with data, no division-by-zero)
    • _find_protected_indices: basic trajectory, short all-protected, protect_last_n=0, no system turn, disabled first_system protection
    • _extract_turn_content_for_summary: basic, long content truncation, empty range
    • Token counting: empty, basic, trajectory-level, per-turn, fallback on encoder error
  • Full test suite passes (701 passed)

Tests cover CompressionConfig (defaults, from_yaml with full/partial/empty),
TrajectoryMetrics and AggregateMetrics (to_dict, aggregation, division-by-zero
guards), _find_protected_indices (basic, all-protected, no tail, missing roles,
disabled protection), _extract_turn_content_for_summary (basic, truncation,
empty range), and token counting (empty, basic, trajectory, fallback on error).
@teknium1

teknium1 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Merged in commit fd22ae5. All 25 tests pass, full suite at 1597. Thanks! 🙏

@teknium1 teknium1 merged commit fd22ae5 into NousResearch:main Mar 5, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
Authored by 0xbyt4.

25 tests covering CompressionConfig, TrajectoryMetrics, AggregateMetrics,
protected indices, content extraction, and token counting.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
Authored by 0xbyt4.

25 tests covering CompressionConfig, TrajectoryMetrics, AggregateMetrics,
protected indices, content extraction, and token counting.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
Authored by 0xbyt4.

25 tests covering CompressionConfig, TrajectoryMetrics, AggregateMetrics,
protected indices, content extraction, and token counting.
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.

2 participants