Skip to content
CAI
Software that uses CAICheck a score

zdennis/activerecord-import

56.6

Adequate · 28 September 2026

2.3k

lines of production code

Ruby

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Ruby gem that provides bulk import and upsert capabilities for ActiveRecord models across multiple database adapters. It enables high-performance data insertion with support for large payloads, validation handling, and conflict resolution via upserts. The library maintains compatibility with a wide range of ActiveRecord versions and database drivers, including MySQL, PostgreSQL, and SQLite, while offering benchmarking tools to measure performance against different storage engines.

Features

Add MySQL benchmark schema with MyISAM, InnoDB, and Memory engines

A new schema file for MySQL benchmarks has been added, defining three test tables (test\_myisam, test\_innodb, test\_memory) that explicitly specify their storage engines (MyISAM, InnoDB, and Memory respectively) to support benchmarking across different MySQL storage backends.

benchmarks/schema · high confidence

Expanded database adapter support for ActiveRecord import

The library now supports a wider range of database connection adapters, including new additions for Trilogy and Trilogy Proxy, as well as JDBC variants for MySQL, PostgreSQL, and SQLite3. Existing adapters for MySQL2, PostgreSQL, SQLite3, and Seamless Database Pool are also explicitly wired up in this location to ensure the import functionality is correctly included in their respective ActiveRecord connection adapter classes.

_lib/activerecord-import/active\record · high confidence

Restored and documented benchmark execution capabilities

The benchmarking suite has been re-enabled, allowing users to run performance tests via the \benchmark.rb\ script. The tool now supports specifying database adapters (currently limited to MySQL), defining the number of objects to benchmark, and exporting results to CSV or HTML formats. A new README file documents these usage options and limitations.

benchmarks · high confidence

Removals

Removal of ActiveRecord import functionality

The \lib/ar-extensions/import.rb\ file has been deleted, removing the \import\ method and associated support modules (such as \supports\_import?\ and \on\_duplicate\_key\_update\) from ActiveRecord models. Users can no longer perform bulk imports of model collections or value arrays directly via this extension.

lib/ar-extensions · high confidence

Architecture

Add RuboCop configuration and project scaffolding files

The project now includes a RuboCop configuration (.rubocop.yml) targeting Ruby 3.0.x with most metrics and style checks disabled, alongside a generated .rubocop\_todo.yml to track existing offenses. Standard project scaffolding files have been added, including a .gitignore for common development artifacts, a Brewfile for local database dependencies (MySQL, PostgreSQL, SQLite), a Dockerfile for containerized development, and a docker-compose.yml for running test environments with MySQL 8.0 and PostGIS. A Rakefile has been introduced to manage tests across multiple database adapters and run RuboCop checks.

(repo-wide) · high confidence

Behavioural changes

Refactored adapter architecture with new proxy support and upsert capabilities

The adapter layer has been restructured to separate core import logic from database-specific implementations, introducing an AbstractAdapter base and dedicated adapters for MySQL, PostgreSQL, and SQLite3. This change adds support for upsert operations (ON DUPLICATE KEY UPDATE/IGNORE) across all supported databases, allowing users to handle duplicate key conflicts during bulk imports. Additionally, new proxy adapters (e.g., Mysql2ProxyAdapter, PostgreSQLProxyAdapter) are introduced to support ActiveRecord's multi-database role routing, ensuring imports respect the writing role. The MySQL adapter now correctly handles large payloads by splitting them into multiple transactions if they exceed the server's max\_allowed\_packet, and PostgreSQL imports now support returning inserted IDs and custom columns via the RETURNING clause.

lib/activerecord-import/adapters · high confidence

Renamed library from ActiveRecord::Extensions to ActiveRecord::Import

The library has been renamed from ActiveRecord::Extensions to ActiveRecord::Import. The main entry point has moved from lib/ar-extensions.rb to lib/activerecord-import.rb, which now uses ActiveSupport lazy load hooks to require the base implementation only after ActiveRecord is loaded, replacing the previous direct requires and module definition.

lib · high confidence

Restored benchmarking suite with CLI and output options

