gabriel / musehub public
feat patch identity task/identity-phase6-get-identity-from-repo #1 / 1
AI Agent gabriel · 143 days ago · May 1, 2026 · Diff

feat(identity): Phase 6 — GET /api/identities/{handle} reads from identity repo HEAD

- Add _read_identity_record_from_repo() in identities.py Reads identity repo HEAD manifest → identities/{handle}.json → parses IdentityRecord. Returns None when no identity repo exists (migration-period fallback). - Update _row_to_dict() to accept optional repo_record pubkey, quorum: sourced from identity repo (canonical truth) identity_type: sourced from identity repo type field display_name: repo metadata.display_name takes precedence over DB bio, avatar_url and all other profile fields: still from DB (enrichment) - Update get_identity() to call _read_identity_record_from_repo() and pass result - Add 11-test TDD suite: test_identity_repo_phase6.py pubkey from repo, key-rotation reflected immediately, org quorum field, display_name from metadata, bio+avatar_url from DB alongside repo data, DB fallback (pubkey=null, quorum=null), 404 for unknown handle

Phase 6/6 of identity-plugin wiring (issue #19 / staging #2). Cumulative: 66 tests GREEN.

sha256:5395d12a5644b5548abdb28fe94ee430b92a263229d6deb2159b7a3fd531d6bf sha
+39 ~2 symbols
sha256:4acfcde52417bc996f364a19b29bc4cd01ca5fee95ae90af37370370f7b88439 snapshot
+39
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 41 symbols
~ tests/test_identity_repo_phase6.py .py 38 symbols added
+ TestGetIdentityFallback class class TestGetIdentityFallback L407–456
+ test_no_identity_repo_falls_back_to_db method async_method test_no_identity_repo_falls_back_to_db L408–420
+ test_no_identity_repo_pubkey_is_null method async_method test_no_identity_repo_pubkey_is_null L422–436
+ test_no_identity_repo_quorum_is_null method async_method test_no_identity_repo_quorum_is_null L438–450
+ test_unknown_handle_returns_404 method async_method test_unknown_handle_returns_404 L452–456
+ TestGetIdentityMergesDbEnrichment class class TestGetIdentityMergesDbEnrichment L345–399
+ test_db_avatar_url_present method async_method test_db_avatar_url_present L376–399
+ test_db_bio_present_alongside_repo_pubkey method async_method test_db_bio_present_alongside_repo_pubkey L346–374
+ TestGetIdentityReadsFromRepo class class TestGetIdentityReadsFromRepo L238–337
+ test_get_identity_display_name_from_repo_metadata method async_method test_get_identity_display_name_from_repo_metadata L320–337
+ test_get_identity_pubkey_reflects_key_rotation method async_method test_get_identity_pubkey_reflects_key_rotation L256–273
+ test_get_identity_returns_pubkey_from_repo method async_method test_get_identity_returns_pubkey_from_repo L239–254
+ test_get_identity_type_from_repo method async_method test_get_identity_type_from_repo L275–287
+ test_get_org_identity_includes_quorum method async_method test_get_org_identity_includes_quorum L289–318
+ _COUNTER variable variable _COUNTER L47–47
+ _KEY_X_B64 variable variable _KEY_X_B64 L40–40
+ _KEY_X_BYTES variable variable _KEY_X_BYTES L39–39
+ _KEY_Y_B64 variable variable _KEY_Y_B64 L43–43
+ _KEY_Y_BYTES variable variable _KEY_Y_BYTES L42–42
+ _NOW variable variable _NOW L45–45
+ _make_identity function function _make_identity L58–69
+ _seed_identity_repo function async_function _seed_identity_repo L72–152
+ _uid function function _uid L53–55
+ _update_identity_repo_key function async_function _update_identity_repo_key L155–226
+ AsyncClient import import AsyncClient L28–28
+ AsyncSession import import AsyncSession L29–29
+ MusehubBranch import import MusehubBranch L230–230
+ annotations import import annotations L19–19
+ base64 import import base64 L21–21
+ compute_branch_id import import compute_branch_id L31–31
+ compute_identity_id import import compute_identity_id L31–31
+ compute_repo_id import import compute_repo_id L31–31
+ datetime import import datetime L27–27
+ hashlib import import hashlib L22–22
+ json import import json L23–23
+ msgpack import import msgpack L25–25
+ pytest import import pytest L26–26
+ timezone import import timezone L27–27
~ musehub/api/routes/api/identities.py .py 1 symbol added, 2 symbols modified
+ _read_identity_record_from_repo function async_function _read_identity_record_from_repo L255–308
← Older Oldest on task/identity-phase6-get-identity-from-repo
All commits
Newer → Latest on task/identity-phase6-get-identity-from-repo

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