Skip to content

Add cargo-watch hot reload for contract tests (cargo watch -x test) #354

Description

@vjuliaife

Description:
Rust contract developers currently must manually re-run cargo test after every code change, which interrupts flow and slows the red-green-refactor cycle. Adding cargo-watch support with a documented invocation (cargo watch -x test) provides instant feedback on file changes, keeping developers in their editor rather than their terminal. A convenience npm/Make target should wrap this so the command is easy to discover.

Acceptance Criteria:

  • cargo-watch added as a dev-dependency in the Rust workspace Cargo.toml or documented as a required global install with an exact version pin
  • A watch:contracts script added to the root package.json that runs cargo watch -x test from the contracts crate directory
  • make watch-contracts target added to the Makefile (depends on issue Add Makefile with targets: dev, test, build, contract-deploy, db-migrate, db-reset, clean #352) that invokes the same command
  • The watch command uses -w src/ to scope watching to source files only, ignoring target/ churn
  • A .cargo/config.toml (or existing config) sets reasonable CARGO_INCREMENTAL=1 and parallel job limits for fast recompilation
  • Documentation in the Rust crate README or CONTRIBUTING.md covers the hot-reload workflow and any platform-specific notes (e.g., inotify limits on Linux)
  • CI does NOT use cargo watch — only the standard cargo test — ensuring no watch process blocks CI pipelines

Relevant Files:

  • Cargo.toml — add cargo-watch dev dependency or document install requirement
  • .cargo/config.toml — new or existing file for incremental build config
  • package.json — add "watch:contracts" script
  • Makefile — add watch-contracts target

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programdxDeveloper experience / docs / naminginfrastructureDocker / CI / deploy

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions