generated from coulomb/repo-seed
WP-0001-T009: digest abstraction and content address (ADR-0001)
src/artifactstore/identity/__init__.py: - Digest: frozen, hashable dataclass (algorithm + lowercase hex), validated. - ContentAddress: canonical `<algorithm>:<hex>` string form with validating parser (to_digest) and emitter (str / from_digest). - DigestPair: dual-digest result (primary + sha256) from a single hashing pass. - Algorithm registry: register_algorithm / get_algorithm / list_algorithms with name validation `[a-z][a-z0-9_-]*`. - digest_bytes (sync) and digest_stream (async) — single-pass dual hashing. - BLAKE3 registered as PRIMARY_ALGORITHM, SHA-256 as INTEROP_ALGORITHM at module import. tests/unit/test_identity.py: - Hypothesis property test asserts digest_bytes matches hashlib.sha256 and blake3.blake3 for random byte sequences up to 4 KiB. - digest_stream invariants: equivalence with digest_bytes under chunked input; defaults to BLAKE3 primary; always computes SHA-256; handles empty input. - Digest / ContentAddress invariants: rejects uppercase hex, empty fields, odd hex length, missing separator; frozen and hashable. Gates: ruff clean, mypy --strict clean on 21 source files, 18 tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -95,7 +95,7 @@ Acceptance:
|
||||
|
||||
```task
|
||||
id: ARTIFACT-STORE-WP-0001-T009
|
||||
status: todo
|
||||
status: done
|
||||
priority: high
|
||||
state_hub_task_id: "4dc465c5-5c14-412d-b8c0-aa84076e4560"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user