Repository navigation
fix(node): fail pin_git_object when the add response carries no Hash - #453
Closed
beardthelion wants to merge 3 commits into
Closed
beardthelion wants to merge 3 commits into
beardthelion wants to merge 3 commits into
Conversation
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.
Summary
A 200 from
/api/v0/addwith no parseableHashno longer counts as a successful pin. The old fallback returned the locally computed raw CID, an address the backend never confirmed stored; above the chunk threshold that CID is not even a stored block, so every latercaton it failed permanently.Motivation & context
pin_git_objecttook the last NDJSON line carrying aHashand fell back toCid::from_git_object_bytes(data)when none did. The add goes out withraw-leaves=true, so on Kubo a payload over 262144 bytes lands chunked under a dag-pb root and the whole-object raw CID is never a stored block. The fabricated CID landed inencrypted_blobs.cid, soget_encrypted_blobfailed on every fetch of an affected envelope and mirrors retried it on each sync.Closes #452
Kind of change
What changed
pin_git_object(gitlawb-node) errors on a 200 add response without a usableHash, carrying a truncated body excerpt. The returnedHashstays authoritative and is not compared against the locally computed raw CID, since above-threshold adds legitimately return the dag-pb root.delaying_endpointtest fixture now returns a conformant NDJSON add response. It had been relying on the fallback by answering 200 with an empty body, so six budget/timing tests were unknowingly passing through the bug.pin_git_object_rejects_a_200_without_a_hash.How a reviewer can verify
DATABASE_URL=postgresql://gitlawb:changeme@localhost:5432/gitlawb \ cargo test -p gitlawb-node --bin gitlawb-node ipfs_pinThe new test fails on main:
pin_git_objectreturnsOk(<fabricated CID>)for a 200 carrying{"Name":"object","Size":"19"}. Against live Kubo v0.43.0, a 262145-byte add returns the dag-pb root asHashwhile the whole-object raw CID 500s oncat, which is the failure mode the fallback hid.Before you request review
cargo test -p gitlawb-nodepasses locally (the workspace suite runs in CI via pr-checks.yml)cargo fmt --allandcargo clippy --workspace --all-targets -- -D warningsare cleanfeat(...),fix(...),docs(...)).env.exampleupdated if behavior or config changed (or N/A)Notes for reviewers
Open PRs touching
ipfs_pin.rs(#382, #407, #408) all modify the pin-set selection and read-bounding paths, not the add-response parser, so no semantic overlap. If #452's direction is wrong and a Hash-less 200 is meant to be a supported shape, this should instead pin down what the parser is allowed to accept.Summary by CodeRabbit