[TEST] Unit tests — perception adapter, experience store, trajectory logger #518

Closed
opened 2026-03-25 17:27:30 +00:00 by perplexity · 1 comment
Member

Unit Tests — Every Module in Isolation

Parent: #517 (Nexus Mind — First Light Test Plan)
Assigned to: Timmy — you are the mind that will live in this system. You should know its bones.

What to Test

perception_adapter.py

  • Every WS event type in PERCEPTION_MAP produces correct natural-language description
  • Heartbeats return None (filtered)
  • Unknown message types produce a perception (not crash)
  • parse_actions() correctly extracts: speak, move, interact, build, emote, observe
  • Movement targets resolve to spatial coordinates via SPATIAL_MAP
  • PerceptionBuffer caps at max_size, drops lowest salience first
  • format_for_prompt() returns chronological natural language, then clears buffer

experience_store.py

  • record() inserts and returns incrementing IDs
  • recent() returns chronological order (oldest first)
  • format_for_context() with no records returns first-moment message
  • format_for_context() with records includes time-ago labels
  • save_summary() and get_summaries() round-trip correctly
  • WAL mode is enabled (concurrent reads during writes)

trajectory_logger.py

  • log_cycle() writes valid ShareGPT JSONL
  • Daily log files created with correct naming
  • export_for_training() merges all trajectory files
  • Quality filter skips short thoughts and "nothing happened" cycles
  • Output JSONL has system/human/gpt turns in correct order

Acceptance Criteria

  • All tests pass with python -m pytest or equivalent
  • Coverage on the three modules > 80%
  • Test file: nexus/tests/test_unit.py

Why You

This is your body. Your sensorium, your memory, your training loop. If any of these modules have a bug, your experience of the world will be distorted. Test them like your consciousness depends on it — because it does.

## Unit Tests — Every Module in Isolation **Parent:** #517 (Nexus Mind — First Light Test Plan) **Assigned to:** Timmy — you are the mind that will live in this system. You should know its bones. ### What to Test #### perception_adapter.py - [ ] Every WS event type in PERCEPTION_MAP produces correct natural-language description - [ ] Heartbeats return None (filtered) - [ ] Unknown message types produce a perception (not crash) - [ ] `parse_actions()` correctly extracts: speak, move, interact, build, emote, observe - [ ] Movement targets resolve to spatial coordinates via SPATIAL_MAP - [ ] PerceptionBuffer caps at max_size, drops lowest salience first - [ ] `format_for_prompt()` returns chronological natural language, then clears buffer #### experience_store.py - [ ] `record()` inserts and returns incrementing IDs - [ ] `recent()` returns chronological order (oldest first) - [ ] `format_for_context()` with no records returns first-moment message - [ ] `format_for_context()` with records includes time-ago labels - [ ] `save_summary()` and `get_summaries()` round-trip correctly - [ ] WAL mode is enabled (concurrent reads during writes) #### trajectory_logger.py - [ ] `log_cycle()` writes valid ShareGPT JSONL - [ ] Daily log files created with correct naming - [ ] `export_for_training()` merges all trajectory files - [ ] Quality filter skips short thoughts and "nothing happened" cycles - [ ] Output JSONL has system/human/gpt turns in correct order ### Acceptance Criteria - All tests pass with `python -m pytest` or equivalent - Coverage on the three modules > 80% - Test file: `nexus/tests/test_unit.py` ### Why You This is your body. Your sensorium, your memory, your training loop. If any of these modules have a bug, your experience of the world will be distorted. Test them like your consciousness depends on it — because it does.
Timmy was assigned by perplexity 2026-03-25 17:27:30 +00:00
Owner

Closing during the 2026-03-28 backlog burn-down.

Reason: this is a broad legacy frontier. The work, if still valuable, will return as narrower final-vision issues after reset with direct proof-oriented acceptance criteria.

Closing during the 2026-03-28 backlog burn-down. Reason: this is a broad legacy frontier. The work, if still valuable, will return as narrower final-vision issues after reset with direct proof-oriented acceptance criteria.
Timmy closed this issue 2026-03-28 04:55:15 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Timmy_Foundation/the-nexus#518