|
|
bdca84c942
|
fix: implement type-aware storage prefixes for commits and trees
Fixed critical bug where BlobStorage hardcoded 'blob:' prefix in 10 locations,
ignoring the 'type' parameter passed to write operations. This caused:
- Commits stored as blob:${hash} instead of commit:${hash}
- Trees stored as blob:${hash} instead of tree:${hash}
- brain.getHistory() returning empty arrays
Changes:
- src/storage/cow/BlobStorage.ts: Implement type-aware prefixes in 10 methods
- write(), read(), has(), delete(), getMetadata(), listBlobs()
- writeMultipart(), incrementRefCount(), decrementRefCount()
- tests/integration/cow-commit-storage.test.ts: Add regression tests (6 tests)
Backward compatibility: read() auto-detects type by trying commit:, tree:, blob:
prefixes, allowing old blob:* files to be read.
Works for ALL storage adapters (filesystem, S3, Azure, GCS, R2, memory, OPFS).
Fixes: Workshop team bug report (getHistory returns empty despite commits)
Tests: 6/6 new tests pass, 6/6 existing COW tests pass (no regressions)
|
2025-11-04 15:03:05 -08:00 |
|