fix(b2): Reader.Status reports chunk progress shifted by one

Aperta
#256 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ffumero2003 ci sta già lavorando.

Dal 30/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

Context

Reader.Status().Progress reports chunk progress shifted by one position.

Reader numbers its download chunks from 0 (chunkID := r.chwid, with chwid starting at 0, b2/reader.go ~:151) and stores each in r.smap[chunkID]. But Reader.status() (b2/reader.go ~:345) loops from 1:

for i := 1; i <= len(r.smap); i++ {
    rs.Progress[i-1] = r.smap[i].done()
}

So Progress[0] shows chunk 1, chunk 0's progress never appears, and the last slot reads a key that doesn't exist. Writer.status() numbers its chunks from 1, so the same loop is correct there; the Reader's is not.

Reproduction

Read part of a three-chunk object so that chunks 0 and 1 are complete and chunk 2 is half done: Status().Progress is [1 0.5 1], expected [1 1 0.5]. Found while tightening #204's reader items (#204 lists b2/reader.go:345 as unpinned).

Expected

Progress[i] is chunk i's progress, for every chunk.

Acceptance criteria

  • R1. A test reads part of a multi-chunk object with a controlled fake and asserts the exact Progress slice. It fails before the fix.
  • R2. Reader.status() iterates the chunk IDs it actually uses (from 0).
  • R3. Changelog entry under Fixed.

In scope

  • Reader.status() chunk-to-progress indexing, its controlled multi-chunk regression test, and the requested Fixed changelog entry.

Out of scope

  • Unrelated work outside the components and behavior described in In scope.

Verification

Run the repository regression checks with live credentials unset:

unset B2_APPLICATION_KEY_ID B2_APPLICATION_KEY B2_ACCOUNT_ID B2_ACCOUNT_KEY
go build ./...
go vet ./...
go test -race -count=1 ./b2
  • Reproduce the supplied three-chunk case and assert the literal expected progress [1 1 0.5] against the incorrect [1 0.5 1] behavior.
  • Record the regression test failing before the indexing fix and passing afterward; verify the Fixed changelog entry.
  • Expected result: the checks above succeed and the observable outcomes in Acceptance criteria are demonstrated. If a check cannot run, report Could not run because: ...; if it starts but fails, report Could not complete because: .... A skipped check is not a pass.

Links

Lingua principale
Go
Stelle
66
Fork
18
Merge medio
1g 10h
PR unite (30g)
132

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 Backblaze/blazer

Tutte le issue di Backblaze/blazer

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.