Skip to content

fix(cascade): sn-api path handling, task polling, and total_size JSON type#7

Closed
mateeullahmalik wants to merge 1 commit intomasterfrom
fix/cascade-snapi-url-status-total-size
Closed

fix(cascade): sn-api path handling, task polling, and total_size JSON type#7
mateeullahmalik wants to merge 1 commit intomasterfrom
fix/cascade-snapi-url-status-total-size

Conversation

@mateeullahmalik
Copy link
Contributor

Summary

This PR fixes JS SDK cascade upload/download integration issues discovered in LEP-5 E2E runs against sn-api-server.

Fixes included

  1. availability_commitment.total_size JSON type

    • Emit numeric JSON value instead of string
    • Safely convert bigint with guard against Number.MAX_SAFE_INTEGER
  2. sn-api URL path handling with base path prefixes

    • Preserve base path when baseUrl contains a prefix (e.g. /proxy/snapi)
    • Prevent absolute request paths (/api/v1/...) from dropping the prefix and causing 404s
  3. Task status polling compatibility

    • Use task history endpoint for polling (latest event) instead of relying on SSE status endpoint for polling
    • Keep fallback behavior for compatibility

Why

In browser/devnet E2E, the SDK could register the action ticket on-chain but failed to continue due to:

  • wrong metadata JSON value type
  • URL joining that stripped proxy path
  • brittle polling behavior against SSE status stream

Validation

Validated in devnet E2E workflow:

  • Register action via JS SDK ✅
  • Start cascade upload via sn-api-server ✅
  • Upload completes (sdk:completed) ✅
  • Download via sn-api-server ✅
  • Source/download file hash match ✅

@mateeullahmalik mateeullahmalik force-pushed the fix/cascade-snapi-url-status-total-size branch from f8baa5d to 98c95d4 Compare March 12, 2026 10:27
- Fix availability_commitment.total_size serialization: emit JSON number with safe bigint guard\n- Preserve baseUrl path prefixes (e.g. /proxy/snapi) when building request URLs\n- Poll task history for status instead of SSE /status endpoint, with compatibility fallback
@roomote-v0
Copy link

roomote-v0 bot commented Mar 12, 2026

Rooviewer Clock   Follow task

Reviewing your PR now. I'll share feedback in a few minutes!

@mateeullahmalik
Copy link
Contributor Author

Superseded by #6. The same fixes were moved to branch feat/lep5-availability-commitment so LEP-5 work stays consolidated in one PR.

@roomote-v0
Copy link

roomote-v0 bot commented Mar 12, 2026

Rooviewer Clock   Follow task

Reviewing your PR now. Comments will be posted shortly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant