refactor: serialize slice fact event bodies semantically #60

Merged
jwilger merged 1 commit from refactor/slice-fact-typed-event-body into main 2026-06-08 03:46:50 -07:00
Owner

Summary

  • Serialize eventcore slice fact rows with a typed exported-event body field.
  • Keep deserializing legacy exported_event_type/payload rows for existing SQLite event stores.
  • Add a behavior test that covers the new row shape and legacy compatibility.

Rationale

  • This removes one internal string-plus-payload path from slice fact event handling while keeping JSON at the event-store boundary.
  • It moves slice fact replay toward the existing ExportedEventBody domain model without changing exported event files.

Verification

  • cargo fmt --check
  • git diff --check
  • cargo test eventcore_slice_fact_events_serialize_semantic_payloads
  • cargo test --lib event_runtime::external_tests
  • cargo test --lib
  • cargo test --test add_formal_slice_facts
  • cargo test --test event_log_export check_rebuilds_generated_artifacts_from_exported_events
  • just clippy
Summary - Serialize eventcore slice fact rows with a typed exported-event body field. - Keep deserializing legacy exported_event_type/payload rows for existing SQLite event stores. - Add a behavior test that covers the new row shape and legacy compatibility. Rationale - This removes one internal string-plus-payload path from slice fact event handling while keeping JSON at the event-store boundary. - It moves slice fact replay toward the existing ExportedEventBody domain model without changing exported event files. Verification - cargo fmt --check - git diff --check - cargo test eventcore_slice_fact_events_serialize_semantic_payloads - cargo test --lib event_runtime::external_tests - cargo test --lib - cargo test --test add_formal_slice_facts - cargo test --test event_log_export check_rebuilds_generated_artifacts_from_exported_events - just clippy
refactor: serialize slice fact event bodies semantically
All checks were successful
CI / Nix flake check (pull_request) Successful in 2m52s
CI / Request auto_review semantic review (pull_request) Successful in 2s
auto_review auto_review: no findings
CI / Rust CI (pull_request) Successful in 7m22s
a9cd985552
auto-review left a comment

The refactor introduces a new serialization format for slice fact events while maintaining backward compatibility with legacy formats. The changes appear well-structured and safe to merge, with comprehensive tests ensuring both new and legacy formats are handled correctly.

Walkthrough

  • src/core/event_commands.rs:
    • Refactored SliceFactEvent serialization to use a new body field instead of exported_event_type and payload.
    • Introduced SerializedSliceFactEvent to handle both new and legacy formats during deserialization.
    • Added error handling for mismatched or missing fields in the new format.
  • src/core/events.rs:
    • Added methods to ExportedEventBody for converting to and from the new tagged JSON format.
  • src/internal_semantic_tests.rs:
    • Updated tests to cover both the new serialization format and legacy compatibility.

LLM usage and cost

The refactor introduces a new serialization format for slice fact events while maintaining backward compatibility with legacy formats. The changes appear well-structured and safe to merge, with comprehensive tests ensuring both new and legacy formats are handled correctly. ## Walkthrough - **src/core/event_commands.rs**: - Refactored `SliceFactEvent` serialization to use a new `body` field instead of `exported_event_type` and `payload`. - Introduced `SerializedSliceFactEvent` to handle both new and legacy formats during deserialization. - Added error handling for mismatched or missing fields in the new format. - **src/core/events.rs**: - Added methods to `ExportedEventBody` for converting to and from the new tagged JSON format. - **src/internal_semantic_tests.rs**: - Updated tests to cover both the new serialization format and legacy compatibility. ## LLM usage and cost - Reasoning (gpt-4o) in=2971 out=415 cost=$0.021080 - Cheap (gpt-4o-mini) in=449 out=46 cost=$0.000095 Estimated total USD: $0.021175 via https://api.openai.com and https://api.openai.com
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Slipstream/emc!60
No description provided.