# Contributing to captchaforge
## Getting Started
```bash
git clone https://github.com/santhsecurity/captchaforge
cd captchaforge
cargo test --workspace
```
## Development Workflow
1. **Fork & branch**: `git checkout -b feature/my-feature`
2. **Write tests first**: Add property tests for new invariants, integration tests for browser behavior
3. **Implement**: Follow existing code style, keep functions under 50 lines where possible
4. **Run quality gates**:
```bash
cargo fmt
cargo clippy --workspace -- -D warnings
cargo test --workspace
cargo test --test integration -- --ignored --test-threads=1
```
5. **Update docs**: If you change public API, update `ARCHITECTURE.md` and rustdoc
6. **PR**: Fill out the PR template, reference any issues
## Code Review Checklist
- [ ] Tests added for new behavior
- [ ] Property tests added for invariants
- [ ] No `unsafe` code (forbidden by lint)
- [ ] No `unwrap()` or `expect()` in production paths without justification
- [ ] `cargo clippy -- -D warnings` passes
- [ ] `cargo fmt` passes
- [ ] Documentation updated
- [ ] CHANGELOG.md updated
## Test Tiers
| Unit | Inline in `src/` | <1s | No |
| Property | `tests/property_*.rs` | <10s | No |
| Snapshot | `tests/snapshot_*.rs` | <5s | No |
| Chaos | `tests/chaos_resilience.rs` | <5s | No |
| Integration | `tests/integration.rs` | <2min | Yes |
| Bench | `bench/src/suites/` | <20min | Yes |
## Adding a New Solver
1. Implement `CaptchaSolver` trait
2. Add builder methods for configuration
3. Add unit tests in `src/solver.rs` or `tests/property_solver.rs`
4. Add integration test in `tests/integration.rs`
5. Register in `CaptchaSolverChain::default_chain()` if generally useful
6. Update `ARCHITECTURE.md`
## Release Process
1. Update `CHANGELOG.md`
2. Bump version in `Cargo.toml`
3. Run full test suite
4. `cargo publish`
5. Tag release on GitHub