cmdx 2.2.0 → 2.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -1
- data/TODO.md +353 -0
- data/lib/cmdx/circuit_breaker.rb +221 -0
- data/lib/cmdx/configuration.rb +4 -1
- data/lib/cmdx/deprecation.rb +2 -2
- data/lib/cmdx/idempotency.rb +171 -0
- data/lib/cmdx/limiters/fixed_window.rb +30 -0
- data/lib/cmdx/limiters/leaky_bucket.rb +75 -0
- data/lib/cmdx/limiters.rb +107 -0
- data/lib/cmdx/lock.rb +192 -0
- data/lib/cmdx/pipeline.rb +1 -9
- data/lib/cmdx/rate_limit.rb +244 -0
- data/lib/cmdx/retry.rb +20 -2
- data/lib/cmdx/runtime.rb +51 -19
- data/lib/cmdx/store_key.rb +78 -0
- data/lib/cmdx/stores/memory.rb +158 -0
- data/lib/cmdx/stores/redis.rb +118 -0
- data/lib/cmdx/stores.rb +111 -0
- data/lib/cmdx/task.rb +171 -12
- data/lib/cmdx/telemetry.rb +36 -4
- data/lib/cmdx/util.rb +7 -0
- data/lib/cmdx/version.rb +1 -1
- data/lib/cmdx.rb +15 -0
- data/lib/generators/cmdx/templates/install.rb +41 -5
- data/mkdocs.yml +76 -21
- metadata +13 -1
data/mkdocs.yml
CHANGED
|
@@ -121,38 +121,68 @@ plugins:
|
|
|
121
121
|
- basics/chain.md: Execution chain tracking for related tasks within threads
|
|
122
122
|
Interruptions:
|
|
123
123
|
- interruptions/signals.md: Intentional task interruption using skip! and fail! methods
|
|
124
|
-
- interruptions/faults.md:
|
|
124
|
+
- interruptions/faults.md: execute! exceptions for failed tasks with result, task, context, chain, and cleaned backtrace
|
|
125
125
|
- interruptions/exceptions.md: Complete exception hierarchy (Error, DeprecationError, ImplementationError, MiddlewareError, Fault) and execute vs execute! semantics
|
|
126
126
|
Outcomes:
|
|
127
127
|
- outcomes/result.md: Result objects exposing execution state, status, context, and metadata
|
|
128
128
|
- outcomes/states.md: Execution lifecycle states (initialized, executing, complete, interrupted)
|
|
129
129
|
- outcomes/statuses.md: Business outcome statuses (success, skipped, failed) and transitions
|
|
130
130
|
- outcomes/errors.md: Structured per-attribute error container accumulated during input/output verification and exposed on result.errors
|
|
131
|
-
|
|
131
|
+
Contracts:
|
|
132
132
|
- inputs/definitions.md: Attribute declarations (required/optional), validation, and type coercion
|
|
133
133
|
- inputs/naming.md: Customizing accessor method names with prefixes and suffixes
|
|
134
134
|
- inputs/coercions.md: Automatic type conversion for inputs (string to integer, date parsing, etc.)
|
|
135
135
|
- inputs/validations.md: Input validation rules (presence, length, format, numeric, inclusion, exclusion)
|
|
136
136
|
- inputs/defaults.md: Default values for optional inputs (static, dynamic, callable)
|
|
137
137
|
- inputs/transformations.md: Value transformation after coercion but before validation
|
|
138
|
-
|
|
138
|
+
- outputs.md: Declaring expected context outputs that must be set after task execution
|
|
139
|
+
Hooks:
|
|
139
140
|
- callbacks.md: Execution lifecycle callbacks (before_execution, on_success, on_failure, etc.)
|
|
140
141
|
- middlewares.md: Cross-cutting concerns wrapping task execution (authentication, caching, timeouts)
|
|
142
|
+
Composition:
|
|
143
|
+
- workflows.md: Composing multiple tasks into sequential pipelines with conditional execution
|
|
144
|
+
- deprecation.md: Managing deprecated tasks with logging, warnings, or execution prevention
|
|
145
|
+
Resilience:
|
|
146
|
+
- stores.md: Shared key/value store for idempotency, rate limits, locks, and cross-worker coordination
|
|
147
|
+
- locks.md: Single-flight leases via Stores so concurrent workers do not run the same logical work
|
|
148
|
+
- idempotency.md: Preventing duplicate execution for retried jobs and webhooks with idempotent_by
|
|
149
|
+
- rate_limit.md: Admission control per window with fixed-window and leaky-bucket limiters
|
|
150
|
+
- circuit_breaker.md: Automatic circuit breaking for failing dependencies with threshold, cool-off, and window options
|
|
151
|
+
- retries.md: Automatic retry functionality for transient failures with jitter and selective retries
|
|
152
|
+
Observability:
|
|
141
153
|
- logging.md: Structured logging with multiple formatters (JSON, KeyValue, Logstash, Line, Raw)
|
|
142
154
|
- internationalization.md: Multi-language support for error messages and validations (90+ locales)
|
|
143
|
-
|
|
144
|
-
- deprecation.md: Managing deprecated tasks with logging, warnings, or execution prevention
|
|
145
|
-
- outputs.md: Declaring expected context outputs that must be set after task execution
|
|
146
|
-
- workflows.md: Composing multiple tasks into sequential pipelines with conditional execution
|
|
147
|
-
More:
|
|
155
|
+
Adoption:
|
|
148
156
|
- testing.md: Best practices for testing CMDx tasks and workflows with RSpec
|
|
149
157
|
- tips_and_tricks.md: Best practices, patterns, and techniques for maintainable CMDx applications
|
|
150
158
|
- comparison.md: Comparison with other command/service object frameworks
|
|
151
159
|
- v2-migration.md: Migration guide from CMDx 1.x to 2.0
|
|
160
|
+
Ecosystem:
|
|
161
|
+
- ecosystem.md: Satellite gems (cmdx-i18n, cmdx-rspec)
|
|
162
|
+
References:
|
|
163
|
+
- references.md: API docs, llms.txt exports, and repository AI skills
|
|
164
|
+
Cookbook:
|
|
165
|
+
- cookbook/index.md: Integration recipes for jobs, Rails, auth, observability, and more
|
|
166
|
+
"Cookbook: Rails and Active Record":
|
|
167
|
+
- cookbook/active_record_database_transaction.md: Wrap task work in an Active Record transaction
|
|
168
|
+
- cookbook/active_record_query_tagging.md: Tag SQL queries with task metadata
|
|
169
|
+
- cookbook/paper_trail_whatdunnit.md: Paper Trail attribution for running tasks
|
|
170
|
+
"Cookbook: API and integration":
|
|
171
|
+
- cookbook/graphql_resolvers.md: Resolve GraphQL fields with CMDx tasks
|
|
172
|
+
- cookbook/openapi_schema_generation.md: Generate OpenAPI schemas from task inputs
|
|
173
|
+
- cookbook/pub_sub_task_chaining.md: Chain tasks from pub/sub events
|
|
174
|
+
"Cookbook: Cross-cutting concerns":
|
|
175
|
+
- cookbook/background_execution.md: Run tasks via Active Job or Sidekiq
|
|
176
|
+
- cookbook/store_wrappers.md: Test doubles and instrumented store wrappers
|
|
177
|
+
- cookbook/flipper_feature_flags.md: Gate tasks behind Flipper feature flags
|
|
178
|
+
- cookbook/pundit_authorization.md: Authorize tasks with Pundit before work runs
|
|
179
|
+
- cookbook/timeout_guard.md: Bound task execution time with a timeout guard
|
|
180
|
+
- cookbook/sentry_error_tracking.md: Report CMDx faults to Sentry
|
|
181
|
+
- cookbook/opentelemetry_tracing.md: Distributed tracing for task execution
|
|
152
182
|
nav:
|
|
153
183
|
- Home: index.md
|
|
154
184
|
- Documentation:
|
|
155
|
-
- Getting
|
|
185
|
+
- Getting started: getting_started.md
|
|
156
186
|
- Configuration: configuration.md
|
|
157
187
|
- Basics:
|
|
158
188
|
- Setup: basics/setup.md
|
|
@@ -168,36 +198,61 @@ nav:
|
|
|
168
198
|
- States: outcomes/states.md
|
|
169
199
|
- Statuses: outcomes/statuses.md
|
|
170
200
|
- Errors: outcomes/errors.md
|
|
171
|
-
-
|
|
201
|
+
- Contracts:
|
|
172
202
|
- Definitions: inputs/definitions.md
|
|
173
203
|
- Naming: inputs/naming.md
|
|
174
204
|
- Coercions: inputs/coercions.md
|
|
175
205
|
- Validations: inputs/validations.md
|
|
176
206
|
- Defaults: inputs/defaults.md
|
|
177
207
|
- Transformations: inputs/transformations.md
|
|
178
|
-
|
|
208
|
+
- Outputs: outputs.md
|
|
209
|
+
- Hooks:
|
|
179
210
|
- Callbacks: callbacks.md
|
|
180
211
|
- Middlewares: middlewares.md
|
|
212
|
+
- Composition:
|
|
213
|
+
- Workflows: workflows.md
|
|
214
|
+
- Deprecation: deprecation.md
|
|
215
|
+
- Resilience:
|
|
216
|
+
- Stores: stores.md
|
|
217
|
+
- Locks: locks.md
|
|
218
|
+
- Idempotency: idempotency.md
|
|
219
|
+
- Rate limit: rate_limit.md
|
|
220
|
+
- Circuit breaker: circuit_breaker.md
|
|
221
|
+
- Retries: retries.md
|
|
222
|
+
- Observability:
|
|
181
223
|
- Logging: logging.md
|
|
182
224
|
- Internationalization: internationalization.md
|
|
183
|
-
|
|
184
|
-
- Deprecation: deprecation.md
|
|
185
|
-
- Outputs: outputs.md
|
|
186
|
-
- Workflows: workflows.md
|
|
187
|
-
- More:
|
|
225
|
+
- Adoption:
|
|
188
226
|
- Testing: testing.md
|
|
189
|
-
- Tips and
|
|
227
|
+
- Tips and tricks: tips_and_tricks.md
|
|
190
228
|
- Comparison: comparison.md
|
|
191
229
|
- v1 → v2 Migration: v2-migration.md
|
|
192
|
-
|
|
230
|
+
- Ecosystem:
|
|
231
|
+
- cmdx-i18n: https://github.com/drexed/cmdx-i18n
|
|
232
|
+
- cmdx-rspec: https://github.com/drexed/cmdx-rspec
|
|
193
233
|
- References:
|
|
194
234
|
- API Documentation: https://drexed.github.io/cmdx/api/index.html
|
|
195
235
|
- llms.txt: https://drexed.github.io/cmdx/llms.txt
|
|
196
236
|
- llms-full.txt: https://drexed.github.io/cmdx/llms-full.txt
|
|
197
237
|
- AI Skills: https://github.com/drexed/cmdx/blob/main/skills
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
238
|
+
- Cookbook:
|
|
239
|
+
- Overview: cookbook/index.md
|
|
240
|
+
- Rails and Active Record:
|
|
241
|
+
- Active Record Database Transaction: cookbook/active_record_database_transaction.md
|
|
242
|
+
- Active Record Query Tagging: cookbook/active_record_query_tagging.md
|
|
243
|
+
- Paper Trail Whatdunnit: cookbook/paper_trail_whatdunnit.md
|
|
244
|
+
- API and integration:
|
|
245
|
+
- GraphQL Resolvers: cookbook/graphql_resolvers.md
|
|
246
|
+
- OpenAPI Schema Generation: cookbook/openapi_schema_generation.md
|
|
247
|
+
- PubSub Task Chaining: cookbook/pub_sub_task_chaining.md
|
|
248
|
+
- Cross-cutting concerns:
|
|
249
|
+
- Background Execution: cookbook/background_execution.md
|
|
250
|
+
- Store Wrappers: cookbook/store_wrappers.md
|
|
251
|
+
- Flipper Feature Flags: cookbook/flipper_feature_flags.md
|
|
252
|
+
- Pundit Authorization: cookbook/pundit_authorization.md
|
|
253
|
+
- Timeout Guard: cookbook/timeout_guard.md
|
|
254
|
+
- Sentry Error Tracking: cookbook/sentry_error_tracking.md
|
|
255
|
+
- OpenTelemetry Tracing: cookbook/opentelemetry_tracing.md
|
|
201
256
|
- Blog: blog/index.md
|
|
202
257
|
|
|
203
258
|
extra:
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cmdx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juan Gomez
|
|
@@ -204,10 +204,12 @@ files:
|
|
|
204
204
|
- LICENSE.txt
|
|
205
205
|
- README.md
|
|
206
206
|
- Rakefile
|
|
207
|
+
- TODO.md
|
|
207
208
|
- lib/cmdx.rb
|
|
208
209
|
- lib/cmdx/.DS_Store
|
|
209
210
|
- lib/cmdx/callbacks.rb
|
|
210
211
|
- lib/cmdx/chain.rb
|
|
212
|
+
- lib/cmdx/circuit_breaker.rb
|
|
211
213
|
- lib/cmdx/coercions.rb
|
|
212
214
|
- lib/cmdx/coercions/array.rb
|
|
213
215
|
- lib/cmdx/coercions/big_decimal.rb
|
|
@@ -236,8 +238,13 @@ files:
|
|
|
236
238
|
- lib/cmdx/executors/thread.rb
|
|
237
239
|
- lib/cmdx/fault.rb
|
|
238
240
|
- lib/cmdx/i18n_proxy.rb
|
|
241
|
+
- lib/cmdx/idempotency.rb
|
|
239
242
|
- lib/cmdx/input.rb
|
|
240
243
|
- lib/cmdx/inputs.rb
|
|
244
|
+
- lib/cmdx/limiters.rb
|
|
245
|
+
- lib/cmdx/limiters/fixed_window.rb
|
|
246
|
+
- lib/cmdx/limiters/leaky_bucket.rb
|
|
247
|
+
- lib/cmdx/lock.rb
|
|
241
248
|
- lib/cmdx/log_formatters/json.rb
|
|
242
249
|
- lib/cmdx/log_formatters/key_value.rb
|
|
243
250
|
- lib/cmdx/log_formatters/line.rb
|
|
@@ -253,6 +260,7 @@ files:
|
|
|
253
260
|
- lib/cmdx/outputs.rb
|
|
254
261
|
- lib/cmdx/pipeline.rb
|
|
255
262
|
- lib/cmdx/railtie.rb
|
|
263
|
+
- lib/cmdx/rate_limit.rb
|
|
256
264
|
- lib/cmdx/result.rb
|
|
257
265
|
- lib/cmdx/retriers.rb
|
|
258
266
|
- lib/cmdx/retriers/bounded_random.rb
|
|
@@ -266,6 +274,10 @@ files:
|
|
|
266
274
|
- lib/cmdx/runtime.rb
|
|
267
275
|
- lib/cmdx/settings.rb
|
|
268
276
|
- lib/cmdx/signal.rb
|
|
277
|
+
- lib/cmdx/store_key.rb
|
|
278
|
+
- lib/cmdx/stores.rb
|
|
279
|
+
- lib/cmdx/stores/memory.rb
|
|
280
|
+
- lib/cmdx/stores/redis.rb
|
|
269
281
|
- lib/cmdx/task.rb
|
|
270
282
|
- lib/cmdx/telemetry.rb
|
|
271
283
|
- lib/cmdx/util.rb
|