bee icon indicating copy to clipboard operation
bee copied to clipboard

Mantaray removed entry still persists

Open asabya opened this issue 1 year ago • 5 comments

⚠️ Support requests in an issue-format will be closed immediately. For support, go to Swarm's Discord.

Context

Bee Version: current master System information: Mac M1

Summary

Adding and Persisting Nodes: Multiple nodes are added in the manifest, then saved.

Node Removal: Getting the saved node's reference from the previous step, a new manifest is loaded. Then one of the nodes is removed.

Persistence After Removal: The manifest is saved again after removing the node and reloaded to ensure the removed node does not reappear.

I have added a test that confirms that the removed node, img/2.png, cannot be found, verifying the removal operation. The expectation is for the system to return a mantaray.ErrNotFound error when trying to look up the removed node.

Expected behavior

This persistence should be rectified in the code logic or the test setup.

Actual behavior

Despite removing img/2.png, the removed node still persists at the end.

Steps to reproduce

  • the problem involves mantaray package I think
  • I have added a test in the mantaray_test package -> persist_test.go file.

Please see the test : https://github.com/asabya/bee/blob/4a8c3c5d994a9d91e69e7680237274667efb0ebf/pkg/manifest/mantaray/persist_test.go#L66

Possible solution

asabya avatar Sep 10 '24 06:09 asabya

This issue seems to be related to the mantaray-js implementation so it may be better reported in that repository. https://github.com/ethersphere/mantaray-js

ldeffenb avatar Sep 10 '24 15:09 ldeffenb

@ldeffenb Not sure what you mean actually. I have not personally used mantaray-js ever. I stumbled upon this issue while doing some experiment on bzz collection, trying to remove file/node from a manifest root node.

asabya avatar Sep 10 '24 17:09 asabya

There is no way that I know (knew) of to remove an individual manifest node using just the bee node APIs. From the description of what you did, I assumed (with all of the negative connotations of that word) that you were doing this external to the node with type/javascript using the mantaray-js package.

Having looked at your test, it appears that you are using the bee node package for the manifest and coding your program in golang? I haven't heard of anyone trying to do this before, and therefore I'm not certain that directly accessing the packages that make up the bee node is supported. But I'm willing to be proved worng (sic)!

https://github.com/ethersphere/bee/tree/master/pkg/manifest/mantaray

But do be aware that any data that is uploaded to the swarm cannot be directly deleted. So even if you manage to remove the manifest node (and thereby get a new root manifest reference), the original data will still be accessible on the swarm via the original references, both of the data itself and/or the old root manifest reference and suitable path.

ldeffenb avatar Sep 10 '24 17:09 ldeffenb

I assumed (with all of the negative connotations of that word) that you were doing this external to the node with type/javascript using the mantaray-js package.

Yes, I am doing this external to the node. But with golang, using the packages from bee itself.

I haven't heard of anyone trying to do this before, and therefore I'm not certain that directly accessing the packages that make up the bee node is supported. But I'm willing to be proved worng (sic)!

As the packages can be imported and have the interfaces to be implemented, I can assure you it is possible. Not sure if it's officially supported, but on most of the few cases that i tried it worked. Like, adding file entries into an existing manifest, adding custom metadata to entries etc.

But do be aware that any data that is uploaded to the swarm cannot be directly deleted. So even if you manage to remove the manifest node (and thereby get a new root manifest reference), the original data will still be accessible on the swarm via the original references, both of the data itself and/or the old root manifest reference and suitable path.

Yes I am aware of the fact that anything on swarm cannot be directly deleted and content will be accessible from both references. My idea is to update the manifest and access it from a feed.

asabya avatar Sep 10 '24 17:09 asabya

I was going through the mantaray-js repo. Saw this issue https://github.com/ethersphere/mantaray-js/issues/40. I think it has the same issue as mine.

asabya avatar Sep 11 '24 09:09 asabya