gabriel / musehub public
fix BREAKING task/wire-hash-validators #1 / 1
AI Agent gabriel · 136 days ago · May 5, 2026 · Diff

fix: canonical hash prefixes at wire boundary + MappedAsDataclass FK null bug

- wire.py: add field_validator on WireCommit.prompt_hash, WireSnapshot.manifest values, and WireSnapshotDelta.added values — reject non-canonical object IDs at the wire protocol boundary - musehub_models.py: remove default=None from repo relationship on MusehubCommit, MusehubIssue, MusehubProposal — MappedAsDataclass with default=None on a many-to-one relationship causes SQLAlchemy to null the FK column on flush - musehub_wire.py: sort batch objects topologically (ancestor first, descendant last within same path) so delta encoding always goes forward in history; catch ValueError from compute_delta and fall back to full frame - test_id_canonical.py: 36 tests for canonical prefix validation - test_snapshot_entries.py: use blob_id() for manifest values to pass validators - test_wire_compression.py: fix _make_object to write to per-repo path matching wire_fetch_stream read path; all 8 compression tests pass - conftest.py: LocalBackend(repo_root=tmp_path) + lambda accepts owner/slug args

sha256:9f9cfb604666e9ffefbdc12426e551224e1a5dd4680977b7bd4e0da2fc798184 sha
+18 ~22 symbols
sha256:87f8d085534bbd0d2bb4a3d5207bd52c32ae9475f5d5706fb567565727dc10f2 snapshot
+18
symbols added
~22
symbols modified
0
dead code introduced
Semantic Changes 40 symbols
~ musehub/models/wire.py .py 3 symbols added, 3 symbols modified
+ _check_prompt_hash method method _check_prompt_hash L138–143
+ _check_manifest_values method method _check_manifest_values L177–188
+ _check_added_values method method _check_added_values L229–240
~ tests/conftest.py .py 1 symbol modified
~ tests/test_id_canonical.py .py 15 symbols added, 3 symbols modified
+ TestWireCommitPromptHashValidation class class TestWireCommitPromptHashValidation L389–417
+ test_arbitrary_string_prompt_hash_rejected method method test_arbitrary_string_prompt_hash_rejected L411–417
+ test_bare_hex_prompt_hash_rejected method method test_bare_hex_prompt_hash_rejected L403–409
+ test_canonical_prompt_hash_accepted method method test_canonical_prompt_hash_accepted L396–401
+ test_empty_prompt_hash_accepted method method test_empty_prompt_hash_accepted L392–394
+ TestWireSnapshotDeltaValidation class class TestWireSnapshotDeltaValidation L339–386
+ test_added_bare_hex_object_id_rejected method method test_added_bare_hex_object_id_rejected L350–357
+ test_added_multiple_entries_all_validated method method test_added_multiple_entries_all_validated L368–378
+ test_added_uuid_object_id_rejected method method test_added_uuid_object_id_rejected L359–366
+ test_canonical_delta_accepted method method test_canonical_delta_accepted L342–348
+ test_empty_added_accepted method method test_empty_added_accepted L380–386
+ test_manifest_bare_hex_object_id_rejected method method test_manifest_bare_hex_object_id_rejected L311–317
+ test_manifest_multiple_entries_all_canonical method method test_manifest_multiple_entries_all_canonical L327–336
+ test_manifest_uuid_object_id_rejected method method test_manifest_uuid_object_id_rejected L319–325
+ WireSnapshotDelta import import WireSnapshotDelta L31–31
← Older Oldest on task/wire-hash-validators
All commits
Newer → Latest on task/wire-hash-validators

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