smart-rb/smart_container
56.1
Adequate · 8 November 2026
2.2k
lines of production code
Ruby
primary language
7
measurements over time
What this system is
SmartCore::Container is a Ruby library that provides a thread-safe dependency injection container with support for namespaces, memoization, and dependency observation. It allows developers to define and resolve dependencies using a DSL, ensuring thread safety through a ReadWriteLock-based registry. The system includes features for container composition, state freezing, and mixin integration, facilitating modular and maintainable application architecture.
Features
SmartCore::Container v0.11.0 introduces definition DSL, memoization, and thread-safe registry
This release adds a new Definition DSL (lib/smart\_core/container/definition\_dsl) that allows users to define container dependencies using \namespace\, \register\, \compose\, and \freeze\_state!\ methods, which are stored in thread-safe command sets protected by \ReadWriteLock\. It introduces memoization support for dependencies via \MemoizedDependency\ entities and a \memoize:\ flag in the \register\ DSL method, defaulting to false. The container now features a \DependencyWatcher\ for observing changes to specific dependency paths and a \Host\ mechanism to properly propagate notifications for nested namespace changes. Additionally, the \Registry\ is now thread-safe, and the \Mixin\ module provides a convenient way to include container functionality in other classes with its own access lock.
_lib/smart\core/container · high confidence
Behavioural changes
Console environment now loads SmartCore::Container
The development console (bin/console) has been updated to require the SmartCore::Container library instead of the previous Siege dependency. This change ensures that the interactive Ruby environment starts with the SmartCore container available for immediate use, facilitating easier debugging and interaction with the containerized components.
bin · high confidence
SmartCore::Container refactored with ReadWriteLock and modularized internals
The container implementation has been significantly refactored to improve concurrency and code organization. It now uses a ReadWriteLock for thread-safe access to the registry, replacing previous locking mechanisms to reduce memory allocation and contention during reads and writes. The class has been expanded from a simple definition to a full-featured container with support for dependency resolution, memoization, namespaces, and host container paths. Internally, the logic has been split into dedicated modules (Registry, DependencyResolver, DependencyWatcher, Host, etc.) to enhance maintainability and allow for more granular control over dependency lifecycle and notification.
_lib/smart\core · high confidence
Test coverage
Added feature tests for SmartCore::Container capabilities; Enable branch and line coverage reporting in specs; Removed SmartCore::Container version test.
Dependencies
Upgrade to smart\_engine 0.17 and update development dependencies
The gem now depends on smart\_engine version 0.17, replacing the previous smart-container dependency structure. Development tooling has been updated to support Ruby 2.5+ (down from 2.7), with bundler bumped to \~\> 2.3, rspec to \~\> 3.11, armitage-rubocop to \~\> 1.36, simplecov to \~\> 0.21, and pry to \~\> 0.14. The gem name was also changed from smart-container to smart\_container.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 56 → 56 (+0.3)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 75 → 75 (+0.0)
- Architecture 100 → 100 (+0.0)
- Maturity 43 → 43 (+0.0)
- Readiness 49 → 49 (+0.0)
- Security 96 → 100 (+4.1)
Resolved (4)
- Duplicate functionality exposed through different types with different verbs. Container exposes observe/unobserve, while DependencyWatcher exposes watch/unwatch. These appear to manage the same underlying observer pattern. Exposing both creates confusion about whether the user should interact with the Container or the Watcher directly.
- Inconsistent naming between Container and Registry for similar operations. Container uses register and namespace, while Registry uses register_dependency and register_namespace. This forces users to remember different method names depending on whether they are interacting with the high-level Container or the lower-level Registry, despite the operations being semantically identical.
- Inconsistent naming for the same operation. Container uses clear_observers while DependencyWatcher uses clear_listeners. This is a minor naming inconsistency that breaks API uniformity.
- Redundant methods with ambiguous distinction. Both Container and its internal DependencyResolver expose both resolve and fetch. In dependency injection contexts, 'resolve' typically implies instantiation or full resolution, while 'fetch' might imply retrieval from cache or raw lookup. However, without clear documentation or distinct behavioral signatures in the API surface, these appear to be duplicate entry points for the same core operation, confusing users about which to use.
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
smart-rb/smart_container was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 8 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 64e611ea7ebf8ad82882ce1825a9b59542bf6c21 — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-45ab2cab63de.