igorkasyanchuk/active_storage_validations
70.6
Strong · 6 November 2026
4.3k
lines of production code
Ruby
primary language
4
measurements over time
What this system is
Features
Active Storage Validations upgraded to 4.1.1 with new analyzers and validators
The gem has been upgraded from version 0.2 to 4.1.1, introducing a new Analyzer base class that supports configurable command timeouts for external analysis tools. This release adds several new validation capabilities: a PagesValidator for PDF page counts, a WithAudioValidator to enforce the presence or absence of audio tracks, and a ProcessableFileValidator that correctly handles libvips untrusted content types (such as SVG and BMP) to prevent false validation errors. Additionally, the FormBuilder now automatically infers file accept types from content-type validators, and the Railtie has been refactored to use \ActiveSupport.on\_load\ hooks to resolve a stack overflow issue during initialization.
_lib/active\_storage\validations · high confidence
Add Vips-based image analyzer with command timeout support
Users can now analyze images using the libvips library via the ruby-vips gem, which is generally faster and more memory-efficient than the previous default. This new analyzer supports a configurable command timeout to prevent hanging on large or problematic files, and it gracefully handles unsupported or empty image files by returning nil instead of raising errors.
_lib/active\_storage\_validations/analyzer/image\analyzer · high confidence
Added benchmark suite for metadata validators and image processors
Developers can now run an informational performance suite to measure the speed of metadata validators (dimension, duration, pages, content\_type, processable\_file) and compare the performance of libvips versus MiniMagick for image analysis. The suite includes scripts to measure gem load time, cold vs. warm validation paths, and head-to-head processor benchmarks, with a checked-in baseline snapshot for regression comparison.
benchmark · high confidence
New Cursor AI rules and skills for commit conventions and test suite structure
This change introduces a set of Cursor AI configuration files to standardize development workflows. It adds a 'commit' skill and a 'git.mdc' rule that enforce Conventional Commits formatting, including specific types, scopes, and validation rules for commit messages. Additionally, it establishes shared RSpec conventions in 'spec.mdc' and domain-specific rules for validators, matchers, analyzers, and integration specs, guiding the AI on naming subjects, structuring describe/context blocks, and managing test fixtures. These rules ensure consistent code style and test organization across the gem's specification suite.
.cursor · high confidence
New RSpec matchers for all Active Storage validators
The library now provides dedicated RSpec matchers for every validation type, allowing you to test your model validations directly in specs. You can use \validate\_aspect\_ratio\_of\, \validate\_attached\_of\, \validate\_content\_type\_of\, \validate\_dimensions\_of\, \validate\_duration\_of\, \validate\_limits\_of\, \validate\_pages\_of\, \validate\_processable\_file\_of\, \validate\_size\_of\, \validate\_total\_size\_of\, and \validate\_with\_audio\_of\. These matchers support common testing patterns like \allowing\/\rejecting\ content types, \width\/\height\ ranges, \min\/\max\ file counts, and custom error messages, ensuring your Active Storage validations are covered by your test suite.
_lib/active\_storage\validations/matchers · high confidence
Removals
Removed unused Active Storage validations rake task
The placeholder rake task for Active Storage validations has been removed from the application. This cleanup eliminates dead code that was previously defined but not implemented, resulting in a cleaner task namespace and slightly faster Rake initialization.
lib/tasks · high confidence
Behavioural changes
Enhanced content-type validation with spoofing protection and robust external command handling
The content-type validator now includes optional spoofing protection (via the \spoofing\_protection\ option) to detect mismatches between declared and actual file types, and supports regex patterns for content-type matching. External analyzer commands (e.g., ImageMagick, ffprobe) are now executed with a configurable timeout and process-group kill logic to prevent hung processes from blocking the application.
_active\_storage\validations · high confidence
Global command timeout and refactored analyzer architecture
The gem now includes a global \command\_timeout\ configuration (defaulting to 10 seconds) that limits the execution time for external analyzer commands like ffprobe, magika, and MiniMagick, which can be overridden per-validator. This change accompanies a structural refactor that replaces the monolithic \lib/active\_storage\_validations.rb\ with a modular architecture, introducing dedicated analyzer classes (e.g., \ASVFFProbable\ for FFprobe) and explicit requires for validators and form builders, ensuring more robust and maintainable file analysis.
lib · high confidence
Improved MIME type detection and AWS-compatible metadata storage
The gem now extends Marcel's MIME type detection to correctly handle specific file types like RAR, AAC, Theora, and empty files, ensuring accurate content-type validation. Additionally, blob metadata is now stored as flattened key-value pairs prefixed with 'asv\_' rather than nested hashes, which resolves errors with AWS S3 services that only accept string values and ensures compatibility with AWS metadata constraints.
_lib/active\_storage\validations/extensors · high confidence
Migrate test suite from Minitest to RSpec
The gem's test suite has been migrated from Minitest to RSpec, replacing the \rake test\ task with \rake spec\ and introducing RuboCop configuration for RSpec style enforcement. This change updates the development workflow and test runner while keeping the consumer-facing test matchers (for RSpec and Minitest/Shoulda) unchanged.
(repo-wide) · high confidence
Refactored analyzers into a modular architecture with new audio and content-type sniffers
The analyzer subsystem has been restructured into distinct, specialized classes: a new AudioAnalyzer extracts duration, bitrate, sample rate, and audio presence; a new ContentTypeAnalyzer hierarchy introduces a File backend (using the system \file\ command) and a Magika backend (using Google's Magika CLI) for spoofing protection; the ImageAnalyzer is now an abstract base class for concrete implementations; and the PDFAnalyzer now correctly parses fractional page dimensions. Existing Video and Null analyzers remain, providing a cleaner separation of concerns and expanded metadata capabilities for audio and content-type validation.
_lib/active\_storage\validations/analyzer · high confidence
Refactored matcher internals into shared concerns
The internal implementation of the validation matchers has been restructured by extracting shared logic into dedicated modules (such as \ASVActiveStorageable\, \ASVAllowBlankable\, \ASVContextable\, \ASVExceptOnable\, \ASVMessageable\, \ASVRspecable\, \ASVSpoofingProtectable\, \ASVTimeoutable\, and \ASVValidatable\). This change improves code organization and maintainability for the library's test suite without altering the public API or the behavior of the validation matchers themselves.
_lib/active\_storage\validations/matchers/shared · high confidence
Refactored validation logic into shared modules
The validation logic in the gem has been reorganized into a set of shared modules (ASVActiveStorageable, ASVAnalyzable, ASVAttachable, ASVErrorable, ASVLoggable, ASVOptionable, and ASVSymbolizable) to improve code structure and maintainability. This change extracts helper methods for handling Active Storage attachments, analyzing file metadata, managing errors, and processing options into reusable components, ensuring that validators remain explicit and consistent across different file types and Rails versions.
_lib/active\_storage\validations/shared · high confidence
Test coverage
Add PDF test fixtures with decimal dimensions; Added RSpec shared examples for analyzer metadata validation; Added RSpec shared helpers for validator testing; Added RSpec support helpers for analyzers and matchers; Added RSpec test suite for Active Storage Validations matchers; Added RSpec test suite for image analyzers; Added RSpec test suite for locale integrity and Active Storage validations; Added integration tests for validator timeout, thread safety, and metadata caching; Added shared test suites for attachable and errorable validation logic; Added test fixtures and support helpers for file and locale validation; Added test fixtures for MIME type spoofing detection; Added tests for the File and Magika content-type analyzers; Comprehensive RSpec test suite for ActiveStorageValidations; Expanded dummy application models for comprehensive validator testing; Migrate test suite to RSpec with SimpleCov coverage integration; Migrate validator test suite to RSpec; Migrated test suite from Minitest to RSpec; Removed dummy application environment configuration files; Removed legacy Minitest test suite and helper; Removed legacy bin/test script; Simplify dummy app configuration and add DigitalOcean storage support; Updated dummy application test setup; Updated test dummy database schema for Active Storage V2 and expanded validator test coverage.
Dependencies
Updated CI gemfiles for Rails 7.0–8.1 and next
The gemfiles in the gemfiles/ directory have been regenerated to support testing against Rails 7.0.1, 7.1, 7.2, 8.0, 8.1.3.1, and the Rails main branch (8.2.0.alpha). These updates pin specific dependency versions to ensure CI stability: nokogiri is pinned to \>= 1.18 to support Ruby 3.4/4.0, sqlite3 is pinned to \>= 2.9 for Ruby 4.0 compatibility, and json is restricted to \< 3 for Rails 8.1 to avoid breaking changes in JSON.parse. Additionally, rspec-rails is pinned to \~\> 7.0 for Rails 7.0/7.1 and \~\> 8.0 for Rails 7.2/8.0/8.1, and ffi is pinned to \>= 1.17.1 for Rails 8.0.
gemfiles · high confidence
Upgrade to Rails 8.1 and Ruby 3.3 with updated gem dependencies
The gem now requires Ruby 3.3.0 or higher and Rails 7.0.1 or higher, with the local development environment pinned to Rails 8.1.3.1. This update replaces the older Rails 5.2 dependency with modern Active Storage subcomponents (activejob, activemodel, activestorage, activesupport) and enforces marcel \>= 1.0.3 for mime type spoofing detection. Development dependencies have been refreshed to include rspec-rails, combustion, rubocop, and simplecov, while the gemspec metadata has been expanded with standard RubyGems fields.
(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 69 → 71 (+1.2)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 66 → 66 (+0.0)
- Architecture 99 → 99 (+0.0)
- Maturity 61 → 64 (+3.0)
- Readiness 78 → 78 (+0.1)
- Security 94 → 90 (-3.9)
- Performance 90 → 90 (+0.0)
Resolved (6)
- Hotspot: lib/active_storage_validations/matchers/dimension_validator_matcher.rb (lib/active_storage_validations/matchers/dimension_validator_matcher.rb)
- Inconsistent block argument signature in with_media_path. Blob and HashIo accept a block (implied by the block parameter name and typical Ruby pattern for this method), while Base, Uploaded, and Path explicitly show _tempfile as the only parameter, suggesting they do not yield a block or handle it differently. This creates confusion for implementers of the adapter interface.
- Off-boarding risk: anonymized user #1
- Outdated: pry
- Outdated: simplecov
- Outdated: webmock
New (5)
- Medium CVE: [GHSA redacted] (Gemfile.lock)
- Off-boarding risk: anonymized user #1
- Outdated: rspec-rails
- Outdated: vernier
- Repeated repair: lib/active_storage_validations/shared/asv_analyzable.rb (lib/active_storage_validations/shared/asv_analyzable.rb)
Changes since last survey
- 7 commits — 7 feature/other, 0 fixes
By area
- (repo) — 4 commits
- (root) — 3 commits
Notable commits
- change: Add projects banner to README, remove Buy Me A Coffee, point other-gems links to igorkasyanchuk.com
- change: Merge pull request #438 from igorkasyanchuk/dependabot/bundler/simplecov-1.3.2
- change: Merge pull request #440 from igorkasyanchuk/dependabot/bundler/rubocop-1.92.0
- change: Merge pull request #441 from igorkasyanchuk/dependabot/bundler/pry-0.16.1
- change: Merge pull request #442 from igorkasyanchuk/dependabot/bundler/webmock-3.34.0
- change: chore(deps-dev): bump pry from 0.16.0 to 0.16.1
- change: chore(deps-dev): bump webmock from 3.26.4 to 3.34.0
Architecture
- Unchanged — 0 containers · 1 contexts · 0 edges
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
igorkasyanchuk/active_storage_validations 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 6 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 4ca327ade365f280be75be061e9420aec59b221e — 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.2+preprod-5c4e66d9318b.