tasker-rb 0.1.1

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 (78) hide show
  1. checksums.yaml +7 -0
  2. data/DEVELOPMENT.md +548 -0
  3. data/README.md +87 -0
  4. data/ext/tasker_core/Cargo.lock +4720 -0
  5. data/ext/tasker_core/Cargo.toml +76 -0
  6. data/ext/tasker_core/extconf.rb +38 -0
  7. data/ext/tasker_core/src/CLAUDE.md +7 -0
  8. data/ext/tasker_core/src/bootstrap.rs +320 -0
  9. data/ext/tasker_core/src/bridge.rs +400 -0
  10. data/ext/tasker_core/src/client_ffi.rs +173 -0
  11. data/ext/tasker_core/src/conversions.rs +131 -0
  12. data/ext/tasker_core/src/diagnostics.rs +57 -0
  13. data/ext/tasker_core/src/event_handler.rs +179 -0
  14. data/ext/tasker_core/src/event_publisher_ffi.rs +239 -0
  15. data/ext/tasker_core/src/ffi_logging.rs +245 -0
  16. data/ext/tasker_core/src/global_event_system.rs +16 -0
  17. data/ext/tasker_core/src/in_process_event_ffi.rs +319 -0
  18. data/ext/tasker_core/src/lib.rs +41 -0
  19. data/ext/tasker_core/src/observability_ffi.rs +339 -0
  20. data/lib/tasker_core/batch_processing/batch_aggregation_scenario.rb +85 -0
  21. data/lib/tasker_core/batch_processing/batch_worker_context.rb +238 -0
  22. data/lib/tasker_core/bootstrap.rb +394 -0
  23. data/lib/tasker_core/domain_events/base_publisher.rb +220 -0
  24. data/lib/tasker_core/domain_events/base_subscriber.rb +178 -0
  25. data/lib/tasker_core/domain_events/publisher_registry.rb +253 -0
  26. data/lib/tasker_core/domain_events/subscriber_registry.rb +152 -0
  27. data/lib/tasker_core/domain_events.rb +43 -0
  28. data/lib/tasker_core/errors/CLAUDE.md +7 -0
  29. data/lib/tasker_core/errors/common.rb +305 -0
  30. data/lib/tasker_core/errors/error_classifier.rb +61 -0
  31. data/lib/tasker_core/errors.rb +4 -0
  32. data/lib/tasker_core/event_bridge.rb +330 -0
  33. data/lib/tasker_core/handlers.rb +159 -0
  34. data/lib/tasker_core/internal.rb +31 -0
  35. data/lib/tasker_core/logger.rb +234 -0
  36. data/lib/tasker_core/models.rb +337 -0
  37. data/lib/tasker_core/observability/types.rb +158 -0
  38. data/lib/tasker_core/observability.rb +292 -0
  39. data/lib/tasker_core/registry/handler_registry.rb +453 -0
  40. data/lib/tasker_core/registry/resolver_chain.rb +258 -0
  41. data/lib/tasker_core/registry/resolvers/base_resolver.rb +90 -0
  42. data/lib/tasker_core/registry/resolvers/class_constant_resolver.rb +156 -0
  43. data/lib/tasker_core/registry/resolvers/explicit_mapping_resolver.rb +146 -0
  44. data/lib/tasker_core/registry/resolvers/method_dispatch_wrapper.rb +144 -0
  45. data/lib/tasker_core/registry/resolvers/registry_resolver.rb +229 -0
  46. data/lib/tasker_core/registry/resolvers.rb +42 -0
  47. data/lib/tasker_core/registry.rb +12 -0
  48. data/lib/tasker_core/step_handler/api.rb +48 -0
  49. data/lib/tasker_core/step_handler/base.rb +354 -0
  50. data/lib/tasker_core/step_handler/batchable.rb +50 -0
  51. data/lib/tasker_core/step_handler/decision.rb +53 -0
  52. data/lib/tasker_core/step_handler/mixins/api.rb +452 -0
  53. data/lib/tasker_core/step_handler/mixins/batchable.rb +465 -0
  54. data/lib/tasker_core/step_handler/mixins/decision.rb +252 -0
  55. data/lib/tasker_core/step_handler/mixins.rb +66 -0
  56. data/lib/tasker_core/subscriber.rb +212 -0
  57. data/lib/tasker_core/task_handler/base.rb +254 -0
  58. data/lib/tasker_core/tasker_rb.so +0 -0
  59. data/lib/tasker_core/template_discovery.rb +181 -0
  60. data/lib/tasker_core/tracing.rb +166 -0
  61. data/lib/tasker_core/types/batch_processing_outcome.rb +301 -0
  62. data/lib/tasker_core/types/client_types.rb +145 -0
  63. data/lib/tasker_core/types/decision_point_outcome.rb +177 -0
  64. data/lib/tasker_core/types/error_types.rb +72 -0
  65. data/lib/tasker_core/types/simple_message.rb +151 -0
  66. data/lib/tasker_core/types/step_context.rb +328 -0
  67. data/lib/tasker_core/types/step_handler_call_result.rb +307 -0
  68. data/lib/tasker_core/types/step_message.rb +112 -0
  69. data/lib/tasker_core/types/step_types.rb +207 -0
  70. data/lib/tasker_core/types/task_template.rb +240 -0
  71. data/lib/tasker_core/types/task_types.rb +148 -0
  72. data/lib/tasker_core/types.rb +132 -0
  73. data/lib/tasker_core/version.rb +13 -0
  74. data/lib/tasker_core/worker/CLAUDE.md +7 -0
  75. data/lib/tasker_core/worker/event_poller.rb +224 -0
  76. data/lib/tasker_core/worker/in_process_domain_event_poller.rb +271 -0
  77. data/lib/tasker_core.rb +160 -0
  78. metadata +322 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1bded962229b0c776f66831e441e237da58b844fe480ef89708c59e32afae2d9
