Thank you for considering contributing to MirrorDNA! This document provides guidelines for contributing to the protocol specification and reference implementations.
- Code of Conduct
- How Can I Contribute?
- Development Setup
- Pull Request Process
- Coding Standards
- Testing Requirements
- Documentation Guidelines
- Be respectful — Treat all contributors with respect
- Be collaborative — Work together to improve the protocol
- Be constructive — Provide helpful feedback and suggestions
- Be patient — Remember that everyone is learning
- Focus on the protocol — Keep discussions technical and protocol-focused
If you find a bug in the protocol implementation:
- Check if the bug has already been reported in Issues
- If not, open a new issue with:
- Clear title describing the bug
- Steps to reproduce
- Expected behavior vs actual behavior
- Environment details (Python version, OS, etc.)
- Minimal code example demonstrating the bug
For protocol-level changes:
- Open a Discussion first
- Describe the use case and motivation
- Propose the protocol change with examples
- Gather community feedback
- If consensus is reached, create an issue and submit a PR
Note: Protocol changes require careful consideration as they affect all implementations.
Documentation improvements are always welcome:
- Fix typos or clarify confusing sections
- Add examples or use cases
- Improve code comments
- Write tutorials or guides
Help improve test coverage:
- Add tests for edge cases
- Add integration tests
- Add performance benchmarks
- Add protocol compliance tests
Check the ROADMAP.md for planned features:
- Comment on the issue to claim it
- Discuss implementation approach
- Submit a PR when ready
# Clone the repository
git clone https://github.com/MirrorDNA-Reflection-Protocol/MirrorDNA.git
cd MirrorDNA
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Run tests with coverage
pytest tests/ --cov=src/mirrordna --cov-report=html# Navigate to SDK directory
cd sdk/javascript
# Install dependencies
npm install
# Run tests
npm test
# Build
npm run build
# Type check
npm run typecheck-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Write clean, readable code
- Follow coding standards (see below)
- Add tests for new functionality
- Update documentation as needed
-
Run tests locally
pytest tests/ -v
-
Run code formatters (Python)
black src/mirrordna tests/ isort src/mirrordna tests/
-
Check type hints (Python)
mypy src/mirrordna
-
Push your branch
git push origin feature/your-feature-name
-
Open a Pull Request with:
- Clear title summarizing the change
- Description explaining:
- What changed and why
- Related issues (use "Fixes #123" to auto-close issues)
- Any breaking changes
- How to test the changes
- Screenshots/examples if applicable
-
Wait for review
- Address reviewer feedback
- Make requested changes
- Push updates to the same branch
-
Merge
- Once approved, a maintainer will merge your PR
- Your contribution will be included in the next release
- Style: Follow PEP 8
- Formatting: Use
black(line length: 88) - Imports: Use
isortfor consistent import ordering - Type hints: Use type hints for all public APIs
- Docstrings: Use Google-style docstrings
Example:
def compute_checksum(data: Dict[str, Any]) -> str:
"""
Compute SHA-256 checksum of data dictionary.
Args:
data: Dictionary to checksum using canonical JSON
Returns:
Hex-encoded SHA-256 checksum (64 characters)
Raises:
ValueError: If data contains non-serializable values
"""
canonical_json = json.dumps(data, sort_keys=True, separators=(',', ':'))
return hashlib.sha256(canonical_json.encode('utf-8')).hexdigest()- Style: Follow Airbnb JavaScript Style Guide
- Formatting: Use Prettier (configured in
sdk/javascript/.prettierrc) - Linting: Use ESLint (configured in
sdk/javascript/.eslintrc) - Type safety: Use TypeScript strict mode
Example:
/**
* Compute SHA-256 checksum of data object
*/
export function computeChecksum(data: Record<string, unknown>): string {
const canonicalJson = JSON.stringify(data, Object.keys(data).sort());
return createHash('sha256').update(canonicalJson).digest('hex');
}- Standard: Use JSON Schema Draft 7
- Patterns: Use regex patterns for ID validation
- Descriptions: Add clear descriptions for all fields
- Examples: Include examples in schema files
- Minimum coverage: 80% for new code
- Critical paths: 100% coverage for checksumming, validation
- Edge cases: Test both happy paths and error cases
def test_feature_name():
"""Test that feature does what it should."""
# Arrange
input_data = {...}
# Act
result = function_to_test(input_data)
# Assert
assert result == expected_value- ✅ Happy paths — Normal usage scenarios
- ✅ Error cases — Invalid inputs, missing files, etc.
- ✅ Edge cases — Empty data, very large data, unicode, etc.
- ✅ Round-trip — Save/load, serialize/deserialize
- ✅ Determinism — Same input produces same output
- ✅ Checksums — Verify integrity guarantees
- Document all public APIs with docstrings
- Explain why, not just what
- Include usage examples
- Document exceptions and edge cases
Located in docs/:
- Be concise — Short sections, clear explanations
- Include examples — Real, working code
- No fluff — Every sentence should add value
- Cross-reference — Link to related docs
- Keep updated — Update docs when code changes
When adding features:
- Update Quick Start if API changes
- Update Repository Structure if files added
- Update Documentation section if docs added
- Keep examples working and current
Protocol schema changes require special care:
- Adding optional fields
- Relaxing validation constraints
- Adding new enum values
Process:
- Update schema file
- Update documentation
- Add migration notes
- Bump minor version
- Removing required fields
- Changing field types
- Renaming fields
- Tightening validation
Process:
- Discuss in GitHub Discussion first
- Get community consensus
- Create migration guide
- Update all implementations
- Bump major version
Use clear, descriptive commit messages:
<type>: <short summary>
<optional body>
<optional footer>
Types:
feat:— New featurefix:— Bug fixdocs:— Documentation changestest:— Test additions or changesrefactor:— Code refactoringchore:— Maintenance tasks
Examples:
feat: Add support for encrypted state snapshots
Add new encryption parameter to capture_snapshot() that allows
encrypting snapshot data with AES-256 before saving.
Fixes #123
docs: Clarify Master Citation lineage behavior
Update master-citation.md to explain how predecessor/successor
chains work in distributed scenarios.
(For maintainers)
- Update version in
setup.py - Update
docs/CHANGELOG.md - Create git tag:
git tag -a v1.1.0 -m "Release v1.1.0" - Push tag:
git push origin v1.1.0 - Create GitHub release with changelog
- Publish to PyPI (Python) and npm (JavaScript)
- General questions: Open a Discussion
- Bug reports: Open an Issue
- Protocol proposals: Start with a Discussion
By contributing to MirrorDNA, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to MirrorDNA! 🎉