This document provides a high-level overview of the Solid::Process library, its architecture, and core components. It explains what Solid::Process is, how it works, and how the major subsystems interact. For detailed information on specific features:
Solid::Process is a Ruby/Rails library for encapsulating business logic into composable, testable processes. It provides a structured approach to writing business operations with:
Solid::InputSolid::Success or Solid::Failure resultsThe library is designed for progressive mastery: start with simple input/output processes and add sophistication (steps, dependencies, callbacks) as complexity demands.
Sources: README.md42-69 docs/overview/010_KEY_CONCEPTS.md9-25
The following diagram shows the main architectural components and their relationships using actual class and module names from the codebase:
Sources: Diagram synthesis from README.md1-227 High-Level Architecture Diagrams (provided context)
| Component | Class/Module | Purpose | Defined In |
|---|---|---|---|
| Process Base | Solid::Process | Base class for all business logic processes | lib/solid/process.rb |
| Input Validation | Solid::Input | ActiveModel-based input objects with validation | lib/solid/input.rb |
| Result Types | Solid::Success, Solid::Failure | Explicit success/failure outcomes | Provided by solid-result gem |
| Data Modeling | Solid::Model | ActiveModel features for data objects | lib/solid/model.rb |
| Value Objects | Solid::Value | Immutable single-value objects | lib/solid/value.rb |
| Process Execution | Solid::Process::Caller | Manages process lifecycle and validation | lib/solid/process/caller.rb |
| DSL Definition | Solid::Process::ClassMethods | Provides input, deps, steps DSL | lib/solid/process/class_methods.rb |
| Configuration | Solid::Process::Config | Global configuration singleton | lib/solid/process/config.rb |
| Event Logging | Solid::Process::EventLogs | Process execution instrumentation | lib/solid/process/event_logs.rb |
Sources: lib/solid/process.rb lib/solid/input.rb lib/solid/model.rb lib/solid/value.rb
Every process inherits from Solid::Process and defines two required components:
Example from codebase:
examples/business_processes/user_creation.rb1-20 demonstrates this structure:
input do ... end block defines attributes and validationsdef call(attributes) contains the business logicSuccess(:user_created, ...) or Failure(:user_not_created, ...)Sources: README.md112-139 docs/REFERENCE.md82-155
The following diagram shows how a process executes from invocation through validation to result, using actual method names and module interactions:
Key execution points:
Solid::Process::Caller module is prepended to intercept call lib/solid/process/caller.rbInput object from raw data lib/solid/process/caller.rb25-35input.invalid?, returns Failure(:invalid_input) without executing business logic lib/solid/process/caller.rb37-43call method with validated attributes hash lib/solid/process/caller.rb45-50Success(:type, **data) or Failure(:type, **data)Sources: lib/solid/process/caller.rb Process Execution Flow diagram (provided context)
The library depends on two main external dependencies:
| Dependency | Version | Purpose |
|---|---|---|
solid-result | ~> 2.0 | Provides Success/Failure result types and event logging infrastructure |
activemodel | >= 6.0 | Powers Solid::Model with attributes, validations, and callbacks |
Sources: solid-process.gemspec42-43
Solid::Process is tested across a wide compatibility matrix:
| Ruby Version | Rails 6.0 | Rails 6.1 | Rails 7.0 | Rails 7.1 | Rails 7.2 | Rails 8.0 | Rails 8.1 | Rails Edge |
|---|---|---|---|---|---|---|---|---|
| 2.7 | ✅ | ✅ | ✅ | ✅ | - | - | - | - |
| 3.0 | ✅ | ✅ | ✅ | ✅ | - | - | - | - |
| 3.1 | - | - | ✅ | ✅ | ✅ | - | - | - |
| 3.2 | - | - | ✅ | ✅ | ✅ | ✅ | - | - |
| 3.3 | - | - | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| 3.4 | - | - | - | - | ✅ | ✅ | ✅ | ✅ |
| 4.x | - | - | - | - | - | - | ✅ | ✅ |
This matrix is enforced through the Appraisals-based testing infrastructure. See Multi-Version Testing Strategy for implementation details.
Sources: README.md26-38 Appraisals
Key directories:
lib/solid/ - Core library codelib/solid/process/ - Process execution machinerylib/solid/validators/ - Custom ActiveModel validatorstest/solid/ - Comprehensive test suitedocs/ - Documentation including the Reference Guideexamples/ - Real-world example processesgemfiles/ - Generated Appraisal gemfiles for multi-version testingSources: Repository file structure
Solid::Process embraces emergent design - starting simple and adding sophistication based on actual needs rather than upfront speculation. The development mantra is:
input + call + Success/FailureThis approach reduces over-engineering while providing a clear path for scaling complexity.
For detailed philosophical discussion and design patterns, see Design Patterns and Philosophy.
Sources: docs/overview/010_KEY_CONCEPTS.md31-42 docs/REFERENCE.md43-53
While Solid::Process works in pure Ruby applications, it provides specific Rails integrations:
| Feature | Description | Module/Method |
|---|---|---|
| ActiveRecord Transactions | rollback_on_failure { } wraps steps in a transaction | lib/solid/process.rb |
| Custom Validators | ActiveModel validators: email, uuid, id, kind_of, etc. | lib/solid/validators/ |
| ActiveModel Features | Full validation, dirty tracking, callbacks via Solid::Model | lib/solid/model.rb |
| Logger Integration | BasicLoggerListener uses Rails.logger by default | lib/solid/process/event_logs/basic_logger_listener.rb |
For detailed Rails integration patterns, see Rails Integration.
Sources: docs/overview/080_RAILS_INTEGRATION.md lib/solid/validators/
One of Solid::Process's key features is comprehensive observability without code pollution. The EventLogs system captures every step of execution:
Example log output structure:
#0 Account::OwnerCreation
* Given(uuid:, owner:)
#1 User::Creation
* Given(name:, email:, password:)
* Continue() from method: validate_email
* Continue(user:) from method: create_user
* Success(:user_created, user:)
* Continue(user:) from method: create_owner
* Success(:account_owner_created, user:, account:)
For configuration and usage details, see Event Logging System.
Sources: lib/solid/process/event_logs.rb docs/REFERENCE.md1307-1401
The repository maintains 100% test coverage across multiple Ruby and Rails versions using a sophisticated testing matrix:
For detailed testing strategy documentation, see Multi-Version Testing Strategy.
Sources: Appraisals .github/workflows/main.yml bin/matrix
To begin using Solid::Process:
bundle add solid-process (see README.md95-108)input and call (see Your First Process)Sources: README.md80-145 docs/REFERENCE.md1-79
| Resource | Purpose | Location |
|---|---|---|
| README | Quick start, installation, basic examples | README.md |
| Reference Guide | Complete feature documentation with examples | docs/REFERENCE.md |
| Overview Docs | Bite-sized topic guides | docs/overview/ |
| Examples | Working code examples | examples/ |
| Solid Rails App | Complete Rails application example | External repository |
Sources: README.md147-169
Refresh this wiki