Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should be possible to update/replace a pin with the same CID #1547

Closed
2color opened this issue Jun 21, 2022 · 4 comments · Fixed by #2125 or #2137
Closed

It should be possible to update/replace a pin with the same CID #1547

2color opened this issue Jun 21, 2022 · 4 comments · Fixed by #2125 or #2137

Comments

@2color
Copy link
Contributor

2color commented Jun 21, 2022

There are some cases where it's desired to update the name, meta, and origins fields of a pin request with a given CID using the replace pin endpoint.

Currently, the web3.storage pinning API returns the following 400 error when attempting to update those fields with the same CID.

const existingCid = existingPinRequest.sourceCid
if (newPinData.cid === existingCid) {
throw new PSAErrorInvalidData(INVALID_REPLACE)
}

Related: ipfs-shipyard/pinning-service-compliance#124

@dchoi27
Copy link
Contributor

dchoi27 commented Jul 18, 2022

cc @mbommerez seems quick to add in the PSA v2 initiative

@mbommerez
Copy link

Scenario:

  • When you replace a Pin Request with the same CID but different metadata, we get an error.

We need to double check the API spec and try to replicate.

@flea89 flea89 self-assigned this Nov 9, 2022
@flea89
Copy link
Contributor

flea89 commented Nov 15, 2022

There's some context here...
Wating to get an answer from the team there.
I wonder if we should go ahead anyway and have the replace always return a pin with the same requestid.

@flea89 flea89 removed their assignment Nov 15, 2022
@flea89
Copy link
Contributor

flea89 commented Nov 15, 2022

Discussed with @olizilla.
We should go ahead and allow for update-like operations but still, keep the behavior consistent with the current implementation and compliance checks here for now.
That means a new pin it's always created and a different requestid is returned by the endpoint.

We can then try to get some alignment and discuss an improved approach in the spec repo with the team.

@flea89 flea89 self-assigned this Nov 28, 2022
@flea89 flea89 removed their assignment Nov 28, 2022
adamalton pushed a commit that referenced this issue Dec 13, 2022
🤖 I have created a release *beep* *boop*
---


##
[7.13.0](api-v7.12.0...api-v7.13.0)
(2022-11-30)


### Features

* list and ability to delete psa request created though deleted tokens
([#2054](#2054))
([e150d1f](e150d1f))


### Bug Fixes

* allow update PSA pin requests with same CID
([#2125](#2125))
([0013efd](0013efd)),
closes [#1547](#1547)
* PSA compliance fixes
([#2091](#2091))
([8b1c1d3](8b1c1d3)),
closes [#1579](#1579)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants