gabriel / musehub public
feat patch identity task/identity-migration-backfill #1 / 1
AI Agent gabriel · 146 days ago · May 1, 2026 · Diff

feat(identity): migration backfill — identity repos for pre-Phase-1 identities

- Add musehub/maintenance/identity_backfill.py backfill_identity_repos(session) creates identity repos for all identities that don't already have one. Idempotent — skips existing repos. Resolves pubkey from most-recently-created MusehubAuthKey for human/agent. Org identities: pubkey=None, quorum from org_quorum column. Skips soft-deleted identities. Returns {total, created, skipped} summary dict. - Add 9-test TDD suite: test_identity_repo_migration.py creates repo for human/agent/org, null pubkey for keyless identity, idempotent (no duplicate repo, single commit), skips deleted, return counts

Cumulative: 75 tests GREEN (66 phase tests + 9 migration tests, +1 quorum = 76).

sha256:2686a326eba5e65c950da7840fa1512e564b31a0857fa001dac8f5ab5337d1a0 sha
+41 symbols
sha256:12eec2ef9c3a44a1a4422196526970a04059f9a4537964e21d1f392b58bfe3e0 snapshot
+41
symbols added
0
dead code introduced
Semantic Changes 41 symbols
+ backfill_identity_repos function async_function backfill_identity_repos L39–142
+ AsyncSession import import AsyncSession L31–31
+ MusehubAuthKey import import MusehubAuthKey L34–34
+ annotations import import annotations L25–25
+ datetime import import datetime L28–28
+ db import import db L33–33
+ logging import import logging L27–27
+ select import import select L30–30
+ timezone import import timezone L28–28
+ logger variable variable logger L36–36
~ tests/test_identity_repo_migration.py .py 31 symbols added
+ _COUNTER variable variable _COUNTER L36–36
+ _KEY_M_B64 variable variable _KEY_M_B64 L40–40
+ _KEY_M_BYTES variable variable _KEY_M_BYTES L39–39
+ _NOW variable variable _NOW L35–35
+ _has_identity_repo function async_function _has_identity_repo L84–91
+ _make_auth_key function function _make_auth_key L69–81
+ _make_identity function function _make_identity L48–66
+ _read_repo_identity_record function async_function _read_repo_identity_record L94–138
+ _uid function function _uid L43–45
+ AsyncSession import import AsyncSession L29–29
+ MusehubAuthKey import import MusehubAuthKey L33–33
+ annotations import import annotations L19–19
+ base64 import import base64 L22–22
+ compute_identity_id import import compute_identity_id L31–31
+ datetime import import datetime L27–27
+ db import import db L32–32
+ hashlib import import hashlib L23–23
+ json import import json L21–21
+ msgpack import import msgpack L25–25
+ pytest import import pytest L26–26
+ select import import select L28–28
+ timezone import import timezone L27–27
+ test_backfill_agent_record_type_is_agent function async_function test_backfill_agent_record_type_is_agent L191–208
+ test_backfill_creates_identity_repo_for_human function async_function test_backfill_creates_identity_repo_for_human L147–165
+ test_backfill_human_record_has_correct_pubkey function async_function test_backfill_human_record_has_correct_pubkey L169–187
+ test_backfill_idempotent_no_duplicate_repo function async_function test_backfill_idempotent_no_duplicate_repo L279–306
+ test_backfill_idempotent_single_commit function async_function test_backfill_idempotent_single_commit L310–339
+ test_backfill_no_key_uses_null_pubkey function async_function test_backfill_no_key_uses_null_pubkey L254–270
+ test_backfill_org_record_has_null_pubkey_and_quorum function async_function test_backfill_org_record_has_null_pubkey_and_quorum L217–245
+ test_backfill_returns_counts function async_function test_backfill_returns_counts L372–391
+ test_backfill_skips_deleted_identities function async_function test_backfill_skips_deleted_identities L348–363
← Older Oldest on task/identity-migration-backfill
All commits
Newer → Latest on task/identity-migration-backfill

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