Skip to content

Conversation

@Kubuxu
Copy link
Collaborator

@Kubuxu Kubuxu commented Nov 24, 2025

Introduces a IdempotencyKey to JSON paylods of these handlers, which
deboounces requests and if the request with the same key completed,
redirects to the created resource.

Users should use UUIDs or ULIDs as their IdempotencyKey-s

Introduces a `IdempotencyKey` to JSON paylods of these handlers, which
deboounces requests and if the request with the same key completed,
redirects to the created resource.

Users should use UUIDs or ULIDs as their IdempotencyKey-s

Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
@Kubuxu Kubuxu requested a review from a team as a code owner November 24, 2025 17:12
@Kubuxu Kubuxu linked an issue Nov 24, 2025 that may be closed by this pull request
@Kubuxu
Copy link
Collaborator Author

Kubuxu commented Nov 24, 2025

I still need to test it on my curio but should be good for review.

Replace manual validation with custom IdempotencyKey type that validates
during JSON parsing using pre-compiled regex for better performance.

Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
@Kubuxu Kubuxu requested a review from rvagg November 25, 2025 14:57
Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
@rvagg
Copy link
Member

rvagg commented Dec 1, 2025

@Kubuxu can you walk me through an example of how this will be used and will be useful? Are you imagining the bad-network case where an app can re-push the same thing? But who holds on to the idempotency key such that retries would use the same key? Or are you imagining that being something that the SDK could generate and it be stable across some set of similar-enough calls? Cause right now, each call to create or add ends up making a unique nonce deep inside the SDK, so the client doesn't have the opportunity to do an identical retry.

@Kubuxu
Copy link
Collaborator Author

Kubuxu commented Dec 1, 2025

Yeah, I was going to create a more expansive issue for this.
I'm mainly targeting the "bad network" case. We tried sending a request, but didn't get a response back for some reason. It will allow us to retry the same request without triggering side effects if the first request was received, but we failed to receive a response.
The key is generated on the client side and reused if the request is equivalent to one that has already been sent.
It can be "the request didn't go through due to network issues" or "application crashed between the steps of sending the request and saving the transaction hash" (if we were going for very strict transactionality on the client side).

This should be an implementation detail ideally not exposed to the end user. In my initial stab at this, I was considering using the extra data payload as the key, but this is less constraining. @hugomrdias might have more ideas on how to utilise it effectively within Synapse, as this is something we discussed back when we met.

@rvagg rvagg added the team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10 label Dec 3, 2025
@FilOzzy FilOzzy added this to FS Dec 3, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FS Dec 3, 2025
@hugomrdias
Copy link

yep mostly what kuba said, resume from crashes.

@BigLep
Copy link
Member

BigLep commented Dec 3, 2025

I think we need to back up here and do some of the "lightweight" design we discussed in Buenos Aires as we move from sprinting to march. Assuming we do this work, it at least touches Synpase, Curio, and Docs. Lets quickly plan this out accordingly and determine whether this is even in scope for GA. Issue for the lightweight design is FilOzone/synapse-sdk#479

I'm converting this to draft until we have had some of the discussion in FilOzone/synapse-sdk#479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pdpv0: Make add pieces and create and create-and-add idempotent

5 participants