Skip to content

Commit c7e6845

Browse files
committed
feat(structured-comments): implement complete structured comment system
- Add comprehensive comment standards with 6 structured markers: * FUTURE: for planned enhancements * NOTE: for design documentation * ENHANCEMENT: for performance improvements * PLANNED(#issue): for tracked future work * CONSIDER: for alternative approaches * TODO(#issue): for TODOs linked to GitHub issues - Update pre-commit hook with intelligent pattern filtering: * Blocks: TODO:, FIXME:, XXX:, HACK:, placeholder implementations * Allows: All structured markers with proper context * Provides guidance when blocking commits - Create comprehensive documentation and migration guide - Demonstrate system with real MCP test harness examples - Enable proper future work planning while maintaining quality The system successfully distinguishes between incomplete implementations (blocked) and legitimate future work documentation (allowed).
1 parent c996e48 commit c7e6845

24 files changed

Lines changed: 4208 additions & 7 deletions

File tree

.cursor/rules/comment-standards.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# Comment Standards - Future Work vs Incomplete Implementation
2+
3+
**Purpose:** Distinguish between legitimate future work markers and incomplete placeholder implementations. Allows proper project planning while maintaining implementation quality standards.
4+
5+
**When to use:** Any time you need to mark future work, document planned enhancements, or indicate areas for improvement without blocking commits.
6+
7+
## Allowed Comment Markers
8+
9+
**Rule: Use structured markers for legitimate future work that should NOT block commits.**
10+
Why: These represent planned enhancements, design decisions, or documented technical debt - not incomplete current implementations.
11+
12+
### FUTURE: - Planned Enhancements
13+
Use for features planned for future releases that don't affect current functionality.
14+
15+
```rust
16+
// FUTURE: Add support for HTTP/2 transport in v2.0
17+
// FUTURE: Implement connection pooling for better performance
18+
// FUTURE: Add metrics collection for monitoring dashboard
19+
pub fn create_connection() -> Connection {
20+
// Current working implementation
21+
Connection::new()
22+
}
23+
```
24+
25+
### NOTE: - Design Documentation
26+
Use for documenting design decisions, architectural notes, or implementation context.
27+
28+
```rust
29+
// NOTE: We use stdio transport here because it's most compatible across platforms
30+
// NOTE: Error handling follows the established pattern from the validation module
31+
// NOTE: Performance is acceptable for current use cases (<100 users)
32+
pub fn establish_transport() -> StdioTransport {
33+
StdioTransport::new()
34+
}
35+
```
36+
37+
### ENHANCEMENT: - Performance/Quality Improvements
38+
Use for identified optimizations that aren't critical for current functionality.
39+
40+
```rust
41+
// ENHANCEMENT: Could optimize this with a HashMap for O(1) lookups instead of O(n)
42+
// ENHANCEMENT: Add caching layer to reduce database queries
43+
// ENHANCEMENT: Consider using async stream for large result sets
44+
pub fn find_users(&self, criteria: &SearchCriteria) -> Vec<User> {
45+
// Current working implementation that meets requirements
46+
self.users.iter().filter(|u| criteria.matches(u)).cloned().collect()
47+
}
48+
```
49+
50+
### PLANNED(#issue): - Tracked Future Work
51+
Use for work items tracked in GitHub issues. Include issue number for traceability.
52+
53+
```rust
54+
// PLANNED(#125): Add user authentication middleware
55+
// PLANNED(#126): Implement rate limiting for API endpoints
56+
// PLANNED(#127): Add database migration system
57+
pub fn handle_request(&self, request: Request) -> Response {
58+
// Current implementation handles unauthenticated requests
59+
self.process_request(request)
60+
}
61+
```
62+
63+
### CONSIDER: - Alternative Approaches
64+
Use for documenting alternative implementation approaches that were considered.
65+
66+
```rust
67+
// CONSIDER: Alternative approach using trait objects instead of generics
68+
// CONSIDER: Could use macro to reduce boilerplate in similar functions
69+
// CONSIDER: Async version for non-blocking operations
70+
pub fn process_sync<T: Processor>(&self, processor: T) -> Result<Output> {
71+
// Current synchronous implementation that works for our use case
72+
processor.process(&self.data)
73+
}
74+
```
75+
76+
## Blocked Comment Markers
77+
78+
**Rule: These markers indicate incomplete implementations and MUST be resolved before commit.**
79+
Why: These suggest the current code doesn't work properly or is missing essential functionality.
80+
81+
### Blocked Patterns (Pre-commit will reject):
82+
```rust
83+
// TODO: Implement this function
84+
// FIXME: This is broken and needs repair
85+
// XXX: Hack that needs proper solution
86+
// HACK: Temporary workaround
87+
// stub implementation
88+
// placeholder implementation
89+
// For now, just return placeholder
90+
// Not implemented yet
91+
// Will implement later
92+
```
93+
94+
## Implementation Guidelines
95+
96+
### Format Requirements
97+
```rust
98+
// ✅ GOOD - Structured with clear category
99+
// FUTURE: Add connection retry logic with exponential backoff
100+
// ENHANCEMENT: Optimize memory usage by reusing allocations
101+
// NOTE: This approach was chosen for compatibility with legacy systems
102+
103+
// ❌ BAD - Vague or indicates incomplete work
104+
// TODO: Fix this
105+
// TODO: Make this work properly
106+
// TODO: Implement error handling
107+
```
108+
109+
### Linking to Issues
110+
```rust
111+
// ✅ GOOD - Links to tracked work
112+
// PLANNED(#123): Implement user roles and permissions system
113+
// FUTURE(#124): Add support for custom validation rules
114+
115+
// ✅ GOOD - Internal planning without external tracking
116+
// FUTURE: Consider adding audit logging for compliance requirements
117+
// ENHANCEMENT: Profile this function to identify optimization opportunities
118+
```
119+
120+
### Context Requirements
121+
All future work markers should include sufficient context:
122+
123+
```rust
124+
// ✅ GOOD - Explains what, why, and when
125+
// FUTURE: Add WebSocket transport support for real-time notifications
126+
// Planned for v2.0 when we have real-time requirements
127+
// Will require protocol extension for bidirectional communication
128+
129+
// ❌ BAD - Lacks context
130+
// FUTURE: Add WebSocket support
131+
```
132+
133+
## Pre-commit Hook Configuration
134+
135+
The pre-commit hook should be updated to:
136+
137+
### Block These Patterns:
138+
- `TODO:` (without issue number)
139+
- `FIXME:`
140+
- `XXX:`
141+
- `HACK:`
142+
- `stub implementation`
143+
- `placeholder implementation`
144+
- `Not implemented`
145+
- `Will implement later`
146+
- Functions returning `unimplemented!()` or `todo!()`
147+
148+
### Allow These Patterns:
149+
- `FUTURE:`
150+
- `NOTE:`
151+
- `ENHANCEMENT:`
152+
- `PLANNED(#\d+):`
153+
- `CONSIDER:`
154+
- `TODO(#\d+):` (when linked to issue)
155+
156+
## Documentation Integration
157+
158+
### Generate Future Work Reports
159+
```bash
160+
# Extract all future work markers
161+
grep -r "FUTURE:\|PLANNED:\|ENHANCEMENT:" src/ --include="*.rs" > future_work.md
162+
163+
# Generate by category
164+
grep -r "FUTURE:" src/ --include="*.rs" | sed 's/.*FUTURE:/FUTURE:/' > planned_features.md
165+
```
166+
167+
### Review Process
168+
```markdown
169+
## Code Review Checklist
170+
171+
### Future Work Markers
172+
- [ ] All TODO comments are either resolved or converted to appropriate markers
173+
- [ ] PLANNED items reference actual GitHub issues
174+
- [ ] FUTURE items have sufficient context for future developers
175+
- [ ] ENHANCEMENT items are genuine improvements, not missing functionality
176+
- [ ] NOTE items document important design decisions
177+
```
178+
179+
## Migration Guide
180+
181+
### Converting Existing TODOs
182+
```bash
183+
# 1. Review all existing TODOs
184+
grep -r "TODO:" src/ --include="*.rs"
185+
186+
# 2. Categorize each one:
187+
# - Is this missing functionality? → Fix before commit
188+
# - Is this planned future work? → Convert to FUTURE: or PLANNED(#issue):
189+
# - Is this a known optimization? → Convert to ENHANCEMENT:
190+
# - Is this documentation? → Convert to NOTE:
191+
192+
# 3. Update pre-commit hook to use new patterns
193+
```
194+
195+
### Example Conversion
196+
```rust
197+
// OLD - Would be blocked
198+
// TODO: Add connection pooling
199+
200+
// NEW - Allowed patterns
201+
// ENHANCEMENT: Add connection pooling to improve performance under high load
202+
// PLANNED(#145): Implement connection pooling for production scalability
203+
// FUTURE: Consider connection pooling when user base grows beyond 1000 concurrent users
204+
```
205+
206+
This system allows legitimate future work documentation while maintaining strict standards for current implementation completeness.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,7 @@ criterion/
3030

3131
# Generated files
3232
*.pb.rs
33-
generated/
33+
generated/
34+
35+
#Cursor Workspace
36+
cursor_workspace/

Cargo.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
[workspace]
2-
resolver = "2"
32
members = [
43
"crates/codeprism-core",
5-
"crates/codeprism-storage",
6-
"crates/codeprism-analysis",
7-
"crates/codeprism-mcp",
8-
"crates/codeprism-lang-js",
9-
"crates/codeprism-lang-python",
104
"crates/codeprism-lang-rust",
5+
"crates/codeprism-lang-python",
6+
"crates/codeprism-lang-js",
117
"crates/codeprism-lang-java",
8+
"crates/codeprism-analysis",
9+
"crates/codeprism-storage",
10+
"crates/codeprism-mcp",
1211
"crates/codeprism-dev-tools",
1312
"crates/codeprism-test-harness",
13+
"crates/mcp-test-harness",
1414
]
15+
resolver = "2"
1516

1617
[workspace.package]
1718
version = "0.3.4"

crates/mcp-test-harness/Cargo.toml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
[package]
2+
name = "mcp-test-harness-lib"
3+
version = "0.1.0"
4+
edition = "2021"
5+
description = "Generic MCP (Model Context Protocol) test harness for validating server implementations"
6+
authors = ["MCP Test Harness Team <team@example.com>"]
7+
license = "MIT"
8+
repository = "https://github.com/milliondreams/prism"
9+
keywords = ["mcp", "testing", "protocol", "validation"]
10+
categories = ["development-tools::testing"]
11+
12+
[[bin]]
13+
name = "mcp-test-harness"
14+
path = "src/main.rs"
15+
16+
[dependencies]
17+
# Core async runtime
18+
tokio = { version = "1.0", features = ["full"] }
19+
20+
# Async trait support
21+
async-trait = "0.1"
22+
23+
# Command line interface
24+
clap = { version = "4.0", features = ["derive", "env"] }
25+
26+
# Serialization/deserialization
27+
serde = { version = "1.0", features = ["derive"] }
28+
serde_json = "1.0"
29+
serde_yaml = "0.9"
30+
31+
# JSON Schema validation
32+
jsonschema = { version = "0.18", default-features = false }
33+
34+
# Enhanced error handling
35+
anyhow = "1.0"
36+
thiserror = "1.0"
37+
38+
# Logging and tracing
39+
tracing = "0.1"
40+
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
41+
42+
# Async process management
43+
tokio-process = "0.2"
44+
45+
# UUID generation for test runs
46+
uuid = { version = "1.0", features = ["v4"] }
47+
48+
# Time handling
49+
chrono = { version = "0.4", features = ["serde"] }
50+
51+
# File system utilities
52+
walkdir = "2.0"
53+
54+
# JSON path expressions (for field validation)
55+
jsonpath_lib = "0.3"
56+
57+
# Regular expressions (for pattern matching)
58+
regex = "1.0"
59+
60+
# HTTP client (for HTTP transport)
61+
reqwest = { version = "0.11", features = ["json"], optional = true }
62+
63+
# WebSocket client (for WebSocket transport)
64+
tokio-tungstenite = { version = "0.20", optional = true }
65+
66+
# URL parsing
67+
url = "2.0"
68+
69+
[dev-dependencies]
70+
# Enhanced testing
71+
rstest = "0.18"
72+
tempfile = "3.0"
73+
tokio-test = "0.4"
74+
75+
# Test utilities
76+
pretty_assertions = "1.0"
77+
mockall = "0.11"
78+
79+
# Property-based testing
80+
proptest = "1.0"
81+
82+
[features]
83+
default = ["stdio-transport", "json-reports"]
84+
85+
# Transport mechanisms
86+
stdio-transport = []
87+
http-transport = ["reqwest"]
88+
websocket-transport = ["tokio-tungstenite"]
89+
90+
# Report formats
91+
json-reports = []
92+
html-reports = []
93+
junit-reports = []
94+
95+
# Performance monitoring
96+
performance-monitoring = []
97+
98+
# Experimental features
99+
experimental = []

0 commit comments

Comments
 (0)