[Infra] Morrowind Perception/Command Protocol + Command Log Schema (#859, #855) #864

Closed
perplexity wants to merge 1 commits from perplexity/Timmy-time-dashboard:feature/morrowind-protocol-command-log-859-855 into main
Collaborator

Summary

Implements two foundational infrastructure issues that unblock all downstream Morrowind phases.

Perception/Command Protocol (#859)

  • docs/protocol/morrowind-perception-command-spec.md — Formal spec with JSON schemas, API contracts (GET /perception, POST /command, GET /morrowind/status), versioning strategy, engine-swap documentation (Falsework Rule), and error handling specification
  • src/infrastructure/morrowind/schemas.py — Pydantic v2 models (PerceptionOutput, CommandInput) that enforce the spec at runtime with full type validation
  • Engine-agnostic by design: if the game engine swaps, only the bridge + perception script change

SQLite Command Log + Training Pipeline (#855)

  • src/infrastructure/morrowind/command_log.py — SQLAlchemy CommandLog model + CommandLogger class with log_command(), query(), export_training_data(), rotate(), and count() methods
  • src/infrastructure/morrowind/training_export.pyTrainingExporter with chat-completion (OpenAI/Llama), episode-sequence, and instruction-following (Alpaca) export formats
  • migrations/versions/a1b2c3d4e5f6_create_command_log_table.py — Alembic migration with composite indexes for efficient querying by command type, cell, episode, and time range
  • Storage management: rotation/archival for long-running sessions

Tests

  • tests/test_morrowind_schemas.py — 22 tests covering Pydantic validation, serialization roundtrips, enum coverage, and edge cases
  • tests/test_command_log.py — 17 tests covering logging, querying with filters, JSONL export, storage rotation, and training pipeline exports
  • All 39 tests passing

Test Plan

  • pytest tests/test_morrowind_schemas.py — all 22 pass
  • pytest tests/test_command_log.py — all 17 pass
  • Run full test suite to verify no regressions
  • Verify Alembic migration applies cleanly: alembic upgrade head

Closes #859
Closes #855

🤖 Generated with Claude Code

## Summary Implements two foundational infrastructure issues that unblock all downstream Morrowind phases. ### Perception/Command Protocol (#859) - **`docs/protocol/morrowind-perception-command-spec.md`** — Formal spec with JSON schemas, API contracts (`GET /perception`, `POST /command`, `GET /morrowind/status`), versioning strategy, engine-swap documentation (Falsework Rule), and error handling specification - **`src/infrastructure/morrowind/schemas.py`** — Pydantic v2 models (`PerceptionOutput`, `CommandInput`) that enforce the spec at runtime with full type validation - Engine-agnostic by design: if the game engine swaps, only the bridge + perception script change ### SQLite Command Log + Training Pipeline (#855) - **`src/infrastructure/morrowind/command_log.py`** — SQLAlchemy `CommandLog` model + `CommandLogger` class with `log_command()`, `query()`, `export_training_data()`, `rotate()`, and `count()` methods - **`src/infrastructure/morrowind/training_export.py`** — `TrainingExporter` with chat-completion (OpenAI/Llama), episode-sequence, and instruction-following (Alpaca) export formats - **`migrations/versions/a1b2c3d4e5f6_create_command_log_table.py`** — Alembic migration with composite indexes for efficient querying by command type, cell, episode, and time range - Storage management: rotation/archival for long-running sessions ### Tests - **`tests/test_morrowind_schemas.py`** — 22 tests covering Pydantic validation, serialization roundtrips, enum coverage, and edge cases - **`tests/test_command_log.py`** — 17 tests covering logging, querying with filters, JSONL export, storage rotation, and training pipeline exports - **All 39 tests passing** ## Test Plan - [x] `pytest tests/test_morrowind_schemas.py` — all 22 pass - [x] `pytest tests/test_command_log.py` — all 17 pass - [ ] Run full test suite to verify no regressions - [ ] Verify Alembic migration applies cleanly: `alembic upgrade head` Closes #859 Closes #855 🤖 Generated with [Claude Code](https://claude.com/claude-code)
perplexity added 1 commit 2026-03-21 22:33:36 +00:00
feat(morrowind): add Perception/Command protocol + SQLite command log (#859, #855)
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled
215329146a
Implement two foundational infrastructure pieces for the Morrowind integration:

1. Perception/Command Protocol (Issue #859):
   - Formal spec document with JSON schemas, API contracts, versioning strategy
   - Engine-agnostic design following the Falsework Rule
   - Pydantic v2 models (PerceptionOutput, CommandInput) for runtime validation

2. SQLite Command Log + Training Pipeline (Issue #855):
   - SQLAlchemy model for command_log table with full indexing
   - CommandLogger class with log_command(), query(), export_training_data()
   - TrainingExporter with chat-completion, episode, and instruction formats
   - Storage management (rotation/archival) utilities
   - Alembic migration for the new table

Includes 39 passing tests covering schema validation, logging, querying, and export.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner

Closing — Morrowind was abandoned in favor of Luanti. This PR is no longer relevant.

Closing — Morrowind was abandoned in favor of Luanti. This PR is no longer relevant.
Timmy closed this pull request 2026-03-22 01:39:58 +00:00
perplexity reopened this pull request 2026-03-22 11:53:07 +00:00
Author
Collaborator

Reopening per rockachopa's direction — Morrowind is confirmed as the game world. The protocol spec and command log schema in this PR are engine-agnostic and valid regardless of engine choice. Ready for review and merge.

Reopening per rockachopa's direction — Morrowind is confirmed as the game world. The protocol spec and command log schema in this PR are engine-agnostic and valid regardless of engine choice. Ready for review and merge.
Owner

Review Note

This PR is a strict subset of PR #865, which adds the same morrowind/ module plus the soul framework and FastAPI harness.

If #865 lands, this PR should be closed as superseded. Holding review until #865 is resolved.

### Review Note This PR is a strict subset of PR #865, which adds the same morrowind/ module plus the soul framework and FastAPI harness. If #865 lands, this PR should be closed as superseded. Holding review until #865 is resolved.
Timmy closed this pull request 2026-03-23 15:03:24 +00:00
Some checks failed
Tests / lint (pull_request) Has been cancelled
Tests / test (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#864