diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-05 06:37:21 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-11-05 06:37:21 +0000 |
| commit | 5cd47079ee762125817612d2bf82a0bca07da3ad (patch) | |
| tree | 89f490b9cb981467c27467a0a826bdbfa229cfd9 /docs/archive/2025-11-04-evening/implementation-checklist.md | |
| parent | 9ae69e7f6854d44f75ebd16f11ba5c95a45a56bf (diff) | |
preparing to build grasp-audit against git-relay
Diffstat (limited to 'docs/archive/2025-11-04-evening/implementation-checklist.md')
| -rw-r--r-- | docs/archive/2025-11-04-evening/implementation-checklist.md | 720 |
1 files changed, 720 insertions, 0 deletions
diff --git a/docs/archive/2025-11-04-evening/implementation-checklist.md b/docs/archive/2025-11-04-evening/implementation-checklist.md new file mode 100644 index 0000000..64f5f4e --- /dev/null +++ b/docs/archive/2025-11-04-evening/implementation-checklist.md | |||
| @@ -0,0 +1,720 @@ | |||
| 1 | # Implementation Checklist | ||
| 2 | |||
| 3 | **Date:** November 4, 2025 | ||
| 4 | **Purpose:** Step-by-step checklist for actix-web integration | ||
| 5 | |||
| 6 | --- | ||
| 7 | |||
| 8 | ## ✅ Pre-Implementation (DONE) | ||
| 9 | |||
| 10 | - [x] Review GRASP-01 specification | ||
| 11 | - [x] Review ngit-relay reference implementation | ||
| 12 | - [x] Understand single-port architecture | ||
| 13 | - [x] Document architecture in work/architecture-diagram.md | ||
| 14 | - [x] Create detailed plan in work/NEXT_SESSION_START_HERE.md | ||
| 15 | - [x] Update work/current_status.md | ||
| 16 | |||
| 17 | --- | ||
| 18 | |||
| 19 | ## 📦 Phase 1: Dependencies & Setup | ||
| 20 | |||
| 21 | ### 1.1 Update Cargo.toml | ||
| 22 | |||
| 23 | - [ ] Add `actix-web = "4"` | ||
| 24 | - [ ] Add `actix-cors = "0.7"` | ||
| 25 | - [ ] Add `actix-ws = "0.3"` (or use actix-web-actors) | ||
| 26 | - [ ] Add `git-http-backend = "0.2"` (check latest version) | ||
| 27 | - [ ] Run `cargo check` to verify dependencies | ||
| 28 | |||
| 29 | **Verification:** | ||
| 30 | ```bash | ||
| 31 | cargo tree | grep actix | ||
| 32 | cargo tree | grep git-http-backend | ||
| 33 | ``` | ||
| 34 | |||
| 35 | ### 1.2 Update .env.example (if needed) | ||
| 36 | |||
| 37 | - [x] Already has all required fields | ||
| 38 | - [x] NGIT_DOMAIN | ||
| 39 | - [x] NGIT_BIND_ADDRESS | ||
| 40 | - [x] NGIT_GIT_DATA_PATH | ||
| 41 | - [x] NGIT_RELAY_DATA_PATH | ||
| 42 | |||
| 43 | **Verification:** | ||
| 44 | ```bash | ||
| 45 | cat .env.example | ||
| 46 | ``` | ||
| 47 | |||
| 48 | --- | ||
| 49 | |||
| 50 | ## 🏗️ Phase 2: HTTP Server Module | ||
| 51 | |||
| 52 | ### 2.1 Create src/http/mod.rs | ||
| 53 | |||
| 54 | - [ ] Create module structure | ||
| 55 | - [ ] Add `pub mod git;` | ||
| 56 | - [ ] Add `pub mod nostr;` | ||
| 57 | - [ ] Create `run_server()` function | ||
| 58 | - [ ] Set up actix-web HttpServer | ||
| 59 | - [ ] Add CORS middleware | ||
| 60 | - [ ] Add routing for Git and Nostr | ||
| 61 | |||
| 62 | **Verification:** | ||
| 63 | ```bash | ||
| 64 | cargo check | ||
| 65 | # Should compile without errors | ||
| 66 | ``` | ||
| 67 | |||
| 68 | **Test:** | ||
| 69 | ```rust | ||
| 70 | // In src/http/mod.rs | ||
| 71 | #[cfg(test)] | ||
| 72 | mod tests { | ||
| 73 | use super::*; | ||
| 74 | |||
| 75 | #[test] | ||
| 76 | fn test_module_exists() { | ||
| 77 | // Just verify module structure | ||
| 78 | assert!(true); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | ``` | ||
| 82 | |||
| 83 | ### 2.2 Create src/http/git.rs | ||
| 84 | |||
| 85 | - [ ] Create `handle_git_request()` function | ||
| 86 | - [ ] Parse npub and repo from path | ||
| 87 | - [ ] Construct repository path | ||
| 88 | - [ ] Check if repository exists (return 404 if not) | ||
| 89 | - [ ] Use git-http-backend crate | ||
| 90 | - [ ] Handle GET (clone/fetch) | ||
| 91 | - [ ] Handle POST (push) | ||
| 92 | - [ ] Return proper HTTP responses | ||
| 93 | |||
| 94 | **Verification:** | ||
| 95 | ```bash | ||
| 96 | cargo check | ||
| 97 | # Should compile | ||
| 98 | ``` | ||
| 99 | |||
| 100 | **Test:** | ||
| 101 | ```rust | ||
| 102 | #[cfg(test)] | ||
| 103 | mod tests { | ||
| 104 | use super::*; | ||
| 105 | |||
| 106 | #[test] | ||
| 107 | fn test_parse_repo_path() { | ||
| 108 | // Test path parsing logic | ||
| 109 | let path = "/npub1abc.../my-repo.git"; | ||
| 110 | // ... verify parsing | ||
| 111 | } | ||
| 112 | } | ||
| 113 | ``` | ||
| 114 | |||
| 115 | ### 2.3 Create src/http/nostr.rs | ||
| 116 | |||
| 117 | - [ ] Create `handle_websocket()` function | ||
| 118 | - [ ] Handle WebSocket upgrade | ||
| 119 | - [ ] Reuse existing Nostr message handling | ||
| 120 | - [ ] Create `handle_http_root()` function | ||
| 121 | - [ ] Serve HTML for browsers | ||
| 122 | - [ ] Serve NIP-11 JSON for Accept: application/nostr+json | ||
| 123 | |||
| 124 | **Verification:** | ||
| 125 | ```bash | ||
| 126 | cargo check | ||
| 127 | ``` | ||
| 128 | |||
| 129 | **Test:** | ||
| 130 | ```rust | ||
| 131 | #[cfg(test)] | ||
| 132 | mod tests { | ||
| 133 | use super::*; | ||
| 134 | |||
| 135 | #[test] | ||
| 136 | fn test_nip11_response() { | ||
| 137 | // Test NIP-11 JSON generation | ||
| 138 | // ... | ||
| 139 | } | ||
| 140 | } | ||
| 141 | ``` | ||
| 142 | |||
| 143 | --- | ||
| 144 | |||
| 145 | ## 🔧 Phase 3: Update Existing Code | ||
| 146 | |||
| 147 | ### 3.1 Update src/config.rs | ||
| 148 | |||
| 149 | - [x] Already has `git_data_path` field | ||
| 150 | - [x] Already has `from_env()` implementation | ||
| 151 | - [ ] Verify all fields are present | ||
| 152 | - [ ] Add any missing validation | ||
| 153 | |||
| 154 | **Verification:** | ||
| 155 | ```bash | ||
| 156 | cargo check | ||
| 157 | ``` | ||
| 158 | |||
| 159 | ### 3.2 Update src/main.rs | ||
| 160 | |||
| 161 | - [ ] Remove direct relay start | ||
| 162 | - [ ] Import `http` module | ||
| 163 | - [ ] Call `http::run_server(config, storage).await` | ||
| 164 | - [ ] Update logging messages | ||
| 165 | |||
| 166 | **Verification:** | ||
| 167 | ```bash | ||
| 168 | cargo build | ||
| 169 | # Should build successfully | ||
| 170 | ``` | ||
| 171 | |||
| 172 | **Test:** | ||
| 173 | ```bash | ||
| 174 | # Run server | ||
| 175 | NGIT_DOMAIN=localhost:8080 \ | ||
| 176 | NGIT_BIND_ADDRESS=127.0.0.1:8080 \ | ||
| 177 | cargo run | ||
| 178 | |||
| 179 | # In another terminal, check it's listening | ||
| 180 | curl -v http://localhost:8080/ | ||
| 181 | ``` | ||
| 182 | |||
| 183 | ### 3.3 Move Relay Logic to Library | ||
| 184 | |||
| 185 | - [ ] Extract relay logic from src/nostr/relay.rs | ||
| 186 | - [ ] Make it reusable by WebSocket handler | ||
| 187 | - [ ] Keep message handling separate from transport | ||
| 188 | - [ ] Create `handle_nostr_message()` function | ||
| 189 | |||
| 190 | **Structure:** | ||
| 191 | ```rust | ||
| 192 | // src/nostr/relay.rs | ||
| 193 | pub async fn handle_nostr_message( | ||
| 194 | message: &str, | ||
| 195 | storage: &Storage, | ||
| 196 | ) -> Result<Vec<String>> { | ||
| 197 | // Parse message | ||
| 198 | // Handle EVENT, REQ, CLOSE | ||
| 199 | // Return response messages | ||
| 200 | } | ||
| 201 | ``` | ||
| 202 | |||
| 203 | **Verification:** | ||
| 204 | ```bash | ||
| 205 | cargo check | ||
| 206 | cargo test --lib | ||
| 207 | ``` | ||
| 208 | |||
| 209 | --- | ||
| 210 | |||
| 211 | ## 🧪 Phase 4: Update Tests | ||
| 212 | |||
| 213 | ### 4.1 Update tests/common/relay.rs | ||
| 214 | |||
| 215 | - [ ] Verify NGIT_DOMAIN is set correctly | ||
| 216 | - [ ] Add NGIT_GIT_DATA_PATH env var | ||
| 217 | - [ ] Add NGIT_RELAY_DATA_PATH env var | ||
| 218 | - [ ] Use test-specific directories | ||
| 219 | - [ ] Clean up test data after tests | ||
| 220 | |||
| 221 | **Current Status:** Already sets NGIT_DOMAIN correctly! | ||
| 222 | |||
| 223 | **Add:** | ||
| 224 | ```rust | ||
| 225 | .env("NGIT_GIT_DATA_PATH", "./test-data/repos") | ||
| 226 | .env("NGIT_RELAY_DATA_PATH", "./test-data/relay") | ||
| 227 | ``` | ||
| 228 | |||
| 229 | **Verification:** | ||
| 230 | ```bash | ||
| 231 | cargo test --test nip01_compliance | ||
| 232 | # Should still pass | ||
| 233 | ``` | ||
| 234 | |||
| 235 | ### 4.2 Create tests/grasp01_git_http.rs | ||
| 236 | |||
| 237 | - [ ] Create new test file | ||
| 238 | - [ ] Add basic Git clone test | ||
| 239 | - [ ] Add CORS headers test | ||
| 240 | - [ ] Add OPTIONS request test | ||
| 241 | - [ ] Add repository not found test | ||
| 242 | - [ ] Reference GRASP-01 line numbers in comments | ||
| 243 | |||
| 244 | **Template:** | ||
| 245 | ```rust | ||
| 246 | //! GRASP-01 Git HTTP Integration Tests | ||
| 247 | //! | ||
| 248 | //! Reference: ../grasp/01.md lines 15-40 | ||
| 249 | |||
| 250 | mod common; | ||
| 251 | |||
| 252 | use common::TestRelay; | ||
| 253 | |||
| 254 | #[tokio::test] | ||
| 255 | async fn test_git_http_basic() { | ||
| 256 | // Reference: ../grasp/01.md line 15 | ||
| 257 | // MUST serve git repository via unauthenticated git smart http | ||
| 258 | |||
| 259 | let relay = TestRelay::start().await; | ||
| 260 | |||
| 261 | // TODO: Create test repo | ||
| 262 | // TODO: Try to clone it | ||
| 263 | |||
| 264 | relay.stop().await; | ||
| 265 | } | ||
| 266 | ``` | ||
| 267 | |||
| 268 | **Verification:** | ||
| 269 | ```bash | ||
| 270 | cargo test --test grasp01_git_http | ||
| 271 | ``` | ||
| 272 | |||
| 273 | ### 4.3 Update tests/nip01_compliance.rs | ||
| 274 | |||
| 275 | - [ ] Verify tests still pass with new architecture | ||
| 276 | - [ ] Update any broken tests | ||
| 277 | - [ ] Add comments referencing GRASP-01 where relevant | ||
| 278 | |||
| 279 | **Verification:** | ||
| 280 | ```bash | ||
| 281 | cargo test --test nip01_compliance | ||
| 282 | ``` | ||
| 283 | |||
| 284 | --- | ||
| 285 | |||
| 286 | ## 🔍 Phase 5: Integration & Testing | ||
| 287 | |||
| 288 | ### 5.1 Manual Testing | ||
| 289 | |||
| 290 | **Test 1: Server Starts** | ||
| 291 | ```bash | ||
| 292 | cargo build | ||
| 293 | NGIT_DOMAIN=localhost:8080 \ | ||
| 294 | NGIT_BIND_ADDRESS=127.0.0.1:8080 \ | ||
| 295 | cargo run | ||
| 296 | ``` | ||
| 297 | |||
| 298 | **Expected:** Server starts without errors | ||
| 299 | |||
| 300 | --- | ||
| 301 | |||
| 302 | **Test 2: WebSocket Connection** | ||
| 303 | ```bash | ||
| 304 | # In grasp-audit directory | ||
| 305 | cargo run -- --url ws://localhost:8080 | ||
| 306 | ``` | ||
| 307 | |||
| 308 | **Expected:** NIP-01 smoke tests pass | ||
| 309 | |||
| 310 | --- | ||
| 311 | |||
| 312 | **Test 3: HTTP Root** | ||
| 313 | ```bash | ||
| 314 | curl -v http://localhost:8080/ | ||
| 315 | ``` | ||
| 316 | |||
| 317 | **Expected:** | ||
| 318 | - Status: 200 OK | ||
| 319 | - Content-Type: text/html | ||
| 320 | - CORS headers present | ||
| 321 | - HTML content | ||
| 322 | |||
| 323 | --- | ||
| 324 | |||
| 325 | **Test 4: NIP-11** | ||
| 326 | ```bash | ||
| 327 | curl -v http://localhost:8080/ \ | ||
| 328 | -H "Accept: application/nostr+json" | ||
| 329 | ``` | ||
| 330 | |||
| 331 | **Expected:** | ||
| 332 | - Status: 200 OK | ||
| 333 | - Content-Type: application/json | ||
| 334 | - CORS headers present | ||
| 335 | - JSON with `supported_grasps` field | ||
| 336 | |||
| 337 | --- | ||
| 338 | |||
| 339 | **Test 5: Git Repository (404)** | ||
| 340 | ```bash | ||
| 341 | curl -v http://localhost:8080/npub1test/test-repo.git/info/refs?service=git-upload-pack | ||
| 342 | ``` | ||
| 343 | |||
| 344 | **Expected:** | ||
| 345 | - Status: 404 Not Found | ||
| 346 | - CORS headers present | ||
| 347 | |||
| 348 | --- | ||
| 349 | |||
| 350 | **Test 6: Git Repository (Success)** | ||
| 351 | ```bash | ||
| 352 | # Create test repo | ||
| 353 | mkdir -p ./data/repos/npub1test | ||
| 354 | cd ./data/repos/npub1test | ||
| 355 | git init --bare test-repo.git | ||
| 356 | |||
| 357 | # Try to access it | ||
| 358 | curl -v http://localhost:8080/npub1test/test-repo.git/info/refs?service=git-upload-pack | ||
| 359 | ``` | ||
| 360 | |||
| 361 | **Expected:** | ||
| 362 | - Status: 200 OK | ||
| 363 | - Content-Type: application/x-git-upload-pack-advertisement | ||
| 364 | - CORS headers present | ||
| 365 | - Git protocol data | ||
| 366 | |||
| 367 | --- | ||
| 368 | |||
| 369 | **Test 7: Git Clone** | ||
| 370 | ```bash | ||
| 371 | git clone http://localhost:8080/npub1test/test-repo.git /tmp/test-clone | ||
| 372 | ``` | ||
| 373 | |||
| 374 | **Expected:** | ||
| 375 | - Clone succeeds (even if empty repo) | ||
| 376 | - No errors | ||
| 377 | |||
| 378 | --- | ||
| 379 | |||
| 380 | **Test 8: CORS Preflight** | ||
| 381 | ```bash | ||
| 382 | curl -v -X OPTIONS http://localhost:8080/ \ | ||
| 383 | -H "Origin: https://example.com" \ | ||
| 384 | -H "Access-Control-Request-Method: POST" | ||
| 385 | ``` | ||
| 386 | |||
| 387 | **Expected:** | ||
| 388 | - Status: 204 No Content | ||
| 389 | - Access-Control-Allow-Origin: * | ||
| 390 | - Access-Control-Allow-Methods: GET, POST | ||
| 391 | - Access-Control-Allow-Headers: Content-Type | ||
| 392 | - Access-Control-Max-Age: 3600 | ||
| 393 | |||
| 394 | --- | ||
| 395 | |||
| 396 | ### 5.2 Automated Testing | ||
| 397 | |||
| 398 | **Run All Tests:** | ||
| 399 | ```bash | ||
| 400 | # Build first | ||
| 401 | cargo build | ||
| 402 | |||
| 403 | # Run all tests | ||
| 404 | cargo test | ||
| 405 | |||
| 406 | # Run specific test suites | ||
| 407 | cargo test --test nip01_compliance | ||
| 408 | cargo test --test grasp01_git_http | ||
| 409 | |||
| 410 | # With output | ||
| 411 | cargo test -- --nocapture | ||
| 412 | ``` | ||
| 413 | |||
| 414 | **Expected:** All tests pass | ||
| 415 | |||
| 416 | --- | ||
| 417 | |||
| 418 | ### 5.3 Performance Testing | ||
| 419 | |||
| 420 | **Test Concurrent Connections:** | ||
| 421 | ```bash | ||
| 422 | # Start server | ||
| 423 | cargo run & | ||
| 424 | |||
| 425 | # Run multiple clients | ||
| 426 | for i in {1..10}; do | ||
| 427 | (cd grasp-audit && cargo run -- --url ws://localhost:8080) & | ||
| 428 | done | ||
| 429 | |||
| 430 | # Wait for all to complete | ||
| 431 | wait | ||
| 432 | ``` | ||
| 433 | |||
| 434 | **Expected:** All clients connect and pass tests | ||
| 435 | |||
| 436 | --- | ||
| 437 | |||
| 438 | ### 5.4 Error Handling Testing | ||
| 439 | |||
| 440 | **Test 1: Invalid Repository Path** | ||
| 441 | ```bash | ||
| 442 | curl -v http://localhost:8080/invalid/path | ||
| 443 | ``` | ||
| 444 | |||
| 445 | **Expected:** 404 or appropriate error | ||
| 446 | |||
| 447 | --- | ||
| 448 | |||
| 449 | **Test 2: Invalid WebSocket Message** | ||
| 450 | ```bash | ||
| 451 | # Use websocat or similar | ||
| 452 | echo "invalid json" | websocat ws://localhost:8080/ | ||
| 453 | ``` | ||
| 454 | |||
| 455 | **Expected:** NOTICE message with error | ||
| 456 | |||
| 457 | --- | ||
| 458 | |||
| 459 | **Test 3: Large Git Push** | ||
| 460 | ```bash | ||
| 461 | # Create repo with large files | ||
| 462 | # Try to push | ||
| 463 | # Verify it works or fails gracefully | ||
| 464 | ``` | ||
| 465 | |||
| 466 | --- | ||
| 467 | |||
| 468 | ## 📋 Acceptance Criteria | ||
| 469 | |||
| 470 | ### Must Have (MVP) | ||
| 471 | |||
| 472 | - [ ] Server starts on single port | ||
| 473 | - [ ] WebSocket connects at `/` | ||
| 474 | - [ ] NIP-01 smoke tests pass | ||
| 475 | - [ ] Can access Git repo at `/<npub>/<id>.git` | ||
| 476 | - [ ] Returns 404 for missing repos | ||
| 477 | - [ ] CORS headers on all responses | ||
| 478 | - [ ] OPTIONS requests return 204 | ||
| 479 | - [ ] Can clone existing Git repository | ||
| 480 | - [ ] All integration tests pass | ||
| 481 | |||
| 482 | ### Should Have (Before Production) | ||
| 483 | |||
| 484 | - [ ] Can push to repository (basic, no auth yet) | ||
| 485 | - [ ] Repository provisioned from announcement | ||
| 486 | - [ ] NIP-11 includes GRASP fields | ||
| 487 | - [ ] Proper error messages | ||
| 488 | - [ ] Logging works correctly | ||
| 489 | - [ ] Clean shutdown | ||
| 490 | - [ ] Test data cleanup | ||
| 491 | |||
| 492 | ### Could Have (Future) | ||
| 493 | |||
| 494 | - [ ] Push authorization | ||
| 495 | - [ ] Maintainer set validation | ||
| 496 | - [ ] PR ref support | ||
| 497 | - [ ] State synchronization | ||
| 498 | - [ ] Proactive sync (GRASP-02) | ||
| 499 | |||
| 500 | --- | ||
| 501 | |||
| 502 | ## 🐛 Known Issues to Watch For | ||
| 503 | |||
| 504 | ### Issue 1: WebSocket Upgrade Timing | ||
| 505 | |||
| 506 | **Symptom:** WebSocket upgrade fails intermittently | ||
| 507 | |||
| 508 | **Debug:** | ||
| 509 | ```bash | ||
| 510 | RUST_LOG=debug cargo run | ||
| 511 | # Check for upgrade-related logs | ||
| 512 | ``` | ||
| 513 | |||
| 514 | **Solution:** Ensure actix-ws is configured correctly | ||
| 515 | |||
| 516 | --- | ||
| 517 | |||
| 518 | ### Issue 2: Git HTTP Protocol Errors | ||
| 519 | |||
| 520 | **Symptom:** Git clone fails with protocol error | ||
| 521 | |||
| 522 | **Debug:** | ||
| 523 | ```bash | ||
| 524 | GIT_TRACE_PACKET=1 git clone http://localhost:8080/... | ||
| 525 | # Shows Git protocol messages | ||
| 526 | ``` | ||
| 527 | |||
| 528 | **Solution:** Check git-http-backend configuration | ||
| 529 | |||
| 530 | --- | ||
| 531 | |||
| 532 | ### Issue 3: CORS Not Applied | ||
| 533 | |||
| 534 | **Symptom:** Browser shows CORS error | ||
| 535 | |||
| 536 | **Debug:** | ||
| 537 | ```bash | ||
| 538 | curl -v http://localhost:8080/ -H "Origin: https://example.com" | ||
| 539 | # Check response headers | ||
| 540 | ``` | ||
| 541 | |||
| 542 | **Solution:** Verify CORS middleware is first in chain | ||
| 543 | |||
| 544 | --- | ||
| 545 | |||
| 546 | ### Issue 4: Port Already in Use | ||
| 547 | |||
| 548 | **Symptom:** "Address already in use" error | ||
| 549 | |||
| 550 | **Debug:** | ||
| 551 | ```bash | ||
| 552 | lsof -i :8080 | ||
| 553 | # Find process using port | ||
| 554 | ``` | ||
| 555 | |||
| 556 | **Solution:** | ||
| 557 | ```bash | ||
| 558 | kill -9 <PID> | ||
| 559 | # Or use different port | ||
| 560 | ``` | ||
| 561 | |||
| 562 | --- | ||
| 563 | |||
| 564 | ### Issue 5: Test Relay Won't Start | ||
| 565 | |||
| 566 | **Symptom:** Integration tests fail to start relay | ||
| 567 | |||
| 568 | **Debug:** | ||
| 569 | ```bash | ||
| 570 | # Run test with output | ||
| 571 | cargo test --test nip01_compliance -- --nocapture | ||
| 572 | |||
| 573 | # Check binary exists | ||
| 574 | ls -la target/debug/ngit-grasp | ||
| 575 | ``` | ||
| 576 | |||
| 577 | **Solution:** Run `cargo build` before tests | ||
| 578 | |||
| 579 | --- | ||
| 580 | |||
| 581 | ## 📚 Reference Commands | ||
| 582 | |||
| 583 | ### Development | ||
| 584 | |||
| 585 | ```bash | ||
| 586 | # Build | ||
| 587 | cargo build | ||
| 588 | |||
| 589 | # Run | ||
| 590 | cargo run | ||
| 591 | |||
| 592 | # Run with logging | ||
| 593 | RUST_LOG=debug cargo run | ||
| 594 | |||
| 595 | # Check without building | ||
| 596 | cargo check | ||
| 597 | |||
| 598 | # Format code | ||
| 599 | cargo fmt | ||
| 600 | |||
| 601 | # Lint | ||
| 602 | cargo clippy | ||
| 603 | ``` | ||
| 604 | |||
| 605 | ### Testing | ||
| 606 | |||
| 607 | ```bash | ||
| 608 | # All tests | ||
| 609 | cargo test | ||
| 610 | |||
| 611 | # Specific test file | ||
| 612 | cargo test --test nip01_compliance | ||
| 613 | |||
| 614 | # Specific test | ||
| 615 | cargo test --test nip01_compliance test_nip01_smoke | ||
| 616 | |||
| 617 | # With output | ||
| 618 | cargo test -- --nocapture | ||
| 619 | |||
| 620 | # With logging | ||
| 621 | RUST_LOG=debug cargo test -- --nocapture | ||
| 622 | ``` | ||
| 623 | |||
| 624 | ### Debugging | ||
| 625 | |||
| 626 | ```bash | ||
| 627 | # Check dependencies | ||
| 628 | cargo tree | ||
| 629 | |||
| 630 | # Check for unused dependencies | ||
| 631 | cargo +nightly udeps | ||
| 632 | |||
| 633 | # Check for outdated dependencies | ||
| 634 | cargo outdated | ||
| 635 | |||
| 636 | # Audit for security issues | ||
| 637 | cargo audit | ||
| 638 | ``` | ||
| 639 | |||
| 640 | ### Git Testing | ||
| 641 | |||
| 642 | ```bash | ||
| 643 | # Create test repo | ||
| 644 | mkdir -p ./data/repos/npub1test | ||
| 645 | cd ./data/repos/npub1test | ||
| 646 | git init --bare test-repo.git | ||
| 647 | |||
| 648 | # Clone it | ||
| 649 | git clone http://localhost:8080/npub1test/test-repo.git /tmp/test | ||
| 650 | |||
| 651 | # Push to it | ||
| 652 | cd /tmp/test | ||
| 653 | echo "test" > README.md | ||
| 654 | git add . | ||
| 655 | git commit -m "test" | ||
| 656 | git push origin main | ||
| 657 | ``` | ||
| 658 | |||
| 659 | --- | ||
| 660 | |||
| 661 | ## ✅ Completion Checklist | ||
| 662 | |||
| 663 | When all items are checked, Phase 1 (actix-web integration) is complete: | ||
| 664 | |||
| 665 | ### Code | ||
| 666 | |||
| 667 | - [ ] Dependencies added to Cargo.toml | ||
| 668 | - [ ] src/http/mod.rs created | ||
| 669 | - [ ] src/http/git.rs created | ||
| 670 | - [ ] src/http/nostr.rs created | ||
| 671 | - [ ] src/main.rs updated | ||
| 672 | - [ ] src/config.rs verified | ||
| 673 | - [ ] Relay logic refactored | ||
| 674 | |||
| 675 | ### Tests | ||
| 676 | |||
| 677 | - [ ] tests/common/relay.rs updated | ||
| 678 | - [ ] tests/grasp01_git_http.rs created | ||
| 679 | - [ ] tests/nip01_compliance.rs still passes | ||
| 680 | - [ ] All tests pass | ||
| 681 | |||
| 682 | ### Manual Testing | ||
| 683 | |||
| 684 | - [ ] Server starts successfully | ||
| 685 | - [ ] WebSocket connects | ||
| 686 | - [ ] NIP-01 smoke tests pass | ||
| 687 | - [ ] Can access Git repos | ||
| 688 | - [ ] 404 for missing repos | ||
| 689 | - [ ] CORS headers present | ||
| 690 | - [ ] OPTIONS requests work | ||
| 691 | - [ ] Can clone repository | ||
| 692 | |||
| 693 | ### Documentation | ||
| 694 | |||
| 695 | - [ ] Update README.md status | ||
| 696 | - [ ] Update work/current_status.md | ||
| 697 | - [ ] Document any issues found | ||
| 698 | - [ ] Update NEXT_SESSION_START_HERE.md for next phase | ||
| 699 | |||
| 700 | --- | ||
| 701 | |||
| 702 | ## 🎯 Next Phase Preview | ||
| 703 | |||
| 704 | After actix-web integration is complete, next phase will be: | ||
| 705 | |||
| 706 | **Phase 2: Repository Provisioning** | ||
| 707 | |||
| 708 | - Listen for NIP-34 repository announcements | ||
| 709 | - Create Git repositories automatically | ||
| 710 | - Initialize bare repositories | ||
| 711 | - Set up directory structure | ||
| 712 | - Handle repository deletion | ||
| 713 | |||
| 714 | **Estimated Time:** 2-3 hours | ||
| 715 | **Prerequisites:** Phase 1 complete | ||
| 716 | |||
| 717 | --- | ||
| 718 | |||
| 719 | **Last Updated:** November 4, 2025 | ||
| 720 | **Status:** Ready to begin Phase 1 | ||