Workshop 10: Contributor Workflow Practice
Goal
Practice the ICN contribution workflow by running local checks, understanding test scopes, and preparing a sample PR.
Prerequisites
- Completed Module 10 reading
- ICN repo cloned with toolchain installed
- Rust toolchain with rustfmt and clippy
Estimated time
1.5-2 hours
Part 1: Run Local Quality Checks
Steps
Navigate to the ICN workspace:
cd icnCheck formatting (should pass if no changes):
cargo fmt --all -- --checkRun clippy:
cargo clippy --workspace --all-targets -- -D warningsRun the test suite:
cargo test --workspace --lib
Expected results
- Format check: No output means success
- Clippy: Warnings/errors only if there are issues
- Tests: All tests should pass on a clean checkout
Record your findings
| Check | Result | Time |
|---|---|---|
cargo fmt --check |
Pass/Fail | ___ sec |
cargo clippy |
___ warnings | ___ sec |
cargo test --lib |
___ passed | ___ sec |
Checkpoint
- All local checks pass
- You understand what each check validates
Part 2: Understand Test Scopes
Steps
List available tests for icn-core:
cargo test -p icn-core --lib -- --list 2>&1 | head -30List available tests for icn-gateway:
cargo test -p icn-gateway --lib -- --list 2>&1 | head -30Identify integration tests:
ls icn/crates/*/tests/*.rs 2>/dev/null
Questions to answer
- What's the difference between
--liband--test? - Which crates have integration tests?
- How do you run tests for a specific function?
Checkpoint
- You can list tests for a specific crate
- You understand the test scope options
Part 3: Test Scope Decision Exercise
Scenario
You're making changes to the following areas. Decide which tests to run:
| Change | Minimum Test Command |
|---|---|
Bug fix in icn/crates/icn-ledger/src/ledger.rs |
? |
New endpoint in icn-gateway/src/api/ |
? |
Change to icn/crates/icn-trust/src/types.rs |
? |
Modify icn/crates/icn-core/src/supervisor/mod.rs |
? |
Hints
- Unit tests:
cargo test -p <crate> --lib - Integration tests:
cargo test -p <crate> --test <name> - Full workspace:
cargo test --workspace
Expected answers
cargo test -p icn-ledger --libcargo test -p icn-gateway(includes integration tests)cargo test -p icn-trust --libcargo test -p icn-core(full crate tests)
Checkpoint
- You can determine the right test scope for a change
Part 4: PR Checklist Review
Steps
- Read
CONTRIBUTING.md - Find the PR checklist
- List the requirements for a PR
Expected checklist items
- Tests pass locally
- Code is formatted (
cargo fmt) - Clippy passes
- Documentation updated (if needed)
- Commit messages follow convention
- PR description explains the change
Questions to answer
- What is the commit message format?
- When should you update documentation?
- What should a PR description include?
Checkpoint
- You can list PR requirements from memory
- You understand the commit message convention
Part 5: Simulate a Contribution
Exercise
Create a small documentation improvement (do not commit):
- Find a typo or unclear sentence in any doc file
- Note the file path and line number
- Write down:
- What change you would make
- Which tests you would run
- What your commit message would be
Example
File: docs/ARCHITECTURE.md:42
Change: Fix typo "coordinaton" → "coordination"
Tests: None needed (docs only)
Commit: docs: fix typo in architecture overview
Checkpoint
- You identified a potential improvement
- You determined the correct test scope (none for docs)
- You wrote a proper commit message
Part 6: Branch and Commit Conventions
Steps
- Review the branch naming conventions in
CLAUDE.mdorCONTRIBUTING.md - Practice creating a branch name for:
- A bug fix in the ledger
- A new feature for governance
- A documentation update
Expected branch names
fix/ledger-balance-calculationfeat/governance-delegationdocs/update-architecture-overview
Commit message format
<type>(<scope>): <summary>
<optional body>
Co-Authored-By: Your Name <email>
Types: feat, fix, docs, refactor, test, chore
Checkpoint
- You can create proper branch names
- You understand the commit message format
Summary
After completing this workshop you should be able to:
- Run all local quality checks
- Determine the correct test scope for changes
- Follow the PR checklist
- Use proper branch and commit conventions
Quick Reference
Common Commands
# Format check
cargo fmt --all -- --check
# Lint
cargo clippy --workspace --all-targets -- -D warnings
# All tests
cargo test --workspace
# Single crate tests
cargo test -p icn-<crate> --lib
# Run specific test
cargo test -p icn-<crate> test_function_name
PR Workflow
# Create branch
git checkout -b <type>/<short-description>
# Make changes, then:
cargo fmt --all
cargo clippy --workspace
cargo test --workspace
# Commit
git add -A
git commit -m "<type>(<scope>): <summary>"
# Push and create PR
git push -u origin <branch>
gh pr create --title "<title>" --body "<description>"
Next steps
You've completed the onboarding curriculum! Consider:
- Working on a "good first issue"
- Reviewing the capstone project in
capstone.md - Joining the community discussions