gabriel / musehub public
refactor BREAKING coord task/coord-genesis-ids #1 / 1
AI Agent gabriel · 134 days ago · May 4, 2026 · Diff

refactor(coord): genesis IDs for task + reservation; fix composite PK bug

task_id and reservation_id were the last two UUID surrogates. Both now use genesis-addressed IDs deterministic from their creation context.

task_id = sha256(repo_id NUL queue NUL created_by NUL created_at_iso) reservation_id = sha256(repo_id NUL agent_id NUL sorted_addresses NUL created_at_iso)

This also fixes a latent bug in _materialize_reservation: the old PK was reservation_id alone, so session.get(PK) on loop iteration 2+ found the first row and skipped all subsequent addresses. Only the first symbol was ever stored.

Fix: composite PK (reservation_id, symbol_address) — one row per address per reservation. session.get now uses (reservation_id, address) tuple. extend_reservation updated to use UPDATE WHERE instead of single-row get. Alembic 0023 migrates live.

TDD: test_reservation_multi_address_stores_all_rows (was red, now green) test_task_id_canonical, test_reservation_id_canonical

sha256:a735c8de3c86c03bfb32bc069810dcd5a8699a6cf7296799c40108d296cdaa3b sha
+19 ~36 symbols
sha256:aa3a08f7fee5b502f24ea8519856ef6bea8710ae0cf8db406149a1008ba6d726 snapshot
+19
symbols added
~36
symbols modified
0
dead code introduced
Semantic Changes 55 symbols
+ branch_labels variable variable branch_labels L22–22
+ depends_on variable variable depends_on L23–23
+ down_revision variable variable down_revision L21–21
+ downgrade function function downgrade L41–48
+ annotations import import annotations L15–15
+ op import import op L17–17
+ sa import import sa L18–18
+ revision variable variable revision L20–20
+ upgrade function function upgrade L26–38
~ musehub/core/genesis.py .py 2 symbols added
+ compute_reservation_id function function compute_reservation_id L594–611
+ compute_task_id function function compute_task_id L573–587
~ musehub/db/coord_models.py .py 1 symbol added, 7 symbols modified
+ PrimaryKeyConstraint import import PrimaryKeyConstraint L37–37
~ Index
~ String
~ tests/test_coordination.py .py 1 symbol added, 1 symbol modified
+ test_reservation_multi_address_stores_all_rows method async_method test_reservation_multi_address_stores_all_rows L928–975
~ tests/test_genesis_ids.py .py 6 symbols added, 24 symbols modified
+ test_reservation_id_canonical method method test_reservation_id_canonical L227–228
+ test_task_id_canonical method method test_task_id_canonical L224–225
+ _RESERVATION_ID variable variable _RESERVATION_ID L157–161
+ _TASK_ID variable variable _TASK_ID L156–156
+ compute_reservation_id import import compute_reservation_id L74–74
+ compute_task_id import import compute_task_id L74–74
← Older Oldest on task/coord-genesis-ids
All commits
Newer → Latest on task/coord-genesis-ids

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:a735c8de3c86c03bfb32bc069810dcd5a8699a6cf7296799c40108d296cdaa3b --body "your comment"