Problem
der reindex collected a per-object decode error (---: malformed value on the konfig) into its objects with errors: block but then proceeded to write the index (16 pages), recompile konfig, and exit as if successful. The error was easy to miss amid the success log lines, and the exit status did not reflect the failure.
reindex.go (internal/oscar/store/reindex.go) collects errors into the objectsWithErrors map and prints them, but Reindex returns err, which by that point is nil (the per-object errors were stored in the map, not propagated). So the command surfaces errors only as printed text, not as a non-zero exit, and continues to rewrite the index.
Latent printing bug
In the error-printing loop (reindex.go ~line 100):
for _, objectWithError := range objectsWithErrors {
ui.CLIErrorTreeEncoder.EncodeTo(err, store.envRepo.GetUI()) // <-- outer `err` (nil), not objectWithError.error
It encodes the outer err (nil at that point) instead of objectWithError.error. This is why the reindex output contains the literal line error was nil!.
Desired
- reindex returns non-zero / surfaces a clear aggregate failure when any object errored.
- the error-printing loop encodes
objectWithError.error, not the outer nil err.
Verify
BATS: reindex over a store with a known-bad object asserts non-zero exit and that the specific object error is printed (not error was nil!).
:clown: filed by Clown (0.4.0+cd38c2d) — built from cd38c2d
Problem
der reindexcollected a per-object decode error (---: malformed valueon the konfig) into itsobjects with errors:block but then proceeded to write the index (16 pages), recompile konfig, and exit as if successful. The error was easy to miss amid the success log lines, and the exit status did not reflect the failure.reindex.go(internal/oscar/store/reindex.go) collects errors into theobjectsWithErrorsmap and prints them, butReindexreturnserr, which by that point is nil (the per-object errors were stored in the map, not propagated). So the command surfaces errors only as printed text, not as a non-zero exit, and continues to rewrite the index.Latent printing bug
In the error-printing loop (
reindex.go~line 100):It encodes the outer
err(nil at that point) instead ofobjectWithError.error. This is why the reindex output contains the literal lineerror was nil!.Desired
objectWithError.error, not the outer nilerr.Verify
BATS: reindex over a store with a known-bad object asserts non-zero exit and that the specific object error is printed (not
error was nil!).:clown: filed by Clown (0.4.0+cd38c2d) — built from cd38c2d