The benchmarking library has been re-enabled and refactored to support command-line execution. Users can now run benchmarks via a new CLI parser that accepts options for the database adapter (defaulting to mysql2), the number of objects to test, and specific table types. The suite includes a base benchmark runner that executes create and import operations with and without validations, and it supports exporting results to CSV or HTML reports. The HTML output includes speedup comparisons against the default create method, and the runner automatically clears tables before each benchmark run.

benchmarks/lib · high confidence

activerecord-import version 2.3.0 release

This release updates the gem to version 2.3.0. The diff shows the introduction of a new \ValueSetsBytesParser\ class in \value\_sets\_parser.rb\ which handles splitting value sets based on byte size limits, raising a \ValueSetTooLargeError\ if the limit is exceeded. The \base.rb\ file now includes logic to load adapters from a connection pool, supporting both older ActiveRecord versions (using \spec.config\[:adapter\]\) and newer ones (using \db\_config.adapter\). The \import.rb\ file contains the core import logic, including a \Validator\ class that handles validation callbacks with compatibility for various ActiveRecord versions, and supports importing through associations via \bulk\_import\. The \synchronize.rb\ file provides a method to refresh model instances from the database in bulk. These changes collectively enhance the library's ability to handle large imports safely and maintain compatibility across different ActiveRecord versions.

lib/activerecord-import · high confidence

Test coverage

Add test infrastructure for Janus, Trilogy, and JDBC database adapters; Added benchmark model definitions for InnoDB, Memory, and MyISAM storage engines.

Dependencies

Expanded CI support for Rails 5.2 through 8.2

The project now includes dedicated Gemfiles to test compatibility with Rails versions 5.2, 6.0, 6.1, 7.0, 7.1, 7.2, 8.0, 8.1 (beta), and 8.2 (main branch). For Rails versions 5.2 through 7.0, the \composite\_primary\_keys\ gem is explicitly included to ensure support for composite primary keys, while newer versions (7.1+) rely on built-in ActiveRecord support. The addition of the 8.2 Gemfile tracks the Rails main branch to surface upstream changes, such as ActiveModel validation context modifications, before they reach stable releases.

gemfiles · high confidence

Update ActiveRecord dependency to \>= 4.2 and modernize Gemfile

The gemspec now requires ActiveRecord \>= 4.2, dropping support for older versions. The Gemfile has been significantly restructured to support testing against multiple ActiveRecord versions (via AR\_VERSION) and Ruby versions, including specific adapter version pinning for mysql2, sqlite3, and pg, conditional inclusion of trilogy/activerecord-trilogy-adapter for AR 6.0+, and updated development dependencies like rubocop and factory\_bot.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 58 → 57 (-1.4)
  • Rubric changed (rubric-2026.09.8 → rubric-2026.09.16) — scores are not directly comparable.

Lenses

  • Code Health 87 → 87 (+0.0)
  • Architecture 100 → 84 (-16.5)
  • Maturity 56 → 57 (+0.3)
  • Readiness 38 → 38 (-0.4)
  • Security 96 → 97 (+0.8)
  • Domain Modelling 100 → 100 (+0.0)

Resolved (4)

  • Documentation: no contributor guidance (README.markdown)
  • Documentation: no installation or build instructions (README.markdown)
  • Documentation: no usage examples (README.markdown)
  • Off-boarding risk: anonymized user #1

New (5)

  • Inconsistent method signatures for the same operation. Both parser classes expose a 'parse' method that takes arguments and a 'parse' method that takes no arguments (likely using instance state). This is confusing for API consumers who must know whether to pass arguments or set state first.
  • Inconsistent naming for benchmark entry points. 'bm' is an abbreviation, while 'bm_model' is explicit. Both perform benchmarking but accept different argument structures (code block vs data arrays).
  • Off-boarding risk: anonymized user #1
  • Redundant methods with identical intent. 'print_banner' and 'print_banner!' likely differ only in side effects (e.g., forcing output vs conditional), but having two public methods for the same conceptual action is confusing.
  • Standard Ruby convention uses '!' to denote a bang method that raises exceptions or modifies state more aggressively. However, without documentation, it is unclear if 'bulk_import' silently fails or returns a Result object while 'bulk_import!' raises. This is a minor inconsistency in naming convention clarity.

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

zdennis/activerecord-import 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 28 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit a2a28539ed73875baee1b63ec4f542d5185bcd24 — the exact code this score is about.
  • Scored under rubric-2026.09.16 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-2d9048c36d26.