Skip to content

Conversation

@CoveMB
Copy link
Contributor

@CoveMB CoveMB commented Nov 11, 2025

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

  • Added .gitignore file to Rust contract zip output in zip-rust.ts.
  • Updated test utility compile-test.ts to expect .gitignore in zip contents.
  • Updated test zip-scaffold.compile.test.ts to expect .gitignore.
  • 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

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

Backward Compatibility

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

@CoveMB CoveMB requested review from a team as code owners November 11, 2025 15:16
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

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.

@CoveMB CoveMB requested a review from ericglau November 11, 2025 15:16
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 (1)
packages/core/stellar/src/zip-rust.ts (1)

42-42: LGTM! Consider additional common Rust ignores.

The .gitignore is correctly added at the workspace root. The current implementation meets the requirement from issue #710.

For enhanced developer experience, you might consider adding commonly ignored entries:

  • **/*.rs.bk (rustfmt backup files)
  • Cargo.lock (for library projects; already appropriate for binaries to track it)
  • .DS_Store / Thumbs.db (OS artifacts)
  • .vscode/ / .idea/ (IDE artifacts)

If you'd like to enhance the gitignore, here's an example:

 const gitIgnore = `\
 target/
+**/*.rs.bk
+.DS_Store
 `;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce8fbba and a4dae2e.

⛔ Files ignored due to path filters (1)
  • packages/core/stellar/src/zip-rust.compile.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • packages/core/stellar/src/utils/compile-test.ts (1 hunks)
  • packages/core/stellar/src/zip-rust.compile.test.ts.md (1 hunks)
  • packages/core/stellar/src/zip-rust.ts (2 hunks)
  • packages/core/stellar/src/zip-scaffold.compile.test.ts (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). (2)
  • GitHub Check: build (solidity, default)
  • GitHub Check: build (stellar, compile)
🔇 Additional comments (4)
packages/core/stellar/src/zip-rust.compile.test.ts.md (1)

141-142: LGTM! Snapshot correctly updated.

The snapshot properly reflects the new .gitignore file content with target/ exclusion.

packages/core/stellar/src/utils/compile-test.ts (1)

59-59: LGTM! Test expectations correctly updated.

The addition of .gitignore to the expected files list properly reflects the new zip structure.

packages/core/stellar/src/zip-rust.ts (1)

28-30: Clean implementation of gitignore constant.

The .gitignore content correctly excludes the target/ directory and includes a trailing newline, following standard text file conventions.

packages/core/stellar/src/zip-scaffold.compile.test.ts (1)

30-30: No action required—.gitignore is correctly included in the scaffold.

The implementation already writes .gitignore to the archive. The zipScaffoldProject function chains to createRustZipEnvironment, which adds the .gitignore file at line 42 of zip-rust.ts.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add .gitignore by default to the generated project folder

2 participants