File size: 11,869 Bytes
1d3f990 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | # Contributing to ROWM
**Version:** 1.0.0
**Status:** Open for Contributions
**Authors:** Ahmad Ali Parr, Jessica SNAPKITTYWEST
---
## Welcome
ROWM is an open-source project seeking contributors in:
- **Formal verification** (Agda, Ada/SPARK, Lean 4 integration)
- **Language support** (new polyglot parsers)
- **Performance optimization** (VM speed, compilation)
- **Security auditing** (threat model review, penetration testing)
- **Documentation** (guides, examples, API docs)
- **Testing** (unit tests, integration tests, property-based tests)
---
## Core Values
1. **Logic Over Assumptions** β Every claim is backed by Prolog facts
2. **Evidence Over Assertions** β No feature ships without passing tests
3. **Reproducibility Over Convenience** β Build and test results must be deterministic
4. **Transparency Over Secrecy** β Threat model and known limitations are public
5. **Verification Over Belief** β Formal proofs preferred over documentation
---
## Getting Started
### Prerequisites
- Rust 1.78+ (install via [rustup.rs](https://rustup.rs))
- GNU M4 (for morphing engine)
- SWI-Prolog 8.x+ (for logic engine)
- Git
### Build
```bash
git clone https://github.com/SNAPKITTYWEST/rowm-polymorphic-notebook.git
cd rowm-polymorphic-notebook
cargo build --release --workspace
```
### Run Tests
```bash
# Rust tests
cargo test --all --lib
# Prolog tests
swipl -f logic/facts/*.pl -f logic/rules/*.pl -f logic/queries/test_queries.pl -t run_tests
# Release readiness check
swipl -f logic/facts/*.pl -f logic/rules/*.pl -t "release_ready(R), format('Result: ~w~n', [R])."
```
---
## Development Workflow
### 1. Pick an Issue
Check [GitHub Issues](https://github.com/SNAPKITTYWEST/rowm-polymorphic-notebook/issues) for:
- Bugs with `#audit` label (security/correctness)
- Features with `#feature` label
- Docs with `#documentation` label
### 2. Create a Branch
```bash
git checkout -b fix/issue-name # for bug fixes
git checkout -b feature/issue-name # for new features
git checkout -b docs/issue-name # for documentation
```
### 3. Implement & Test
- Write code following project style (see below)
- Add tests for all new functionality
- Run full test suite: `cargo test --all --lib`
- Verify Prolog logic: `swipl ...` queries
### 4. Commit with Evidence
Include concrete evidence in commit message:
```
fix: Authorization gate now properly rejects tier_2 agents
Fixes #42: dispatch_gated/5 now checks agent_trust_level before returning true.
Boundary condition: Timestamp < ExpiresAt (not <=).
Evidence:
- Test case: test_tier2_agent_dispatch_denied passes
- Regression: test_expired_capability_acceptance now correctly fails
- Prolog validation: readiness_check('no_revoked_capabilities', true) passes
Co-Authored-By: Claude <noreply@anthropic.com>
```
### 5. Create Pull Request
```bash
git push origin feature/issue-name
gh pr create --fill
```
Include in PR description:
- What this fixes (or adds)
- How to test it
- Relevant documentation changes
- Any known limitations
### 6. Review & Merge
- Address code review feedback
- Re-run tests after changes
- Maintain focus on single issue (don't add unrelated fixes)
- Once approved: repo maintainers merge
---
## Code Style
### Rust
- Use `cargo fmt` before committing: `cargo fmt --all`
- Use `cargo clippy` for linting: `cargo clippy --all --lib`
- **No unsafe code** without explicit `// SAFETY: ...` comment explaining why
- Prefer `Result<T>` over panicking for errors
- Max line length: 100 characters (soft limit)
**Example:**
```rust
// Good: explicit error handling
pub fn load_proof(path: &str) -> Result<ProofTerm> {
let bytes = std::fs::read(path)?;
serde_json::from_slice(&bytes).map_err(|e| anyhow!("Invalid proof: {}", e))
}
// Avoid: panicking
pub fn load_proof_bad(path: &str) -> ProofTerm {
serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap()
}
```
### Prolog
- One fact per line (no multi-line facts)
- Comments above rules explaining intent
- Use descriptive predicate names (not `p/2`, use `authorization/2`)
- No anonymous variables (`_`) in public predicates
**Example:**
```prolog
% Good: clear, documented
% dispatch_gated/5: Sealed authorization entry point
% All external dispatch must pass through this predicate.
dispatch_gated(Agent, Cap, Runtime, Perm, true) :-
agent_active(Agent, true),
agent_trust_level(Agent, Tier),
Tier \= tier_2,
capability_issued(Cap, _, Agent, Runtime, Perms, _, Expires),
\+ capability_revoked(Cap, _),
get_time(Now),
Now < Expires,
member(Perm, Perms),
runtime_active(Runtime, true).
% Avoid: cryptic
p(A, C, R, P, T) :- a(A), tnl(A, TL), TL \= t2, ci(C, _, A, R, PS, _, E),
\+ cr(C, _), gt(N), N < E, m(P, PS), ra(R, T).
```
### Documentation (Markdown)
- Use ATX headers (`#`, `##`, not underlines)
- Wrap at 80 characters for readability
- Include code examples with language tags
- Link to related documentation and GitHub issues
---
## Testing
### Unit Tests
Write tests in `#[cfg(test)]` modules:
```rust
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_dispatch_gated_rejects_revoked_capability() {
// Arrange
let agent = "forge";
let cap = "capa_revoked";
let runtime = "rust";
let permission = "execute";
// Act
let result = dispatch_gated(agent, cap, runtime, permission, ?);
// Assert
assert_eq!(result, false);
}
}
```
### Integration Tests
Add files to `crates/*/tests/`:
```rust
// tests/integration_test.rs
#[test]
fn test_end_to_end_cell_execution() {
// Full execution: parse β authorize β compile β execute β verify β receipt
}
```
### Prolog Tests
Add to `logic/queries/test_queries.pl`:
```prolog
test_dispatch_gated_denies_tier2 :-
\+ dispatch_gated('phantom', 'capa_001', rust, execute, true),
write('β Tier 2 agent correctly denied\n').
```
### Property-Based Tests
Use `proptest` for randomized testing:
```rust
proptest! {
#[test]
fn prop_invariant_preserved(seed in 0u64..1000) {
let mut vm = create_test_vm(seed);
vm.execute().expect("execution must succeed");
assert!(check_all_invariants(&vm));
}
}
```
---
## Merge Criteria
Before a PR can merge, all of the following must pass:
- [ ] **Build:** `cargo build --release --workspace` succeeds
- [ ] **Tests:** `cargo test --all --lib` passes (100%)
- [ ] **Linting:** `cargo clippy` has no warnings
- [ ] **Format:** `cargo fmt` produces no changes
- [ ] **Prolog:** `swipl ... release_ready(true)` passes
- [ ] **Documentation:** Relevant docs updated
- [ ] **Evidence:** Commit message includes test evidence
- [ ] **No Security Regressions:** No removal of authorization checks
- [ ] **No Unstaged Features:** No proto/planned code merged as complete
- [ ] **Reviewed:** At least 1 approving review from maintainer
---
## Adding a New Language to Polyglot Frontend
### Step 1: Implement Parser Trait
```rust
// crates/polyglot-frontend/src/parsers/mylang.rs
pub struct MyLangParser;
impl Parser for MyLangParser {
fn parse(&self, source: &str) -> Result<Ast> {
// Use tree-sitter or custom parser
let tree = tree_sitter_mylang::parse(source)?;
convert_tree_to_ast(tree)
}
fn language(&self) -> Language {
Language::Mylang
}
}
```
### Step 2: Add Language Enum
```rust
// crates/polyglot-frontend/src/language.rs
pub enum Language {
// ... existing languages ...
Mylang,
}
pub impl Language {
pub fn tier(&self) -> LanguageTier {
match self {
Language::Mylang => LanguageTier::Tier4, // or appropriate tier
// ...
}
}
}
```
### Step 3: Register in Registry
```rust
// In registry.rs or similar
let mut registry = LanguageRegistry::new();
registry.register(Language::Mylang, Box::new(MyLangParser));
```
### Step 4: Add Tests
```rust
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_mylang_parse_simple() {
let source = "x := 10;";
let ast = MyLangParser.parse(source).unwrap();
assert_eq!(ast.root.statements.len(), 1);
}
}
```
### Step 5: Update Documentation
- Add to `docs/API_REFERENCE.md` (polyglot-frontend section)
- Add to README.md language support table
- Update CONTRIBUTING.md if integration is complex
---
## Adding a New Proof Integration
### Step 1: Design Adapter
```rust
// crates/proof-validator/src/adapters/myprover.rs
pub struct MyProverAdapter;
impl ProofVerifier for MyProverAdapter {
fn verify(&self, obligation: &ProofObligation, proof: &ProofTerm) -> Result<ProofStatus> {
// Invoke external tool (Agda, Lean, etc.)
// Return status: Proved | Disproved | Manual | Error
}
}
```
### Step 2: Integrate with Validator
```rust
// In proof-validator.rs
pub struct ProofValidator {
verifiers: HashMap<String, Box<dyn ProofVerifier>>,
}
impl ProofValidator {
pub fn add_verifier(&mut self, name: &str, verifier: Box<dyn ProofVerifier>) {
self.verifiers.insert(name.to_string(), verifier);
}
}
```
### Step 3: Test End-to-End
```rust
#[test]
fn test_proof_verification_with_myprover() {
let obligation = create_test_obligation();
let proof = invoke_myprover(&obligation)?;
assert_eq!(proof.status, ProofStatus::Proved);
}
```
---
## Security & Audit Contributions
### Reporting Security Issues
**Do NOT open public issues for security vulnerabilities.**
Email security concerns to: **[security-contact-TBD]**
Include:
- Description of vulnerability
- Proof-of-concept (if applicable)
- Steps to reproduce
- Suggested mitigation
Vulnerability disclosure timeline:
1. Report received
2. Assessment (48 hours)
3. Fix development (1-2 weeks typical)
4. Fix release & public disclosure
### Audit Contributions
If conducting security audit, provide:
- Threat description and CWE reference
- Reproduction steps
- Severity rating (CVSS or descriptive)
- Suggested remediation
- Proof-of-concept code (if applicable)
---
## Documentation Contributions
### Fixing Docs
- Fix typos, unclear sections, broken examples
- Update outdated information
- Add clarifying examples
- Link related documentation
### Adding New Docs
- Get consensus via GitHub issue first (avoid writing docs that won't be merged)
- Include with corresponding code changes
- Follow markdown style (see docs/ for examples)
- Keep examples runnable and tested
---
## Community Guidelines
1. **Be Respectful** β All contributors and maintainers are volunteers
2. **Assume Good Intent** β Technical disagreements are not personal
3. **Focus on Code** β Critique code, not contributors
4. **Share Knowledge** β Help newer contributors learn
5. **No Tolerance for Harassment** β We enforce a Code of Conduct
---
## Questions & Support
- **General questions:** GitHub Discussions
- **Implementation questions:** GitHub Issues
- **Security questions:** Private email (see above)
- **Design feedback:** Pull request comments
---
## Recognition
Contributors are recognized in:
1. Git commit author line (Co-Authored-By)
2. GitHub contributors graph
3. Release notes (for significant contributions)
4. Project README (for sustained contributors)
---
**Thank you for contributing to ROWM!**
*"EVIDENCE OR SILENCE." β Make your contributions count.*
|