cyclecad 3.2.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CLAUDE.md +155 -1
  2. package/DOCKER-SETUP-VERIFICATION.md +399 -0
  3. package/DOCKER-TESTING.md +463 -0
  4. package/FUSION360_MODULES.md +478 -0
  5. package/FUSION_MODULES_README.md +352 -0
  6. package/INTEGRATION_SNIPPETS.md +608 -0
  7. package/KILLER-FEATURES-DELIVERY.md +469 -0
  8. package/MODULES_SUMMARY.txt +337 -0
  9. package/QUICK_REFERENCE.txt +298 -0
  10. package/README-DOCKER-TESTING.txt +438 -0
  11. package/app/index.html +23 -10
  12. package/app/js/fusion-help.json +1808 -0
  13. package/app/js/help-module-v3.js +1096 -0
  14. package/app/js/killer-features-help.json +395 -0
  15. package/app/js/killer-features.js +1508 -0
  16. package/app/js/modules/fusion-assembly.js +842 -0
  17. package/app/js/modules/fusion-cam.js +785 -0
  18. package/app/js/modules/fusion-data.js +814 -0
  19. package/app/js/modules/fusion-drawing.js +844 -0
  20. package/app/js/modules/fusion-inspection.js +756 -0
  21. package/app/js/modules/fusion-render.js +774 -0
  22. package/app/js/modules/fusion-simulation.js +986 -0
  23. package/app/js/modules/fusion-sketch.js +1044 -0
  24. package/app/js/modules/fusion-solid.js +1095 -0
  25. package/app/js/modules/fusion-surface.js +949 -0
  26. package/app/tests/FUSION_TEST_SUITE.md +266 -0
  27. package/app/tests/README.md +77 -0
  28. package/app/tests/TESTING-CHECKLIST.md +177 -0
  29. package/app/tests/TEST_SUITE_SUMMARY.txt +236 -0
  30. package/app/tests/brep-live-test.html +848 -0
  31. package/app/tests/docker-integration-test.html +811 -0
  32. package/app/tests/fusion-all-tests.html +670 -0
  33. package/app/tests/fusion-assembly-tests.html +461 -0
  34. package/app/tests/fusion-cam-tests.html +421 -0
  35. package/app/tests/fusion-simulation-tests.html +421 -0
  36. package/app/tests/fusion-sketch-tests.html +613 -0
  37. package/app/tests/fusion-solid-tests.html +529 -0
  38. package/app/tests/index.html +453 -0
  39. package/app/tests/killer-features-test.html +509 -0
  40. package/app/tests/run-tests.html +874 -0
  41. package/app/tests/step-import-live-test.html +1115 -0
  42. package/app/tests/test-agent-v3.html +93 -696
  43. package/architecture-dashboard.html +1970 -0
  44. package/docs/API-REFERENCE.md +1423 -0
  45. package/docs/BREP-LIVE-TEST-GUIDE.md +453 -0
  46. package/docs/DEVELOPER-GUIDE-v3.md +795 -0
  47. package/docs/DOCKER-QUICK-TEST.md +376 -0
  48. package/docs/FUSION-FEATURES-GUIDE.md +2513 -0
  49. package/docs/FUSION-TUTORIAL.md +1203 -0
  50. package/docs/INFRASTRUCTURE-GUIDE-INDEX.md +327 -0
  51. package/docs/KEYBOARD-SHORTCUTS.md +402 -0
  52. package/docs/KILLER-FEATURES-INTEGRATION.md +412 -0
  53. package/docs/KILLER-FEATURES-SUMMARY.md +424 -0
  54. package/docs/KILLER-FEATURES-TUTORIAL.md +784 -0
  55. package/docs/KILLER-FEATURES.md +562 -0
  56. package/docs/QUICK-REFERENCE.md +282 -0
  57. package/docs/README-v3-DOCS.md +274 -0
  58. package/docs/TUTORIAL-v3.md +1190 -0
  59. package/docs/architecture-dashboard.html +1970 -0
  60. package/docs/architecture-v3.html +1038 -0
  61. package/linkedin-post-v3.md +58 -0
  62. package/package.json +1 -1
  63. package/scripts/dev-setup.sh +338 -0
  64. package/scripts/docker-health-check.sh +159 -0
  65. package/scripts/integration-test.sh +311 -0
  66. package/scripts/test-docker.sh +515 -0
