contracts-wizard icon indicating copy to clipboard operation
contracts-wizard copied to clipboard

[Stellar] download rust package gitignore

Open CoveMB opened this issue 3 months ago • 1 comments

Fixes #710

Summary

Add .gitignore to generated Rust contract zip files for Stellar contracts and update related tests.

Description

This merge request ensures that a .gitignore file is included in the Rust contract environment zip generated by the Stellar contract packaging logic. The .gitignore file excludes the target/ directory, aligning with standard Rust project practices. All relevant test utilities and snapshot files have been updated to expect and verify the presence of .gitignore in the zip output.

Motivation / Context

Including .gitignore in generated Rust contract environments prevents unnecessary build artifacts from being tracked in version control. This change improves developer experience and aligns with best practices for Rust projects. No related issue is referenced.

Changes

  • [x] Added .gitignore file to Rust contract zip output in zip-rust.ts.
  • [x] Updated test utility compile-test.ts to expect .gitignore in zip contents.
  • [x] Updated test zip-scaffold.compile.test.ts to expect .gitignore.
  • [x] Updated test snapshot files to reflect new zip contents.

Affected functions

  • createRustZipEnvironment: Now adds .gitignore to the zip.
  • runRustCompilationTest and related test logic: Updated expected files list to include .gitignore.

Security Impact

✅ No security impact. ✅ No security-sensitive modifications.

Testing

  • [x] Updated and passed all relevant test cases and snapshots.
  • [x] Manual verification: Generate a Rust contract zip and confirm .gitignore is present.

Backward Compatibility

  • ✅ No breaking changes.
  • ✅ No migration needed.

CoveMB avatar Nov 11 '25 15:11 CoveMB

[!IMPORTANT]

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes add a .gitignore file to generated Rust projects within the Stellar package. A gitIgnore constant containing "target/" is introduced, and the .gitignore file is written to the project archives. Test expectations and snapshot outputs are updated to reflect the new file inclusion.

Changes

Cohort / File(s) Summary
Rust Zip Implementation
packages/core/stellar/src/zip-rust.ts
Introduces gitIgnore constant with "target/" content and writes .gitignore file to generated Rust project archives in both createRustZipEnvironment and zipRustProject flows
Test Expectations
packages/core/stellar/src/utils/compile-test.ts, packages/core/stellar/src/zip-scaffold.compile.test.ts
Updates expectedZipFiles arrays to include .gitignore file in expected output
Snapshot Output
packages/core/stellar/src/zip-rust.compile.test.ts.md
Adds "target/" entry to snapshot output reflecting the .gitignore file content

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Changes follow a consistent pattern across all affected files
  • Logic is straightforward—adding a static file with minimal content to generated archives
  • Test updates are predictable and homogeneous

Suggested reviewers

  • ericglau
  • ozgunozerk
  • brozorec

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding .gitignore to generated Rust packages for Stellar contracts.
Description check ✅ Passed The PR description is well-structured and directly related to the changeset, providing context, motivation, and details about .gitignore addition to Rust contract zips.
Linked Issues check ✅ Passed The PR fully addresses issue #710 by adding a .gitignore file with 'target/' to generated Rust contract zips, meeting all stated requirements.
Out of Scope Changes check ✅ Passed All changes are directly related to adding .gitignore to Rust contract zips and updating corresponding tests; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

coderabbitai[bot] avatar Nov 11 '25 15:11 coderabbitai[bot]