Skip to content

Conversation

@ericglau
Copy link
Member

@ericglau ericglau commented Aug 26, 2025

Fixes #647

Summary by Sourcery

Bug Fixes:

  • Export zip-rust module in the Stellar core package to restore the download Rust package function

@ericglau ericglau requested review from a team as code owners August 26, 2025 17:50
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Walkthrough

Adds a CommonJS proxy module at packages/core/stellar/zip-env-rust.js that re-exports ./dist/zip-rust via module.exports.

Changes

Cohort / File(s) Summary
Stellar Rust ZIP proxy
packages/core/stellar/zip-env-rust.js
New file exporting require('./dist/zip-rust') to expose the built artifact under a stable entry point.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix bare specifier resolution for @openzeppelin/wizard-stellar/zip-env-rust to enable Rust Dev Package download (#647)

Assessment against linked issues: Out-of-scope changes

None found.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 26, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Introduces a new entry point for the Stellar package’s Rust zip utility by adding an alias file that re-exports the built module.

Class diagram for new zip-env-rust module entry point

classDiagram
    class zip_env_rust {
        +exports zip_rust
    }
    class zip_rust {
        <<module>>
    }
    zip_env_rust --> zip_rust : re-exports
Loading

File-Level Changes

Change Details Files
Added alias to expose the built Rust zip function
  • Created zip-env-rust.js that re-exports from dist/zip-rust
packages/core/stellar/zip-env-rust.js

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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

🧹 Nitpick comments (2)
packages/core/stellar/zip-env-rust.js (2)

1-1: Be explicit with the file extension to avoid resolver edge cases.

Some resolvers and CDNs behave better with explicit extensions.

-module.exports = require('./dist/zip-rust');
+module.exports = require('./dist/zip-rust.js');

1-1: Export map and types: expose a subpath export and d.ts for TS consumers.

To make @openzeppelin/wizard-stellar/stellar/zip-env-rust a stable subpath for both Node and CDNs, add an exports entry and wire types to the built d.ts. Example for packages/core/package.json:

 {
   "name": "@openzeppelin/wizard-stellar",
+  "exports": {
+    ".": {
+      "types": "./dist/index.d.ts",
+      "import": "./dist/index.js",
+      "require": "./dist/index.cjs"
+    },
+    "./stellar/zip-env-rust": {
+      "types": "./dist/zip-rust.d.ts",
+      "import": "./dist/zip-rust.js",
+      "require": "./stellar/zip-env-rust.js"
+    }
+  },
+  "files": [
+    "dist/**",
+    "stellar/**"
+  ]
 }

Also consider adding a tiny type shim so editors resolve correctly (if not already emitted in dist):

// packages/core/stellar/zip-env-rust.d.ts
export * from '../dist/zip-rust';
export { default } from '../dist/zip-rust';
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5e61130 and 4fe53ed.

📒 Files selected for processing (1)
  • packages/core/stellar/zip-env-rust.js (1 hunks)
⏰ 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). (3)
  • GitHub Check: build (solidity, default)
  • GitHub Check: build (stellar, compile)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
packages/core/stellar/zip-env-rust.js (3)

1-1: Targeted proxy looks good and should unblock the bare-specifier import.

Creating a thin proxy to ./dist/zip-rust is a pragmatic fix to make @openzeppelin/wizard-stellar/zip-env-rust resolvable by consumers. This aligns with the PR objective to fix the download error from the Wizard UI.


1-1: No changes needed for zip-env-rust.js

The packages/core/stellar/package.json has no "type" field (defaults to CommonJS), and there are no other zip-env-* stubs to align with, so module.exports = require('./dist/zip-rust'); is correct as-is.


1-1: Update publish-time verification script to correctly inspect the packed tarball

The current script redirects npm pack’s stdout (the filename) into /tmp/pkg.tgz, so you end up with a text file rather than the actual tarball. Instead, let npm pack create the .tgz in the package directory, capture its filename, then inspect that file.

Please replace your verification snippet with the following:

- # From repo root, pack just the core package and inspect contents
- pkg_dir="packages/core"
- ( cd "$pkg_dir" && npm pack --silent >/tmp/pkg.tgz )
- tar -tf /tmp/pkg.tgz | rg -nP 'stellar/zip-env-rust\.(js|cjs|d\.ts)$|dist/zip-rust\.(js|d\.ts)$' -n
+ # From repo root, pack just the core package and inspect contents
+ pkg_dir="packages/core"
+ (
+   cd "$pkg_dir"
+   # npm pack writes the .tgz filename to stdout
+   tarball=$(npm pack --silent)
+   # List the contents of the real tarball
+   tar -tf "$tarball" \
+     | rg -nP '^(stellar/zip-env-rust\.(js|cjs|d\.ts)|dist/zip-rust\.(js|d\.ts))$' -n
+ )

Then confirm you see at least:

  • stellar/zip-env-rust.js (or .cjs)
  • dist/zip-rust.js

in the output. This ensures the file is published in the npm tarball and resolvable by the subpath consumers use.

@ericglau ericglau enabled auto-merge (squash) August 26, 2025 18:00
@ericglau ericglau merged commit 854f44d into OpenZeppelin:master Aug 26, 2025
18 of 19 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stellar contracts: download of Rust Development Package no longer works?

3 participants