fix(cow): asOf() fails with "COW not enabled" due to property name mismatch
HistoricalStorageAdapter was looking for underscore-prefixed properties (_commitLog, _blobStorage, _treeObject) but BaseStorage sets them without underscores (commitLog, blobStorage). This caused all asOf() calls to fail. Changes: - Fix property access: use commitLog/blobStorage instead of _commitLog/_blobStorage - Remove unused treeObject property (TreeObject is dynamically imported) - Remove unused TreeObject static import Reported by: Soulcraft Workshop Team 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
0ba6da405e
commit
b3ae18be00
1 changed files with 4 additions and 6 deletions
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
import { BaseStorage } from '../baseStorage.js'
|
||||
import { CommitLog } from '../cow/CommitLog.js'
|
||||
import { TreeObject } from '../cow/TreeObject.js'
|
||||
import { BlobStorage } from '../cow/BlobStorage.js'
|
||||
import {
|
||||
HNSWNoun,
|
||||
|
|
@ -127,7 +126,6 @@ export class HistoricalStorageAdapter extends BaseStorage {
|
|||
|
||||
// Historical commit state (loaded lazily) - must match BaseStorage visibility
|
||||
public commitLog?: CommitLog
|
||||
public treeObject?: TreeObject
|
||||
public blobStorage?: BlobStorage
|
||||
|
||||
constructor(options: HistoricalStorageAdapterOptions) {
|
||||
|
|
@ -146,11 +144,11 @@ export class HistoricalStorageAdapter extends BaseStorage {
|
|||
*/
|
||||
public async init(): Promise<void> {
|
||||
// Get COW components from underlying storage
|
||||
this.commitLog = (this.underlyingStorage as any)._commitLog
|
||||
this.treeObject = (this.underlyingStorage as any)._treeObject
|
||||
this.blobStorage = (this.underlyingStorage as any)._blobStorage
|
||||
// v6.2.4: Fixed property names - use public properties without underscore prefix
|
||||
this.commitLog = this.underlyingStorage.commitLog
|
||||
this.blobStorage = this.underlyingStorage.blobStorage
|
||||
|
||||
if (!this.commitLog || !this.treeObject || !this.blobStorage) {
|
||||
if (!this.commitLog || !this.blobStorage) {
|
||||
throw new Error(
|
||||
'Historical storage requires underlying storage to have COW enabled. ' +
|
||||
'Call brain.init() first to initialize COW.'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue