fix(cli): emit failure JSON when public DataMap store fails#107
Merged
Conversation
`ant --json file upload --public` printed no JSON at all when the file body uploaded fine but the trailing public DataMap chunk failed to store: the UploadFailureJson emission only covered the PartialUpload arm of the body upload, and the DataMap path bailed straight out via `?`. Harnesses parsing stdout (e.g. the prod uploader service) saw exit!=0 with empty stdout and recorded 0/0 chunks — hiding that the body chunks were stored and paid for, and that the upload is one small chunk away from being retrievable (observed on PROD-UL-01, 2026-06-04: 500/500 body chunks stored, DataMap PUT rejected, reported as 0/0). Emit an UploadFailureJson (error: "datamap_store_failed", with the real chunks_stored / total_chunks and the DataMap error as reason) before bailing, matching the PartialUpload arm. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dirvine
approved these changes
Jun 5, 2026
dirvine
left a comment
There was a problem hiding this comment.
Reviewed the diff locally. This is a small, targeted fix and the JSON failure path now mirrors the existing partial-upload reporting contract for the DataMap-only failure case. Counts look correct: body chunks remain counted as stored and the public DataMap is reported as the single failed chunk.\n\nLocal verification passed:\n- cargo check -p ant-cli\n- cargo clippy -p ant-cli --all-targets -- -D warnings\n- cargo test -p ant-cli\n\nCI is partly still pending, so wait for the remaining build/E2E/Merkle jobs before merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ant --json file upload --publicprints no JSON at all when the file body uploads successfully but the trailing public DataMap chunk fails to store. TheUploadFailureJsonemission only covers theDataError::PartialUploadarm of the body upload; the DataMap path bails straight out via?(handle_file_upload, file.rs).Harnesses that parse stdout (e.g. the prod uploader service) see exit≠0 with empty stdout and record 0/0 chunks. Observed on PROD-UL-01 (2026-06-04): 500/500 body chunks stored and paid for, DataMap PUT rejected by 4/7 close-group nodes (see WithAutonomi/ant-node#127), reported as:
That hides that the body chunks are on the network and paid for — the upload is one 324-byte chunk away from being retrievable, and a DataMap-only retry would be far cheaper than a full re-upload.
Fix
Emit an
UploadFailureJsonbefore bailing, matching thePartialUploadarm:{"error":"datamap_store_failed","total_chunks":501,"chunks_stored":500,"chunks_failed":1,"reason":"failed to store public DataMap: ..."}Existing consumers need no changes — e.g. the prod uploader's classifier already keys off the
errorfield and readschunks_stored/reasonfrom the same object.cargo check -p ant-cliand clippy clean.Companion PR (root cause of the DataMap rejection itself): WithAutonomi/ant-node#127.
🤖 Generated with Claude Code