Add AbortSignal cancellation support to IPFSStorage.upload and resolve
I maintainer di solito rispondono entro 1 giorno
@Oothecae ci sta già lavorando.
Dal 16/10/2026.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 72/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend
Direzione di ricerca
Start in src/storage/ipfs.ts, where upload calls this.http.post and resolve loops over gateways with axios.get, then check how createApiHttpClient in src/utils/http.ts builds its config and how fetchWithTimeout in src/utils/timeout.ts already uses AbortSignal. Add an optional signal to both option interfaces and pass it into each request. Done means an already-aborted signal makes no network call, aborting mid-resolve skips the remaining gateways, and tests cover both cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
IPFSStorage.upload and IPFSStorage.resolve (src/storage/ipfs.ts) have no way for a caller to cancel an in-flight request. Checked on main:
upload(file, options)posts throughthis.http.post('', body, { headers: ... })(createApiHttpClientfromsrc/utils/http.ts) — nosignalis ever read fromoptionsor forwarded into the axios request config.resolve(cid, options)callsaxios.get(url, { timeout, responseType: 'text', transformResponse: [...], validateStatus: ... })per gateway in its fallback loop — again nosignal.IPFSUploadOptionsandIPFSResolveOptions(the two option interfaces) have nosignal/abortSignalfield at all.
The SDK already uses AbortController/AbortSignal elsewhere (src/utils/timeout.ts's fetchWithTimeout, and the connection-pool work in src/utils/connection-pool.ts/src/node/agents.ts), so the pattern is established, but it was never threaded through to the storage module. In practice this means a consumer uploading a large file to IPFS, or resolving dispute-evidence JSON from a slow/unresponsive gateway, cannot cancel the call from a React component unmount, a user-initiated "cancel upload" action, or a request-level timeout budget shared with other work — the call can only ever finish or hit its own internal timeoutMs.
Component
SDK (src/storage/ipfs.ts)
Difficulty
🟡 Medium
Tasks
- Add an optional
signal?: AbortSignalfield toIPFSUploadOptionsandIPFSResolveOptions - Forward
options.signalinto the axios request config forupload'sthis.http.post(...)call - Forward
options.signal(or a derived per-gateway signal) into eachaxios.get(...)call insideresolve's gateway loop, aborting the remaining fallback attempts once the caller's signal fires - Map an aborted request to a distinct, documented outcome (
{ ok: false, error: 'Upload aborted' }forupload; aTrustFlowErrorcode forresolve) rather than letting the rawAbortError/CanceledErrorpropagate inconsistently - Add tests: aborting mid-upload resolves to the aborted result, aborting mid-resolve stops before trying the next fallback gateway
Acceptance Criteria
- Passing an already-aborted
AbortSignaltoupload/resolvefails fast without making a network call - Aborting a
resolvecall part-way through the gateway fallback loop does not try subsequent gateways - Existing non-aborted call paths are unaffected
Estimated Time
3-4 hours
- Lingua principale
- TypeScript
- Stelle
- 0
- Fork
- 73
- Merge medio
- 9h 18m
- PR unite (30g)
- 58
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di trustflow-protocol/trustflow-sdk
-
bug difficulty: easy priority: low sdk
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
trustflow-protocol/trustflow-sdk#510 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
difficulty: easy documentation priority: low sdk
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
trustflow-protocol/trustflow-sdk#509 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug difficulty: easy infrastructure priority: medium sdk security
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
trustflow-protocol/trustflow-sdk#508 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug difficulty: easy infrastructure priority: medium sdk
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
trustflow-protocol/trustflow-sdk#507 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug difficulty: easy priority: low sdk testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
trustflow-protocol/trustflow-sdk#505 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di trustflow-protocol/trustflow-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
polarsource/polar#15580 ·
I maintainer di solito rispondono entro 1 giorno
-
accepted bug via-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
pingdotgg/t3code#20931 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug/1-unconfirmed kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ranxianglei/billion-context#3583 ·
I maintainer di solito rispondono entro 1 giorno