gabriel / musehub public
feat BREAKING task/raw-op-fidelity #3 / 3
AI Agent gabriel · 135 days ago · May 4, 2026 · Diff

feat: store raw DomainOp types and full op payload; remove lossy mapping

Replaces the _op_to_muse_op collapse (insert→add, replace/patch→modify) with full-fidelity storage. The structured delta algebra is Muse's special sauce — collapsing it at the DB boundary loses the semantic distinction between replace (atomic swap), patch (container with child_ops), and mutate (field-level changes with stable entity identity).

Changes: - Migration 0018: add op_payload JSON column to musehub_symbol_history_entries; widen musehub_symbol_intel.op from String(16) to String(32) - Model: add op_payload Mapped[dict|None] to MusehubSymbolHistoryEntry - Indexer: delete _op_to_muse_op; store op literal verbatim (insert, replace, patch, mutate, move, delete, directory_rename); build op_payload as op dict minus op/address/child_ops keys; fix hash_occurrence filter to match insert/ replace/patch/mutate - load_symbol_history: pass op_payload through from DB - ui_symbols.py: update op=='add' guard to op=='insert' - Template: render all 7 raw op types with correct badges and dot colours - Tests: replace TestOpToMuseOp (deleted function) with TestRawOpStorage (6 tests covering insert, replace, patch, mutate, rename, payload exclusion) - docs/db-management.md: new agent runbook for migrations, backfills, container topology, and common mistakes

sha256:216ceb7bd277c270a76962446b1620b842bd3cbbb209686cbc7ebb1e7f5a8acf sha
+26 ~11 −11 symbols
sha256:7981cca5a64ff8082f4e1fea32a6968e74ab1eec510cfec3f3f7090576234118 snapshot
+26
symbols added
~11
symbols modified
−11
symbols removed
0
dead code introduced
Semantic Changes 48 symbols
+ branch_labels variable variable branch_labels L14–14
+ depends_on variable variable depends_on L15–15
+ down_revision variable variable down_revision L13–13
+ downgrade function function downgrade L33–41
+ annotations import import annotations L7–7
+ op import import op L9–9
+ sa import import sa L10–10
+ revision variable variable revision L12–12
+ upgrade function function upgrade L18–30
~ docs/db-management.md .md 8 symbols added
+ MuseHub — Database Management section MuseHub — Database Management L1–198
+ Common agent mistakes section Common agent mistakes L190–198
+ Container topology section Container topology L8–27
+ Inspecting the database section Inspecting the database L113–155
+ Running backfill scripts section Running backfill scripts L88–112
+ Running migrations section Running migrations L28–53
+ Schema overview section Schema overview L156–189
+ Writing a migration section Writing a migration L54–87
~ musehub/services/musehub_symbol_indexer.py .py 2 symbols added, 1 symbol removed, 4 symbols modified
_op_to_muse_op function function _op_to_muse_op L131–140
+ _PAYLOAD_STRIP variable variable _PAYLOAD_STRIP L131–131
+ _op_payload function function _op_payload L134–136
~ tests/test_snapshot_symbol_indexer.py .py 7 symbols added, 10 symbols removed, 4 symbols modified
TestOpToMuseOp class class TestOpToMuseOp L209–238
_run method method _run L212–214
test_delete_maps_to_delete method method test_delete_maps_to_delete L219–220
test_directory_rename_maps_to_rename method method test_directory_rename_maps_to_rename L231–232
test_empty_string_passthrough method method test_empty_string_passthrough L237–238
test_insert_maps_to_add method method test_insert_maps_to_add L216–217
test_move_maps_to_move method method test_move_maps_to_move L228–229
test_patch_maps_to_modify method method test_patch_maps_to_modify L225–226
test_replace_maps_to_modify method method test_replace_maps_to_modify L222–223
test_unknown_op_passthrough method method test_unknown_op_passthrough L234–235
+ TestRawOpStorage class class TestRawOpStorage L209–407
+ test_insert_op_stored_raw method async_method test_insert_op_stored_raw L213–241
+ test_mutate_op_stored_raw_with_fields method async_method test_mutate_op_stored_raw_with_fields L317–348
+ test_op_payload_excludes_op_and_address_keys method async_method test_op_payload_excludes_op_and_address_keys L382–407
+ test_patch_op_stored_raw_with_child_summary method async_method test_patch_op_stored_raw_with_child_summary L277–314
+ test_patch_with_from_address_is_rename method async_method test_patch_with_from_address_is_rename L351–379
+ test_replace_op_stored_raw method async_method test_replace_op_stored_raw L244–274

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:216ceb7bd277c270a76962446b1620b842bd3cbbb209686cbc7ebb1e7f5a8acf --body "your comment"