Skip to content

Conversation

shumkov
Copy link
Collaborator

@shumkov shumkov commented Sep 19, 2025

Issue being fixed or feature implemented

  • Building NPM artifacts now takes longer so we need to increase timeout
  • Due to prepack in package.json and release workflow's build command we built new SDKs twice.

What was done?

  • Increase release workflow timeout
  • Removed the prepack script from package.json
  • Build optimized wasm if CARGO_BUILD_PROFILE equals release.

How Has This Been Tested?

None

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Chores
    • Increased NPM release job timeout to 60 minutes to improve reliability for longer publishes.
    • Streamlined build process for the WASM SDK with a standardized build command and an optimized path for release builds.
    • Removed prepack hooks from SDK packages to simplify publishing workflows.

@shumkov shumkov added this to the v2.1.0 milestone Sep 19, 2025
@shumkov shumkov self-assigned this Sep 19, 2025
Copy link
Contributor

coderabbitai bot commented Sep 19, 2025

Walkthrough

The CI release timeout is increased to 60 minutes. In js-evo-sdk, the prepack script is removed. In wasm-sdk, build scripts are reorganized: a direct build script replaces build:dev, prepack is removed, and build.sh now delegates release builds to build-optimized.sh while preserving the non-release path.

Changes

Cohort / File(s) Summary
CI/CD Release Workflow
.github/workflows/release.yml
Increase NPM publish job timeout from 30m to 60m; no other workflow changes.
JS SDK Scripts Cleanup
packages/js-evo-sdk/package.json
Remove "prepack" script; no other script or API changes.
WASM SDK Scripts Rework
packages/wasm-sdk/package.json
Replace "build:dev" with "build" that runs ./scripts/build.sh && node ./scripts/bundle.cjs; remove "prepack"; keep "build:release" and others.
WASM Build Flow Split
packages/wasm-sdk/scripts/build.sh
Add early exit for release: if CARGO_BUILD_PROFILE=release, exec build-optimized.sh; otherwise retain existing OPT_LEVEL logic and call build-wasm.sh.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev/CI
    participant NPM Script as npm run build (wasm-sdk)
    participant build.sh
    participant build-optimized.sh
    participant build-wasm.sh
    participant Bundler as bundle.cjs

    Dev/CI->>NPM Script: npm run build
    NPM Script->>build.sh: ./scripts/build.sh
    alt CARGO_BUILD_PROFILE=release
        build.sh-->>build-optimized.sh: exec (replace process)
        build-optimized.sh->>build-optimized.sh: Perform optimized release build
    else non-release
        build.sh->>build.sh: Determine OPT_LEVEL
        build.sh->>build-wasm.sh: Invoke standard build
        build-wasm.sh-->>build.sh: Done
    end
    NPM Script->>Bundler: node ./scripts/bundle.cjs
    Bundler-->>Dev/CI: Build artifacts bundled
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • QuantumExplorer
  • lklimek

Poem

A bunny taps the build drum, thump-thump—
Release hops faster with a longer jump.
Prepack burrows gone, scripts neatly pruned,
WASM paths split: swift in release, well-tuned.
Carrot-shaped bytes bundle with glee—
Ship it, and let the hare run free! 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "build: fix sdk npm packaging" is concise and accurately reflects the primary work in this changeset, which targets build and packaging behavior for the SDKs. The raw_summary shows removal of prepack hooks from js-evo-sdk and wasm-sdk package.json, replacement and redirection of wasm-sdk build scripts (including a release-specific early-exit), plus a CI release job timeout tweak — all packaging/build-related changes. Therefore the title is directly related to and representative of the changeset.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch build/sdk-packaging

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

✅ gRPC Query Coverage Report

================================================================================
gRPC Query Coverage Report - NEW QUERIES ONLY
================================================================================

Total queries in proto: 47
Previously known queries: 47
New queries found: 0


================================================================================
Summary:
--------------------------------------------------------------------------------
No new queries found

Total known queries: 47
  - Implemented: 44
  - Not implemented: 2
  - Excluded: 1

Not implemented queries:
  - getConsensusParams
  - getTokenPreProgrammedDistributions

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release.yml (1)

36-47: Critical: publish may run without built artifacts after removing prepack.

When check-artifact.outputs.exists == 'true', all build/setup steps are skipped, but the publish step still runs. With prepack hooks removed in SDK packages, this risks publishing packages without dist/. Fix by downloading the existing build artifact before publish or by always building.

Apply this diff to download the artifact when it exists (before publishing):

       - name: Configure NPM auth token
         run: yarn config set npmAuthToken ${{ secrets.NPM_TOKEN }}

