Skip to content

test: Add multi-copy upload testing scenario with filecion-pin#103

Merged
rvagg merged 21 commits into
galargh/latest-synapse-sdk-localnetfrom
galargh/pin
May 7, 2026
Merged

test: Add multi-copy upload testing scenario with filecion-pin#103
rvagg merged 21 commits into
galargh/latest-synapse-sdk-localnetfrom
galargh/pin

Conversation

@galargh
Copy link
Copy Markdown
Contributor

@galargh galargh commented Apr 12, 2026

Resolves #94

Description

Adds test_multi_copy_upload to the scenario suite. The test exercises filecoin-pin against the devnet by uploading a deterministic 20 MiB random file, requiring multiple retrieval URLs, downloading each retrieval URL, and verifying each downloaded file against the expected root CID.

This PR is based on galargh/latest-synapse-sdk-localnet from PR #107, which moves the devnet to the newer Synapse-compatible localnet setup.

Current Test Flow

  1. Creates a temporary npm project.
  2. Installs:
    • filecoin-pin=0.20.1
    • multiformats=13.4.2
  3. Patches the temporary installed @filoz/synapse-core package to remove Content-Length from the streaming upload request headers in dist/src/sp/upload-streaming.js.
    • This is still needed because filecoin-pin=0.20.1 resolves to @filoz/synapse-core=0.4.1, and that published package still sends Content-Length on the transformed streaming body.
    • Without this patch, CI fails with StorageContext store failed: Failed to store piece on service provider - Network request failed.
  4. Creates a deterministic 20 MiB random file.
  5. Runs a single default multi-copy upload:
    • filecoin-pin add --network devnet <upload_dir>
  6. Strips ANSI escape codes from filecoin-pin output before parsing.
  7. Parses:
    • root CID,
    • piece CID,
    • retrieval URLs.
  8. Requires:
    • exactly one root CID in the output,
    • a piece CID,
    • at least two retrieval URLs.
  9. Converts piece retrieval URLs into root IPFS retrieval URLs.
  10. Downloads each retrieval URL with ?format=raw.
  11. Verifies each downloaded file by running inline Node from the temp npm project and comparing the file SHA-256 digest against the root CID multihash.

Other Changes

  • Adds the scenario to scenarios/run.py.
  • Restores the test_storage_e2e timeout to 200s.
  • Removes the pull_request.branches: ['main'] workflow filter so PR CI can run against the non-main PR feat: support latest synapse #107 base.

Validation

Local:

python3 -m py_compile scenarios/run.py scenarios/test_multi_copy_upload.py
FIX=0 ./scripts/lint.sh

CI:

@FilOzzy FilOzzy added this to FOC Apr 12, 2026
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Apr 12, 2026
@BigLep BigLep moved this from 📌 Triage to ⌨️ In Progress in FOC Apr 12, 2026
@BigLep BigLep added this to the M4.2: mainnet GA milestone Apr 12, 2026
@galargh galargh changed the base branch from main to galargh/last-known-good-ref May 3, 2026 10:15
@galargh galargh closed this May 3, 2026
@github-project-automation github-project-automation Bot moved this from ⌨️ In Progress to 🎉 Done in FOC May 3, 2026
@galargh galargh reopened this May 3, 2026
@github-project-automation github-project-automation Bot moved this from 🎉 Done to ⌨️ In Progress in FOC May 3, 2026
@galargh galargh changed the title [WIP] test: filecoin-pin in CI as a testing scenario for multi-copy upload test: filecoin-pin in CI as a testing scenario for multi-copy upload May 4, 2026
@galargh galargh changed the base branch from galargh/last-known-good-ref to galargh/latest-synapse-sdk-localnet May 4, 2026 18:50
@galargh galargh closed this May 4, 2026
@github-project-automation github-project-automation Bot moved this from ⌨️ In Progress to 🎉 Done in FOC May 4, 2026
@galargh galargh reopened this May 4, 2026
@github-project-automation github-project-automation Bot moved this from 🎉 Done to ⌨️ In Progress in FOC May 4, 2026
@galargh galargh marked this pull request as ready for review May 4, 2026 22:36
return value or ""


def patch_synapse_core_streaming_upload(npm_dir: Path) -> bool:
Copy link
Copy Markdown
Contributor Author

@galargh galargh May 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch is needed because @filoz/synapse-core 0.4.1 sets Content-Length on a transformed streaming upload body. Node/Undici rejects that as invalid content-length header, and filecoin-pin surfaces it as StorageContext store failed: Failed to store piece on service provider - Network request failed.

@galargh galargh requested review from BigLep and rvagg May 4, 2026 22:38
@galargh galargh changed the title test: filecoin-pin in CI as a testing scenario for multi-copy upload test: Add multi-copy upload testing scenario with filecion-pin May 4, 2026
@BigLep BigLep moved this from ⌨️ In Progress to 🔎 Awaiting review in FOC May 5, 2026
@BigLep BigLep requested a review from Copilot May 5, 2026 02:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new end-to-end scenario test that validates multi-copy uploads against the devnet using filecoin-pin, then retrieves from multiple URLs and verifies the downloaded bytes against the expected root CID.

Changes:

  • Introduces scenarios/test_multi_copy_upload.py to run a deterministic 20 MiB upload via filecoin-pin, parse output (root CID / piece CID / retrieval URLs), download each retrieval URL, and verify content.
  • Updates scenarios/run.py to include the new scenario and adjusts the test_storage_e2e timeout.
  • Updates PR CI workflow trigger behavior by removing the pull_request.branches: ['main'] filter.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
scenarios/test_multi_copy_upload.py New multi-copy upload + retrieval verification scenario using filecoin-pin with a temporary npm project and runtime patching.
scenarios/run.py Registers the new scenario in the ordered runner and updates timeouts.
.github/workflows/ci_pull_request.yml Allows PR CI to run without restricting pull_request triggers to main.

Comment thread scenarios/test_multi_copy_upload.py Outdated
Comment thread scenarios/test_multi_copy_upload.py Outdated
Comment thread scenarios/test_multi_copy_upload.py Outdated
Comment thread scenarios/test_multi_copy_upload.py Outdated
- make synapse-core Content-Length patch idempotent and document the
  upstream bug it papers over; only fail when the target file is missing
- assert npm (test only uses npm), not pnpm
- download verified payloads into a tempdir rather than ./ipfs/
- drop dead 'if not run_cmd' early-return branches (helpers.run_cmd
  already calls sys.exit(1) on failure)
- assert URL substitution actually changed each retrieval URL before
  rewriting /piece/<piece_cid> to /ipfs/<root_cid>
Copy link
Copy Markdown
Contributor

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some changes here, Copilots and some extra ones

@github-project-automation github-project-automation Bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC May 7, 2026
@rvagg rvagg merged commit 0db4e65 into galargh/latest-synapse-sdk-localnet May 7, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC May 7, 2026
@rvagg rvagg deleted the galargh/pin branch May 7, 2026 10:50
rvagg added a commit that referenced this pull request May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

filecoin-pin in CI as a testing scenario for multi-copy upload + Synapse testing

5 participants