fix(r2): local bulk delete reports absent keys as successful

Aperta
#17,037 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript

Direzione di ricerca

Start by comparing the cf r2 objects bulk-delete help output with the local bulk-delete behavior described in the reproduction. The issue points to Miniflare’s packages/miniflare/src/workers/local-explorer/resources/r2.ts implementation; read the linked section and trace how missing keys are handled. Verify the mixed-key case reports one failure while deleting the existing key, and that an existing key alone still succeeds.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug feature:local-explorer package:miniflare product:r2

Summary

cf r2 objects bulk-delete --local reports an absent key in its success output and exits 0. This makes a mixed existing-and-missing deletion look fully successful in a local script, although the command help specifies a failure entry for each missing key.

Steps to reproduce

Use the CLI described under Runtime or environment. Run these commands in a new temporary directory. The created first key is disposable, and absent is never written.

cf r2 objects put first --body sample --bucket-name sample-bucket --local --persist-to state
cf r2 objects bulk-delete --body '["first","absent"]' --force --bucket-name sample-bucket --local --persist-to state
cf r2 objects list --bucket-name sample-bucket --local --persist-to state

Expected behavior

The operation deletes first and reports a partial failure with one error entry, as described by CLI help. If the simulator deliberately supports an idempotent operation instead, local mode states that missing keys will be reported as successful before callers rely on the result.

Actual behavior

Both CLI builds exited 0. Stdout was [{"key":"first"},{"key":"absent"}] with no missing-key report. Listing after deletion confirmed first had been removed.

Runtime or environment

  • macOS 27.2 arm64, Node.js 26.13.1, npm 12.2.2.
  • Published cf 1.0.0-rc.1 and the current main CI package, both with bundled Miniflare 5.20261117.0-beta. The CLI README at that revision includes array-body bulk deletion among supported local operations.
  • A direct Local Explorer request on Miniflare 5.20261118.0-beta returned status 200 with success: true and both keys while removing first.

Evidence

  • Expected source: cf r2 objects bulk-delete --help describes success: false, result: null and one error entry for each failed key, including a missing key.
  • Failure source: The mixed-key request above exits 0 and lists both keys without an error. The Local Explorer bulk-delete implementation acknowledges the supplied keys after deletion. The issue is the resulting difference from the CLI's advertised behavior.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Restoration check

Repeat the mixed-key case. first disappears from the bucket and the command surfaces one failure for the mixed-key request. If idempotent deletion is the supported local behavior, the CLI explains the local success semantics in its help and runtime output. A bulk delete containing only an existing key still succeeds.

References

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: Local tests can report a clean cleanup pass for a key that never existed and conceal how their script handles the documented partial-failure response.
  • Workaround status: unverified
  • Workaround basis: No local cf bulk-delete option was found that reports missing keys distinctly.
Lingua principale
TypeScript
Stelle
4.7k
Fork
1.7k
Merge medio
1g 22h
PR unite (30g)
282

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudflare/workers-sdk

Tutte le issue di cloudflare/workers-sdk

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.