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

feat: Phase 1 — create identity repo on registration

- Add commit_files_to_repo() helper in musehub_sync.py: server-side helper that writes files to a repo as a single commit without a client push (used by identity bootstrapping and future server-side writes)

- Add _create_identity_repo() in musehub_auth.py: idempotent helper that creates {handle}/identity repo (domain_id='identity', visibility='private') and commits the initial IdentityRecord to 'main'

- Wire _create_identity_repo into verify_and_authenticate() for human registrations and register_agent_identity() for agent registrations

- Add tests/test_identity_repo_phase1.py: 12 TDD regression tests covering repo creation, domain/visibility, initial commit, record content (handle/type/pubkey/registered_at), idempotency, and agent identity type; all 12 GREEN

Closes #19 Phase 1

sha256:5db4540f000274071d68dfd00c33be78485383308e1948d7b23d78af53760789 sha
+44 ~2 symbols
sha256:3c317cfa20dd409358f124832aaba498989137579ad3bf40e95c288505b754bd snapshot
+44
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 46 symbols
~ tests/test_identity_repo_phase1.py .py 39 symbols added
+ TestAgentIdentityRepo class class TestAgentIdentityRepo L316–366
+ test_agent_identity_record_type_is_agent method async_method test_agent_identity_record_type_is_agent L347–366
+ test_agent_registration_creates_identity_repo method async_method test_agent_registration_creates_identity_repo L317–345
+ TestIdentityRecordContent class class TestIdentityRecordContent L267–308
+ test_identity_record_handle_matches method async_method test_identity_record_handle_matches L268–275
+ test_identity_record_pubkey_matches_registered_key method async_method test_identity_record_pubkey_matches_registered_key L286–297
+ test_identity_record_registered_at_is_set method async_method test_identity_record_registered_at_is_set L299–308
+ test_identity_record_type_is_human method async_method test_identity_record_type_is_human L277–284
+ TestIdentityRepoCreatedOnRegistration class class TestIdentityRepoCreatedOnRegistration L81–168
+ test_identity_repo_has_correct_domain method async_method test_identity_repo_has_correct_domain L101–117
+ test_identity_repo_is_private method async_method test_identity_repo_is_private L119–135
+ test_login_does_not_create_duplicate_repo method async_method test_login_does_not_create_duplicate_repo L137–168
+ test_registration_creates_identity_repo method async_method test_registration_creates_identity_repo L82–99
+ TestIdentityRepoInitialCommit class class TestIdentityRepoInitialCommit L176–259
+ test_identity_repo_has_commit_on_main method async_method test_identity_repo_has_commit_on_main L177–203
+ test_initial_commit_has_identity_record_object method async_method test_initial_commit_has_identity_record_object L205–259
+ _keypair function function _keypair L42–45
+ _read_identity_record function async_function _read_identity_record L372–417
+ _register function async_function _register L54–73
+ _sign_nonce function function _sign_nonce L48–51
+ AsyncSession import import AsyncSession L26–26
+ Ed25519PrivateKey import import Ed25519PrivateKey L19–19
+ MusehubAuthKey import import MusehubAuthKey L31–31
+ annotations import import annotations L14–14
+ b64url_encode import import b64url_encode L29–29
+ blob_id import import blob_id L20–20
+ compute_identity_id import import compute_identity_id L28–28
+ compute_key_id import import compute_key_id L28–28
+ create_challenge import import create_challenge L32–32
+ db import import db L30–30
+ encode_pubkey import import encode_pubkey L20–20
+ identity_path import import identity_path L21–21
+ json import import json L16–16
+ key_fingerprint import import key_fingerprint L29–29
+ pytest import import pytest L18–18
+ record_from_bytes import import record_from_bytes L21–21
+ register_agent_identity import import register_agent_identity L32–32
+ select import import select L25–25
+ verify_and_authenticate import import verify_and_authenticate L32–32
~ musehub/services/musehub_auth.py .py 1 symbol added, 2 symbols modified
+ _create_identity_repo function async_function _create_identity_repo L75–139
~ musehub/services/musehub_sync.py .py 4 symbols added
+ commit_files_to_repo function async_function commit_files_to_repo L455–542
+ blob_id import import blob_id L28–28
+ datetime import import datetime L20–20
+ hashlib import import hashlib L21–21
← Older Oldest on task/identity-repo-phase1
All commits
Newer → Latest on task/identity-repo-phase1

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