4
+ data.tar.gz: 5d2ca6ccb24aa8f929ea48dc94bf4ddcb07269161729cde97888038fd64683a1
5
+ SHA512:
6
+ metadata.gz: a62d25a0019c424bf4a441ba4b97bb53331da6f0b83ddfe3e3057b08c1fff42ffba6c4c9b1f253ff98b372063eca39cc44bf210ccad666fa7f6d1442e8ee04c0
7
+ data.tar.gz: 89dc13bc48ade930463e5f15fb866efc96ee442ca2a8404277e66741854cbf9dc9a67e1755e81bbc9dfac4ab62c967edc66f14b5c27c534a817eb8e56e49bec8
data/DEVELOPMENT.md ADDED
@@ -0,0 +1,548 @@
1
+ # Ruby Worker Local Development Guide
2
+
3
+ Comprehensive guide for setting up, running, and testing the Tasker Core Ruby Worker locally.
4
+
5
+ ## Quick Start
6
+
7
+ ### Option 1: Docker-based Development (Recommended)
8
+ ```bash
9
+ # 1. Start all services
10
+ cd /path/to/tasker-core
11
+ docker compose -f docker/docker-compose.test.yml up --build -d
12
+
13
+ # 2. Run Ruby tests
14
+ cd workers/ruby
15
+ bundle install
16
+ bundle exec rspec --format documentation
17
+
18
+ # 3. Verify integration
19
+ curl http://localhost:8082/health # Ruby worker
20
+ curl http://localhost:8080/health # Orchestration service
21
+ ```
22
+
23
+ ### Option 2: Local Services with Docker Database
24
+ ```bash
25
+ # 1. Start only PostgreSQL
26
+ cd /path/to/tasker-core
27
+ docker compose -f docker/docker-compose.test.yml up postgres -d
28
+
29
+ # 2. Setup Ruby environment
30
+ cd workers/ruby
31
+ bundle install
32
+ bundle exec rake compile
33
+
34
+ # 3. Setup Rust environment
35
+ cd ../..
36
+ cargo build --all-features
37
+
38
+ # 4. Run tests locally
39
+ cd workers/ruby
40
+ export DATABASE_URL="postgresql://tasker:tasker@localhost:5432/tasker_rust_test"
41
+ bundle exec rspec --format documentation
42
+ ```
43
+
44
+ ### Option 3: Fully Native Development
45
+ ```bash
46
+ # 1. Setup PostgreSQL with PGMQ
47
+ createdb tasker_rust_test
48
+ psql tasker_rust_test -c "CREATE EXTENSION IF NOT EXISTS pgmq;"
49
+
50
+ # 2. Run migrations
51
+ cd /path/to/tasker-core
52
+ export DATABASE_URL="postgresql://localhost/tasker_rust_test"
53
+ cargo sqlx migrate run
54
+
55
+ # 3. Setup Ruby
56
+ cd workers/ruby
57
+ bundle install
58
+ bundle exec rake compile
59
+
60
+ # 4. Run services manually (see Manual Service Startup section)
61
+ ```
62
+
63
+ ## Environment Setup
64
+
65
+ ### System Requirements
66
+ - **Ruby**: 3.0+ with development headers (`ruby-dev` or `ruby-devel`)
67
+ - **Rust**: 1.70+ with standard toolchain
68
+ - **PostgreSQL**: 12+ with PGMQ extension
69
+ - **Docker**: For containerized development (optional)
70
+
71
+ ### Ruby Dependencies
72
+ ```bash
73
+ cd workers/ruby
74
+ bundle install
75
+
76
+ # Key dependencies installed:
77
+ # - ffi: Foreign function interface
78
+ # - rspec: Testing framework
79
+ # - magnus: Rust-Ruby FFI bindings (compiled extension)
80
+ ```
81
+
82
+ ### Rust Dependencies
83
+ ```bash
84
+ cd /path/to/tasker-core
85
+ cargo build --all-features
86
+
87
+ # Key components built:
88
+ # - tasker-orchestration: Core orchestration logic
89
+ # - tasker-worker: Worker implementation
90
+ # - tasker-shared: Shared types and utilities
91
+ # - tasker-pgmq: PostgreSQL message queue wrapper
92
+ ```
93
+
94
+ ## Configuration
95
+
96
+ ### Environment Variables
97
+
98
+ #### Database Configuration
99
+ ```bash
100
+ # Required for all setups
101
+ export DATABASE_URL="postgresql://user:password@localhost/database_name"
102
+
103
+ # Docker setup (default)
104
+ export DATABASE_URL="postgresql://tasker:tasker@localhost:5432/tasker_rust_test"
105
+
106
+ # Local PostgreSQL setup
107
+ export DATABASE_URL="postgresql://localhost/tasker_rust_dev"
108
+ ```
109
+
110
+ #### Ruby Worker Configuration
111
+ ```bash
112
+ # Ruby handler discovery
113
+ export TASKER_TEMPLATE_PATH="/path/to/ruby/templates"
114
+ export RUBY_HANDLER_PATH="/path/to/ruby/handlers"
115
+
116
+ # Docker setup (automatic)
117
+ export TASKER_TEMPLATE_PATH="/app/ruby_templates"
118
+ export RUBY_HANDLER_PATH="/app/ruby_handlers"
119
+
120
+ # Local setup
121
+ export TASKER_TEMPLATE_PATH="$(pwd)/spec/fixtures/templates"
122
+ export RUBY_HANDLER_PATH="$(pwd)/spec/handlers/examples"
123
+ ```
124
+
125
+ #### Service URLs (for integration tests)
126
+ ```bash
127
+ # Default Docker setup
128
+ export TASKER_TEST_ORCHESTRATION_URL="http://localhost:8080"
129
+ export TASKER_TEST_RUBY_WORKER_URL="http://localhost:8082"
130
+
131
+ # Custom ports
132
+ export TASKER_TEST_ORCHESTRATION_URL="http://localhost:9080"
133
+ export TASKER_TEST_RUBY_WORKER_URL="http://localhost:9082"
134
+
135
+ # Skip health checks (useful for CI or rapid testing)
136
+ export TASKER_TEST_SKIP_HEALTH_CHECK="true"
137
+ ```
138
+
139
+ #### Rust Configuration
140
+ ```bash
141
+ # Environment detection
142
+ export TASKER_ENV="development" # or test, production
143
+
144
+ # Logging
145
+ export RUST_LOG="debug"
146
+ export RUST_LOG="tasker_orchestration=debug,tasker_worker=debug"
147
+
148
+ # FFI debugging
149
+ export TASKER_FFI_DEBUG="true"
150
+ export MAGNUS_DEBUG="true"
151
+ ```
152
+
153
+ ## Testing
154
+
155
+ ### Test Categories
156
+
157
+ #### Unit Tests (Ruby)
158
+ ```bash
159
+ cd workers/ruby
160
+
161
+ # Run all unit tests
162
+ bundle exec rspec spec/ffi/ spec/types/ spec/worker/ --format documentation
163
+
164
+ # Run specific test files
165
+ bundle exec rspec spec/ffi/ffi_spec.rb --format documentation
166
+ bundle exec rspec spec/types/task_request_spec.rb --format documentation
167
+ bundle exec rspec spec/worker/bootstrap_spec.rb --format documentation
168
+
169
+ # Run with coverage
170
+ bundle exec rspec spec/ffi/ spec/types/ spec/worker/ --format documentation --require simplecov
171
+ ```
172
+
173
+ #### Integration Tests (Docker-based)
174
+ ```bash
175
+ cd workers/ruby
176
+
177
+ # Prerequisites: Start Docker services first
178
+ docker compose -f ../../docker/docker-compose.test.yml up --build -d
179
+
180
+ # Run all integration tests
181
+ bundle exec rspec spec/integration/ --format documentation
182
+
183
+ # Run specific workflow tests
184
+ bundle exec rspec spec/integration/diamond_workflow_docker_integration_spec.rb
185
+ bundle exec rspec spec/integration/linear_workflow_docker_integration_spec.rb
186
+ bundle exec rspec spec/integration/tree_workflow_docker_integration_spec.rb
187
+ bundle exec rspec spec/integration/mixed_dag_workflow_docker_integration_spec.rb
188
+ bundle exec rspec spec/integration/order_fulfillment_docker_integration_spec.rb
189
+
190
+ # Run smoke tests and health checks
191
+ bundle exec rspec spec/integration/docker_integration_runner_spec.rb
192
+ ```
193
+
194
+ #### Rust Tests
195
+ ```bash
196
+ cd /path/to/tasker-core
197
+
198
+ # Run all Rust tests
199
+ cargo test --all-features
200
+
201
+ # Run specific package tests
202
+ cargo test --all-features --package tasker-worker
203
+ cargo test --all-features --package tasker-orchestration
204
+
205
+ # Run with logging
206
+ RUST_LOG=debug cargo test --all-features -- --nocapture
207
+ ```
208
+
209
+ ### Test Configuration Files
210
+
211
+ #### RSpec Configuration (`.rspec`)
212
+ ```
213
+ --require spec_helper
214
+ --format documentation
215
+ --color
216
+ --order random
217
+ ```
218
+
219
+ #### SimpleCov Configuration (`spec/spec_helper.rb`)
220
+ ```ruby
221
+ require 'simplecov'
222
+ SimpleCov.start do
223
+ add_filter '/spec/'
224
+ add_group 'FFI', 'lib/tasker_core/ffi'
225
+ add_group 'Types', 'lib/tasker_core/types'
226
+ add_group 'Worker', 'lib/tasker_core/worker'
227
+ end
228
+ ```
229
+
230
+ ## Manual Service Startup
231
+
232
+ For debugging and development, you may want to run services manually:
233
+
234
+ ### 1. Start PostgreSQL and Run Migrations
235
+ ```bash
236
+ # Option A: Docker PostgreSQL
237
+ docker compose -f docker/docker-compose.test.yml up postgres -d
238
+
239
+ # Option B: Local PostgreSQL
240
+ createdb tasker_rust_dev
241
+ psql tasker_rust_dev -c "CREATE EXTENSION IF NOT EXISTS pgmq;"
242
+
243
+ # Run migrations
244
+ export DATABASE_URL="postgresql://localhost/tasker_rust_dev"
245
+ cargo sqlx migrate run
246
+ ```
247
+
248
+ ### 2. Start Orchestration Service
249
+ ```bash
250
+ cd /path/to/tasker-core
251
+ export DATABASE_URL="postgresql://localhost/tasker_rust_dev"
252
+ export TASKER_ENV="development"
253
+ export RUST_LOG="debug"
254
+
255
+ # Build and run orchestration service
256
+ cargo build --all-features --bin tasker-server
257
+ ./target/debug/tasker-server
258
+
259
+ # Service will be available at http://localhost:8080
260
+ ```
261
+
262
+ ### 3. Start Ruby Worker Service
263
+ ```bash
264
+ cd workers/ruby
265
+ export DATABASE_URL="postgresql://localhost/tasker_rust_dev"
266
+ export TASKER_TEMPLATE_PATH="$(pwd)/spec/fixtures/templates"
267
+ export RUBY_HANDLER_PATH="$(pwd)/spec/handlers/examples"
268
+
269
+ # Compile Ruby extension
270
+ bundle exec rake compile
271
+
272
+ # Start Ruby worker
273
+ bundle exec ruby -r ./lib/tasker_core -e "
274
+ TaskerCore::Worker::Bootstrap.start!
275
+ puts 'Ruby worker started - press Ctrl+C to stop'
276
+ sleep
277
+ "
278
+
279
+ # Service will be available at http://localhost:8081
280
+ ```
281
+
282
+ ### 4. Verify Services
283
+ ```bash
284
+ # Check orchestration service
285
+ curl http://localhost:8080/health
286
+ curl http://localhost:8080/api/v1/health
287
+
288
+ # Check Ruby worker service
289
+ curl http://localhost:8081/health
290
+ curl http://localhost:8081/worker/status
291
+ curl http://localhost:8081/worker/handlers
292
+ ```
293
+
294
+ ## Development Workflows
295
+
296
+ ### Adding New Ruby Handlers
297
+
298
+ 1. **Create Handler Class**:
299
+ ```ruby
300
+ # spec/handlers/examples/my_workflow/step_handlers/my_step_handler.rb
301
+ module MyWorkflow
302
+ module StepHandlers
303
+ class MyStepHandler < TaskerCore::Worker::BaseStepHandler
304
+ def execute(context)
305
+ # Your handler logic here
306
+ { result: "Step completed", data: context }
307
+ end
308
+ end
309
+ end
310
+ end
311
+ ```
312
+
313
+ 2. **Create YAML Template**:
314
+ ```yaml
315
+ # spec/fixtures/templates/my_workflow/my_step.yaml
316
+ namespace: my_workflow
317
+ name: my_step
318
+ version: "1.0.0"
319
+ handler_class: "MyWorkflow::StepHandlers::MyStepHandler"
320
+ description: "My custom step handler"
321
+ ```
322
+
323
+ 3. **Create Integration Test**:
324
+ ```ruby
325
+ # spec/integration/my_workflow_docker_integration_spec.rb
326
+ RSpec.describe 'My Workflow Docker Integration', type: :integration do
327
+ include RubyIntegrationTestHelpers
328
+ let(:manager) { RubyWorkerIntegrationManager.setup }
329
+
330
+ it 'executes my custom workflow' do
331
+ task_request = create_task_request('my_workflow', 'my_step', { test: true })
332
+ task_response = manager.orchestration_client.create_task(task_request)
333
+ # ... test implementation
334
+ end
335
+ end
336
+ ```
337
+
338
+ 4. **Test the Handler**:
339
+ ```bash
340
+ # Start services
341
+ docker compose -f docker/docker-compose.test.yml up --build -d
342
+
343
+ # Run the test
344
+ bundle exec rspec spec/integration/my_workflow_docker_integration_spec.rb
345
+ ```
346
+
347
+ ### Debugging Common Issues
348
+
349
+ #### FFI Compilation Issues
350
+ ```bash
351
+ # Check Rust toolchain
352
+ rustc --version
353
+ cargo --version
354
+
355
+ # Check Ruby development headers
356
+ ruby -v
357
+ gem list ffi
358
+
359
+ # Clean and rebuild
360
+ cd workers/ruby
361
+ bundle exec rake clean
362
+ bundle exec rake compile
363
+
364
+ # Debug compilation
365
+ bundle exec rake compile --trace
366
+ ```
367
+
368
+ #### Service Connection Issues
369
+ ```bash
370
+ # Check Docker services
371
+ docker compose -f docker/docker-compose.test.yml ps
372
+
373
+ # Check service logs
374
+ docker compose -f docker/docker-compose.test.yml logs orchestration
375
+ docker compose -f docker/docker-compose.test.yml logs ruby-worker
376
+
377
+ # Check network connectivity
378
+ curl -v http://localhost:8080/health
379
+ curl -v http://localhost:8082/health
380
+
381
+ # Check PostgreSQL connectivity
382
+ psql $DATABASE_URL -c "SELECT 1;"
383
+ ```
384
+
385
+ #### Handler Discovery Issues
386
+ ```bash
387
+ # Check template files
388
+ ls -la spec/fixtures/templates/
389
+
390
+ # Check handler files
391
+ ls -la spec/handlers/examples/
392
+
393
+ # Debug handler registration
394
+ bundle exec ruby -r ./lib/tasker_core -e "
395
+ puts 'Template path: ' + ENV['TASKER_TEMPLATE_PATH'].to_s
396
+ puts 'Handler path: ' + ENV['RUBY_HANDLER_PATH'].to_s
397
+
398
+ registry = TaskerCore::Registry::HandlerRegistry.instance
399
+ puts 'Registered handlers: ' + registry.registered_handlers.to_s
400
+ "
401
+ ```
402
+
403
+ #### Database Issues
404
+ ```bash
405
+ # Check PGMQ extension
406
+ psql $DATABASE_URL -c "SELECT * FROM pgmq.meta;"
407
+
408
+ # Check migrations
409
+ psql $DATABASE_URL -c "\\dt" | grep tasker
410
+
411
+ # Reset database
412
+ dropdb tasker_rust_test
413
+ createdb tasker_rust_test
414
+ psql tasker_rust_test -c "CREATE EXTENSION IF NOT EXISTS pgmq;"
415
+ cargo sqlx migrate run
416
+ ```
417
+
418
+ ## Performance Monitoring
419
+
420
+ ### Local Performance Testing
421
+ ```bash
422
+ # Run performance tests
423
+ bundle exec rspec spec/performance/ --format documentation
424
+
425
+ # Profile Ruby code
426
+ bundle exec ruby-prof spec/integration/diamond_workflow_docker_integration_spec.rb
427
+
428
+ # Monitor service resources
429
+ docker stats tasker-core_orchestration_1 tasker-core_ruby-worker_1
430
+ ```
431
+
432
+ ### Benchmarking
433
+ ```bash
434
+ # Ruby FFI overhead benchmarking
435
+ bundle exec ruby benchmarks/ffi_overhead_benchmark.rb
436
+
437
+ # End-to-end workflow performance
438
+ bundle exec ruby benchmarks/workflow_performance_benchmark.rb
439
+ ```
440
+
441
+ ## CI/CD Integration
442
+
443
+ ### Local CI Simulation
444
+ ```bash
445
+ # Run the same commands as CI
446
+ cd workers/ruby
447
+
448
+ # Install dependencies (like CI)
449
+ bundle install
450
+
451
+ # Compile extension (like CI)
452
+ bundle exec rake compile
453
+
454
+ # Run unit tests with JUnit output (like CI)
455
+ bundle exec rspec spec/ffi/ spec/types/ spec/worker/ \
456
+ --format RspecJunitFormatter \
457
+ --out ../../target/ruby-unit-results.xml
458
+
459
+ # Start Docker services (like CI)
460
+ docker compose -f ../../docker/docker-compose.test.yml up --build -d
461
+
462
+ # Run integration tests with JUnit output (like CI)
463
+ bundle exec rspec spec/integration/ \
464
+ --format RspecJunitFormatter \
465
+ --out ../../target/ruby-integration-results.xml
466
+ ```
467
+
468
+ ### GitHub Actions Workflows
469
+ - `.github/workflows/test-ruby-unit.yml` - Ruby unit tests
470
+ - `.github/workflows/test-ruby-integration.yml` - Ruby integration tests
471
+ - `.github/workflows/ci.yml` - Main CI pipeline with Ruby tests
472
+
473
+ ## Troubleshooting Guide
474
+
475
+ ### Common Error Messages
476
+
477
+ #### "Magnus gem not found" or "FFI compilation failed"
478
+ ```bash
479
+ # Solution: Ensure Rust toolchain is installed
480
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
481
+ rustup update stable
482
+
483
+ # Reinstall gems
484
+ bundle install
485
+ bundle exec rake compile
486
+ ```
487
+
488
+ #### "Connection refused" to localhost:8080 or 8082
489
+ ```bash
490
+ # Solution: Start Docker services
491
+ docker compose -f docker/docker-compose.test.yml up --build -d
492
+
493
+ # Check service health
494
+ curl http://localhost:8080/health
495
+ curl http://localhost:8082/health
496
+ ```
497
+
498
+ #### "PGMQ extension not found"
499
+ ```bash
500
+ # Solution: Ensure PostgreSQL has PGMQ extension
501
+ psql $DATABASE_URL -c "CREATE EXTENSION IF NOT EXISTS pgmq;"
502
+
503
+ # Or use Docker PostgreSQL (includes PGMQ)
504
+ docker compose -f docker/docker-compose.test.yml up postgres -d
505
+ ```
506
+
507
+ #### "Handler not found" or "Template discovery failed"
508
+ ```bash
509
+ # Solution: Check environment variables
510
+ echo $TASKER_TEMPLATE_PATH
511
+ echo $RUBY_HANDLER_PATH
512
+
513
+ # Set correctly for your setup
514
+ export TASKER_TEMPLATE_PATH="$(pwd)/spec/fixtures/templates"
515
+ export RUBY_HANDLER_PATH="$(pwd)/spec/handlers/examples"
516
+ ```
517
+
518
+ #### "Ruby worker FFI bootstrap failed"
519
+ ```bash
520
+ # Solution: Check Ruby extension compilation
521
+ cd workers/ruby
522
+ bundle exec rake clean
523
+ bundle exec rake compile
524
+
525
+ # Check for compilation errors
526
+ bundle exec rake compile --trace
527
+ ```
528
+
529
+ ### Development Best Practices
530
+
531
+ 1. **Always start with Docker setup** - it's the most reliable
532
+ 2. **Use environment variables** for configuration instead of hardcoding paths
533
+ 3. **Run unit tests first** before integration tests
534
+ 4. **Check service logs** when debugging integration issues
535
+ 5. **Use `--format documentation`** for readable test output
536
+ 6. **Set `RUST_LOG=debug`** for detailed Rust service logging
537
+
538
+ ### Getting Help
539
+
540
+ - Check service logs: `docker compose logs [service-name]`
541
+ - Run tests with detailed output: `--format documentation`
542
+ - Enable debug logging: `RUST_LOG=debug`
543
+ - Check the integration test README: `spec/integration/README.md`
544
+ - Review CI workflows: `.github/workflows/`
545
+
546
+ ---
547
+
548
+ **Happy developing! 🚀**
data/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # Tasker Core Ruby Bindings
2
+
3
+ Ruby FFI bindings for the high-performance Tasker Core Rust orchestration engine.
4
+
5
+ ## Status: Foundation Complete ✅
6
+
7
+ The foundational structure has been successfully implemented and tested:
8
+
9
+ - ✅ **Monorepo Integration**: Successfully integrated into the main tasker-core repository
10
+ - ✅ **Cargo Workspace**: Properly configured as a workspace member
11
+ - ✅ **Magnus FFI Setup**: Basic Ruby module initialization working
12
+ - ✅ **Rust Compilation**: All Rust code compiles successfully
13
+ - ✅ **Build System**: CI/CD workflows configured for cross-platform testing
14
+
15
+ ## Current Implementation
16
+
17
+ This is a **foundational version** that establishes the structure:
18
+
19
+ ```rust
20
+ // Ruby module available:
21
+ TaskerCore::RUST_VERSION # "0.1.0"
22
+ TaskerCore::STATUS # "foundation"
23
+ TaskerCore::FEATURES # "module_init"
24
+
25
+ // Error classes defined:
26
+ TaskerCore::Error
27
+ TaskerCore::OrchestrationError
28
+ TaskerCore::DatabaseError
29
+ TaskerCore::FFIError
30
+ ```
31
+
32
+ ## Development Commands
33
+
34
+ ```bash
35
+ # Install dependencies
36
+ bundle install
37
+
38
+ # Compile the Rust extension (requires Ruby dev environment)
39
+ rake compile
40
+
41
+ # Run tests
42
+ rake spec
43
+
44
+ # Full development setup
45
+ rake setup
46
+ ```
47
+
48
+ ## Next Phase: Full Implementation
49
+
50
+ The next development phase will implement:
51
+
52
+ 1. **Complete WorkflowCoordinator API**
53
+ 2. **Ruby ↔ Rust type conversions**
54
+ 3. **Framework adapter for Rails integration**
55
+ 4. **Performance benchmarks and validation**
56
+
57
+ ## Architecture
58
+
59
+ This gem follows the **delegation-based architecture**:
60
+
61
+ ```
62
+ Rails Engine ↔ tasker-core-rb (FFI) ↔ tasker-core (Performance Core)
63
+ ```
64
+
65
+ - **Rails**: Business logic and step execution
66
+ - **Rust**: High-performance orchestration and dependency resolution
67
+ - **Ruby Bindings**: Safe FFI bridge between the two
68
+
69
+ ## Performance Targets
70
+
71
+ - **10-100x faster** dependency resolution vs PostgreSQL functions
72
+ - **<1ms FFI overhead** per orchestration call
73
+ - **>10k events/sec** cross-language event processing
74
+
75
+ ## Requirements
76
+
77
+ - **Ruby**: 3.0+ with development headers
78
+ - **Rust**: 1.70+ with magnus dependencies
79
+ - **PostgreSQL**: 12+ for database operations
80
+
81
+ ## Contributing
82
+
83
+ This is part of the larger tasker-systems monorepo. See the main project documentation for development guidelines and contribution instructions.
84
+
85
+ ---
86
+
87
+ 🦀 **Built with Rust + Magnus for maximum performance and safety**