+      - name: Download JS build artifacts (reuse)
+        if: ${{ steps.check-artifact.outputs.exists == 'true' }}
+        uses: actions/download-artifact@v4
+        with:
+          name: js-build-${{ github.sha }}
+          path: .
+
+      - name: Verify package builds exist
+        run: |
+          missing=0
+          for pkg in packages/*/package.json; do
+            if jq -e '.private|not' "$pkg" >/dev/null; then
+              dir="$(dirname "$pkg")/dist"
+              [ -d "$dir" ] || { echo "Missing: $dir"; missing=1; }
+            fi
+          done
+          [ "$missing" -eq 0 ] || { echo "One or more dist/ folders are missing"; exit 1; }
+
       - name: Publish NPM packages
         run: yarn workspaces foreach --all --no-private --parallel npm publish --tolerate-republish --access public --tag ${{ steps.tag.outputs.result }}

Also applies to: 86-92, 126-128

🧹 Nitpick comments (3)
packages/js-evo-sdk/package.json (1)

32-32: Prepack removal: confirm publish safety or add prepublishOnly.

Since CI can skip builds when reusing artifacts, ensure dist/ is present before publish. If you want belt-and-suspenders, add:

   "scripts": {
     "build": "rm -rf dist && tsc -p tsconfig.json && webpack --config webpack.config.cjs",
+    "prepublishOnly": "yarn build",
packages/wasm-sdk/scripts/build.sh (2)

13-17: Release fast‑path is clean and explicit.

Early exec to optimized build is good. Consider emitting a short log for traceability:

 if [ "${CARGO_BUILD_PROFILE:-}" = "release" ]; then
-    # exec replaces the current shell process; the script will not continue after this.
+    echo "[wasm-sdk] Using optimized release build"
     exec "$SCRIPT_DIR/build-optimized.sh"
 fi

21-23: OPT_LEVEL heuristic comment vs. behavior.

The code sets minimal when not CI or when profile is dev. That matches local dev expectations; just ensure the comment reflects “minimal for dev/local (CI=false)”. No action needed if intentional.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac0e18f and 02155f3.

📒 Files selected for processing (4)
  • .github/workflows/release.yml (1 hunks)
  • packages/js-evo-sdk/package.json (1 hunks)
  • packages/wasm-sdk/package.json (1 hunks)
  • packages/wasm-sdk/scripts/build.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
packages/wasm-sdk/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep WASM SDK docs in sync (run generate_docs.py) when updating the WASM SDK

Files:

  • packages/wasm-sdk/package.json
  • packages/wasm-sdk/scripts/build.sh
🧠 Learnings (3)
📚 Learning: 2025-09-03T14:42:29.958Z
Learnt from: thephez
PR: dashpay/platform#2754
File: packages/wasm-sdk/docs.html:1970-1971
Timestamp: 2025-09-03T14:42:29.958Z
Learning: In packages/wasm-sdk/, the docs.html file is auto-generated from api-definitions.json. Any documentation fixes should be made in api-definitions.json rather than directly in docs.html, as manual changes to docs.html would be overwritten during regeneration.

Applied to files:

  • packages/wasm-sdk/package.json
📚 Learning: 2025-09-07T22:18:50.883Z
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-07T22:18:50.883Z
Learning: Applies to packages/wasm-sdk/** : Keep WASM SDK docs in sync (run generate_docs.py) when updating the WASM SDK

Applied to files:

  • packages/wasm-sdk/package.json
📚 Learning: 2025-09-03T14:41:16.196Z
Learnt from: thephez
PR: dashpay/platform#2754
File: packages/wasm-sdk/AI_REFERENCE.md:766-766
Timestamp: 2025-09-03T14:41:16.196Z
Learning: In packages/wasm-sdk/, the AI_REFERENCE.md file is auto-generated from api-definitions.json. Any documentation fixes should be made in api-definitions.json rather than directly in AI_REFERENCE.md, as manual changes to AI_REFERENCE.md would be overwritten during regeneration.

Applied to files:

  • packages/wasm-sdk/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build JS packages / Build JS
🔇 Additional comments (2)
.github/workflows/release.yml (1)

25-25: Timeout bump looks good.

Extending to 60 minutes is reasonable for heavier Rust/WASM builds.

packages/wasm-sdk/package.json (1)

27-27: Direct build script LGTM; aligns with release profile path.

yarn build now routes through scripts/build.sh then bundles. Works with CARGO_BUILD_PROFILE=release in the workflow. Please confirm no public API/doc changes; if any, regenerate WASM SDK docs (generate_docs.py) per repo guidelines.

@shumkov shumkov merged commit 8a4dcb7 into v2.1-dev Sep 19, 2025
28 checks passed
@shumkov shumkov deleted the build/sdk-packaging branch September 19, 2025 09:11
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.

2 participants