@@ -0,0 +1,463 @@
1
+ # cycleCAD Docker Testing Infrastructure
2
+
3
+ Comprehensive testing scripts and utilities for the cycleCAD multi-service Docker deployment.
4
+
5
+ ## Overview
6
+
7
+ This testing infrastructure provides three complementary approaches to validate Docker services:
8
+
9
+ 1. **Bash Health Check Script** — Quick CLI verification of service health
10
+ 2. **Bash Integration Test Suite** — Comprehensive automated testing with JUnit XML output
11
+ 3. **Browser Test Page** — Interactive visual testing with real-time status monitoring
12
+
13
+ ## Quick Start
14
+
15
+ ### Run a Quick Health Check
16
+
17
+ ```bash
18
+ ./scripts/docker-health-check.sh
19
+ ```
20
+
21
+ Output shows all services with status indicators:
22
+ ```
23
+ ✓ cyclecad (OK)
24
+ ✓ converter (OK)
25
+ ✓ signaling (OK)
26
+ ```
27
+
28
+ ### Run Full Integration Tests
29
+
30
+ ```bash
31
+ ./scripts/integration-test.sh
32
+ ```
33
+
34
+ Automatically:
35
+ 1. Starts Docker Compose services
36
+ 2. Waits for all services to become healthy
37
+ 3. Runs 20+ integration tests
38
+ 4. Generates JUnit XML results
39
+ 5. Stops services (cleanup)
40
+
41
+ ### Open Browser Test Page
42
+
43
+ 1. Start Docker services: `docker-compose up -d`
44
+ 2. Open browser: http://localhost:8080/app/tests/docker-integration-test.html
45
+ 3. Click "Run All Tests" to execute comprehensive test suite
46
+ 4. Export results as JSON or HTML
47
+
48
+ ## Services Being Tested
49
+
50
+ | Service | Port | Role | Health Endpoint |
51
+ |---------|------|------|-----------------|
52
+ | cyclecad | 8080 | Main web app (nginx) | GET /health |
53
+ | converter | 8787 | STEP→GLB conversion (FastAPI) | GET /health |
54
+ | signaling | 8788 | WebSocket signaling (Node.js) | GET /health |
55
+
56
+ ## Test Categories
57
+
58
+ ### 1. Health Checks
59
+ - Service availability
60
+ - Health endpoint responsiveness
61
+ - Response timeout handling
62
+
63
+ ### 2. Headers & Security
64
+ - CORS headers (Access-Control-Allow-*)
65
+ - COOP/COEP headers (Cross-Origin policies)
66
+ - Security headers (CSP, X-Frame-Options, etc.)
67
+ - Gzip compression
68
+
69
+ ### 3. Static Content
70
+ - HTML file serving
71
+ - JavaScript/CSS asset loading
72
+ - Cache-Control headers
73
+ - WASM file handling
74
+
75
+ ### 4. API Endpoints
76
+ - `/health` endpoint JSON response
77
+ - `/api/` routes via proxy
78
+ - `/converter/` routes via proxy
79
+ - Content-Type validation
80
+
81
+ ### 5. SPA Routing
82
+ - Fallback to index.html for unknown routes
83
+ - App routing (trailing slash handling)
84
+ - 404 handling for static files
85
+
86
+ ### 6. WebSocket
87
+ - WebSocket upgrade negotiation
88
+ - Connection establishment
89
+ - Long-running connections
90
+
91
+ ### 7. STEP Converter
92
+ - Converter service health
93
+ - Conversion endpoint availability
94
+ - File upload handling
95
+
96
+ ### 8. Proxy Routing
97
+ - nginx proxy to converter service
98
+ - nginx proxy to signaling service
99
+ - Header forwarding
100
+ - Timeout handling
101
+
102
+ ## Script Details
103
+
104
+ ### docker-health-check.sh
105
+
106
+ Quick CLI health check of all services.
107
+
108
+ **Usage:**
109
+ ```bash
110
+ ./scripts/docker-health-check.sh [OPTIONS]
111
+
112
+ OPTIONS:
113
+ --verbose Show detailed response data
114
+ --timeout N Wait up to N seconds per service (default: 30)
115
+ ```
116
+
117
+ **Output:**
118
+ - Color-coded service status (✓ green, ✗ red)
119
+ - Response timing
120
+ - JSON health responses (with --verbose)
121
+ - Exit code 0 for all healthy, 1 for failures
122
+
123
+ **Example Output:**
124
+ ```
125
+ === cycleCAD Docker Health Check ===
126
+ Timeout: 30s, Interval: 5s
127
+
128
+ Checking cyclecad... OK
129
+ └─ Response: {"status":"ok","app":"cyclecad","version":"0.8.6","timestamp":"1711869600"}
130
+ Checking converter... OK
131
+ Checking signaling... OK
132
+
133
+ === Summary ===
134
+ Healthy: 3
135
+ Unhealthy: 0
136
+
137
+ All services healthy!
138
+ ```
139
+
140
+ ### integration-test.sh
141
+
142
+ Comprehensive automated test suite with full lifecycle management.
143
+
144
+ **Usage:**
145
+ ```bash
146
+ ./scripts/integration-test.sh [OPTIONS]
147
+
148
+ OPTIONS:
149
+ --no-cleanup Keep services running after tests
150
+ --output FILE Write JUnit XML results to FILE (default: test-results.xml)
151
+ ```
152
+
153
+ **Lifecycle:**
154
+ 1. Checks Docker availability
155
+ 2. Starts docker-compose (detached)
156
+ 3. Waits up to 120s for all services to be healthy
157
+ 4. Runs 20+ integration tests
158
+ 5. Generates JUnit XML report
159
+ 6. Stops services (unless --no-cleanup)
160
+
161
+ **Tests Include:**
162
+ - Health endpoints (3 tests)
163
+ - CORS headers (2 tests)
164
+ - Static content serving (2 tests)
165
+ - Cache headers (2 tests)
166
+ - Converter endpoints (2 tests)
167
+ - Signaling endpoints (1 test)
168
+ - Proxy routing (2 tests)
169
+ - SPA routing (2 tests)
170
+ - Gzip compression (2 tests)
171
+ - WebSocket upgrade (1 test)
172
+
173
+ **Output:**
174
+ ```
175
+ === cycleCAD Docker Integration Test Suite ===
176
+ Starting Docker Compose services...
177
+ Waiting for services to be healthy...
178
+ All services healthy
179
+
180
+ Running integration tests...
181
+
182
+ ✓ GET /health (main app) (156ms)
183
+ ✓ GET /health (converter) (234ms)
184
+ ✓ GET /health (signaling) (89ms)
185
+ ...
186
+
187
+ === Test Summary ===
188
+ Total: 20
189
+ Passed: 19
190
+ Failed: 1
191
+
192
+ Results written to: test-results.xml
193
+ ```
194
+
195
+ **JUnit XML Format:**
196
+ ```xml
197
+ <?xml version="1.0" encoding="UTF-8"?>
198
+ <testsuites name="cycleCAD Docker Integration Tests" tests="20" failures="1" time="2500">
199
+ <testsuite name="Docker Services" tests="20" failures="1" time="2500">
200
+ <testcase name="GET /health (main app)" time="156"/>
201
+ <testcase name="GET /health (converter)" time="234">
202
+ <failure>Connection refused</failure>
203
+ </testcase>
204
+ ...
205
+ </testsuite>
206
+ </testsuites>
207
+ ```
208
+
209
+ ### docker-integration-test.html
210
+
211
+ Interactive browser-based test page with real-time visualization.
212
+
213
+ **Access:**
214
+ 1. Start services: `docker-compose up -d`
215
+ 2. Open: http://localhost:8080/app/tests/docker-integration-test.html
216
+ 3. Browser auto-loads and runs quick health check on page load
217
+
218
+ **Features:**
219
+ - Real-time status updates with visual indicators
220
+ - Live test execution with progress
221
+ - Color-coded results (green pass, red fail, yellow pending)
222
+ - Statistics dashboard (total, passed, failed, success rate)
223
+ - Export capabilities:
224
+ - **Export as JSON** — Machine-readable test results
225
+ - **Export as HTML** — Standalone report page
226
+ - **Copy to Clipboard** — Paste into docs/issues
227
+
228
+ **Test Buttons:**
229
+ - **Run All Tests** — Execute complete 25+ test suite
230
+ - **Quick Health Check** — Just service status (30s)
231
+ - **Clear Results** — Reset all test output
232
+
233
+ **Test Suites:**
234
+ 1. Service Status — Direct connectivity to services
235
+ 2. Headers & Security — CORS, COOP, COEP, gzip
236
+ 3. Endpoint Tests — /health, /api/, /converter/
237
+ 4. Proxy Routing — nginx proxy validation
238
+ 5. WebSocket & Real-time — WS connection tests
239
+ 6. STEP Converter — Converter-specific endpoints
240
+
241
+ **Visual Indicators:**
242
+ - Green (✓) — Test passed
243
+ - Red (✗) — Test failed
244
+ - Yellow (●) — Test pending/loading
245
+ - Colored boxes — Service status cards
246
+
247
+ ## nginx.conf Validation
248
+
249
+ The nginx configuration at `/sessions/sharp-modest-allen/mnt/cyclecad/nginx.conf` includes:
250
+
251
+ ### Security Headers
252
+ - ✓ `Cross-Origin-Opener-Policy: same-origin`
253
+ - ✓ `Cross-Origin-Embedder-Policy: require-corp`
254
+ - ✓ `X-Content-Type-Options: nosniff`
255
+ - ✓ `X-Frame-Options: SAMEORIGIN`
256
+ - ✓ Content Security Policy with CDN allowlist
257
+
258
+ ### CORS
259
+ - ✓ `Access-Control-Allow-Origin: *`
260
+ - ✓ `Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE, PATCH`
261
+ - ✓ `Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With, X-API-Key`
262
+
263
+ ### Compression
264
+ - ✓ Gzip enabled for 15+ content types
265
+ - ✓ Compression level 6 (balanced)
266
+ - ✓ Applies to JS, CSS, JSON, WASM, SVG, glTF
267
+
268
+ ### Caching
269
+ - ✓ **Immutable assets** (1 year): .js, .css, .wasm, .ttf, .woff, .eot
270
+ - ✓ **3D models** (7 days): .glb, .gltf, .stl, .obj
271
+ - ✓ **Documents** (7 days): .pptx, .docx, .xlsx, .pdf
272
+ - ✓ **HTML** (no cache): Always validate
273
+ - ✓ **JSON** (5 min): Manifest files
274
+ - ✓ **Service Worker** (no cache): Always fresh
275
+
276
+ ### Routing
277
+ - ✓ Health endpoint at `/health`
278
+ - ✓ API proxy: `/api/` → converter:8787
279
+ - ✓ Converter proxy: `/converter/` → converter:8787
280
+ - ✓ WebSocket proxy: `/ws/` → signaling:8788
281
+ - ✓ Signaling proxy: `/signal/` → signaling:8788
282
+ - ✓ SPA fallback: `/app/` → index.html
283
+ - ✓ Root fallback: `/` → index.html
284
+ - ✓ Max upload: 500M (STEP files)
285
+
286
+ ### Client Limits
287
+ - ✓ Max upload size: 500MB (for large STEP files)
288
+ - ✓ Gzip min length: 500 bytes
289
+ - ✓ Proxy timeouts: 300s (converter), 3600s (signaling)
290
+
291
+ ## Common Issues & Solutions
292
+
293
+ ### "Docker not found"
294
+ **Problem:** docker or docker-compose not installed
295
+ **Solution:** Install Docker Desktop or Docker Engine from docker.com
296
+
297
+ ### "Services did not become healthy"
298
+ **Problem:** Services take too long to start
299
+ **Solution:** Run with increased timeout:
300
+ ```bash
301
+ ./scripts/docker-health-check.sh --timeout 60
302
+ ```
303
+
304
+ ### "Connection refused" in tests
305
+ **Problem:** Services started but not listening yet
306
+ **Solution:** Wait longer before testing:
307
+ ```bash
308
+ sleep 10
309
+ ./scripts/docker-health-check.sh
310
+ ```
311
+
312
+ ### "WebSocket timeout" in browser test
313
+ **Problem:** WebSocket endpoint not accessible from browser origin
314
+ **Solution:** Check nginx configuration routing at `/ws/` and `/signal/`
315
+
316
+ ### "CORS errors in browser console"
317
+ **Problem:** Browser test page can't access converter service
318
+ **Solution:** Verify nginx CORS headers:
319
+ ```bash
320
+ curl -H "Origin: http://localhost:8080" http://localhost:8080/converter/health -i
321
+ ```
322
+
323
+ ## Integration with CI/CD
324
+
325
+ ### GitHub Actions Example
326
+
327
+ ```yaml
328
+ name: Docker Tests
329
+
330
+ on: [push]
331
+
332
+ jobs:
333
+ docker-tests:
334
+ runs-on: ubuntu-latest
335
+ steps:
336
+ - uses: actions/checkout@v3
337
+ - name: Install Docker
338
+ uses: docker/setup-buildx-action@v2
339
+ - name: Run integration tests
340
+ run: ./scripts/integration-test.sh --output test-results.xml
341
+ - name: Upload test results
342
+ uses: actions/upload-artifact@v3
343
+ with:
344
+ name: test-results
345
+ path: test-results.xml
346
+ ```
347
+
348
+ ### Pre-deployment Checklist
349
+
350
+ Before deploying to production:
351
+
352
+ 1. Run health check:
353
+ ```bash
354
+ ./scripts/docker-health-check.sh --verbose
355
+ ```
356
+
357
+ 2. Run integration tests:
358
+ ```bash
359
+ ./scripts/integration-test.sh
360
+ ```
361
+
362
+ 3. Open browser test page and verify all pass
363
+
364
+ 4. Check nginx config:
365
+ ```bash
366
+ docker-compose exec cyclecad nginx -t
367
+ ```
368
+
369
+ 5. Monitor logs:
370
+ ```bash
371
+ docker-compose logs -f
372
+ ```
373
+
374
+ ## Performance Benchmarking
375
+
376
+ Test execution times (on healthy system):
377
+
378
+ | Test | Time |
379
+ |------|------|
380
+ | Health check | 3-5s |
381
+ | Quick health check (browser) | 5-10s |
382
+ | Full integration test suite | 30-60s |
383
+ | Full browser test suite | 2-5 min |
384
+
385
+ Expected service startup times:
386
+
387
+ | Service | First Start | Subsequent |
388
+ |---------|------------|------------|
389
+ | cyclecad | 5-10s | 2-3s |
390
+ | converter | 15-20s | 5-10s |
391
+ | signaling | 3-5s | 1-2s |
392
+
393
+ ## Testing Best Practices
394
+
395
+ 1. **Always cleanup:** Run integration tests without `--no-cleanup` to avoid port conflicts
396
+ 2. **Check logs:** If test fails, inspect logs with `docker-compose logs -f SERVICE_NAME`
397
+ 3. **Isolate issues:** Use health-check script first, then integration tests
398
+ 4. **Browser tests last:** Use CLI tests first; browser tests are for validation only
399
+ 5. **Export results:** Export test results for CI/CD and reporting
400
+ 6. **Monitor services:** Keep `docker-compose logs -f` running during testing
401
+
402
+ ## Troubleshooting
403
+
404
+ ### View detailed logs:
405
+ ```bash
406
+ docker-compose logs -f cyclecad
407
+ docker-compose logs -f converter
408
+ docker-compose logs -f signaling
409
+ ```
410
+
411
+ ### Restart specific service:
412
+ ```bash
413
+ docker-compose restart converter
414
+ ```
415
+
416
+ ### Force rebuild:
417
+ ```bash
418
+ docker-compose down -v
419
+ docker-compose up --build -d
420
+ ```
421
+
422
+ ### Check service status:
423
+ ```bash
424
+ docker-compose ps
425
+ docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
426
+ ```
427
+
428
+ ### Test endpoint directly:
429
+ ```bash
430
+ curl -v http://localhost:8080/health
431
+ curl -v http://localhost:8787/health
432
+ curl -v http://localhost:8788/health
433
+ ```
434
+
435
+ ## File Locations
436
+
437
+ ```
438
+ /sessions/sharp-modest-allen/mnt/cyclecad/
439
+ ├── docker-compose.yml # Docker service definitions
440
+ ├── Dockerfile # Main app container
441
+ ├── nginx.conf # nginx routing & headers
442
+ ├── server/
443
+ │ ├── Dockerfile.converter # Converter service container
444
+ │ ├── Dockerfile.signaling # Signaling service container
445
+ │ ├── converter.py # STEP→GLB FastAPI server
446
+ │ └── signaling-server.js # WebSocket signaling server
447
+ ├── scripts/
448
+ │ ├── docker-health-check.sh # Quick health check CLI
449
+ │ └── integration-test.sh # Full test suite with cleanup
450
+ ├── app/
451
+ │ └── tests/
452
+ │ └── docker-integration-test.html # Browser-based test page
453
+ └── DOCKER-TESTING.md # This file
454
+ ```
455
+
456
+ ## References
457
+
458
+ - [Docker Documentation](https://docs.docker.com/)
459
+ - [nginx Documentation](https://nginx.org/en/docs/)
460
+ - [FastAPI Health Checks](https://fastapi.tiangolo.com/)
461
+ - [Docker Compose Health Checks](https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheck)
462
+ - [Cross-Origin Resource Sharing](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
463
+ - [JUnit XML Format](https://github.com/junit-team/junit5/blob/main/platform-tests/src/test/resources/junit-platform-suite-engine/JUnit4SampleTest-result.xml)