fix: add ResolveRenameOp to handle directory renames

RenameNode was calling Resolve() which generated blob keys for
directories that don't have blobs, causing 'key not found' errors.

Added ResolveRenameOp to BlobKeyResolver interface:
- FlatKeyResolver returns nil (UUIDs don't change on rename)
- HierarchicalKeyResolver returns move op for files and directories

This allows directory renames to work correctly with flat storage,
and leverages os.Rename for atomic directory moves with hierarchical.

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-01-04 23:58:43 +00:00
parent b8e1671248
commit d0c2a21ffd
5 changed files with 75 additions and 12 deletions

View File

@@ -45,3 +45,9 @@ func (r *FlatKeyResolver) ResolveBulkMoveOps(ctx context.Context, db bun.IDB, no
}
return nil, nil
}
// ResolveRenameOp returns nil for flat key storage since blob keys are UUIDs
// and don't change when nodes are renamed.
func (r *FlatKeyResolver) ResolveRenameOp(ctx context.Context, db bun.IDB, node *Node, newName string) (*BlobMoveOp, error) {
return nil, nil
}