Skip to content
CAI
Software that uses CAICheck a score

palkan/logidze

62.1

Adequate · 19 September 2026

1.2k

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

Logidze is a Ruby gem that provides audit logging and version tracking for ActiveRecord models in PostgreSQL applications. It captures historical data changes using database triggers and stores them in JSONB columns, supporting both inline and detached storage strategies. The system offers features such as time-travel queries, diff generation, column filtering, and configurable history compaction to manage audit data efficiently.

How it got here

2016 — Rails 6 upgrade and generator expansion

22 changes.

The project upgraded to Rails 6 and modernized its infrastructure, including CI/CD and test suites, while dropping support for older Ruby and Rails versions. Significant features were added through new install and model generators that support detached storage, FX gem integration, and advanced configuration options. The period also introduced global behavior toggles, performance benchmarks, and comprehensive test coverage for the new functionality.

2017–2020 — Feature expansion and performance benchmarking

10 changes.

This period focused on expanding Logidze's capabilities by adding support for the fx gem, AFTER triggers, and detached storage modes, while updating core database functions for better exception handling and history compaction. Significant effort was also directed toward infrastructure, including comprehensive SQL and integration test coverage, expanded Rails version compatibility, and the creation of a dedicated benchmarking environment to measure performance.

2021–2025 — Logidze audit history integration

4 changes.

The project integrated the Logidze gem to implement comprehensive audit logging, introducing a dedicated LogidzeData model and generator for scalable, separate storage of historical changes. This period also established runtime safety by adding middleware to detect and warn about pending PostgreSQL function upgrades, ensuring data integrity during the transition.

Features

Add performance benchmarks comparing Logidze and PaperTrail

A new benchmark suite has been added to the \bench/performance\ directory to compare the performance of Logidze (including its detached mode) against PaperTrail and plain ActiveRecord operations. The suite includes scripts for measuring insert and update speeds, the performance of retrieving diffs between versions, and the efficiency of fetching version history at specific timestamps. It also provides memory profiling results to highlight the memory overhead differences between the libraries, with detailed results documented in the new README.

bench/performance · high confidence

Add support for AFTER triggers via --after\_trigger option

The generator now supports creating AFTER triggers in addition to the default BEFORE triggers. This is controlled by the new --after\_trigger option, which generates SQL using the logidze\_logger\_after procedure and includes a pg\_trigger\_depth check to prevent recursive trigger firing. The default behavior remains unchanged, generating BEFORE triggers via logidze\_logger.

lib/generators/logidze/model/triggers · high confidence

Add support for the fx gem in logidze model generation

The logidze:model generator now supports the fx gem. Users can pass the --fx option to generators to enable functionality provided by the fx gem, with the system automatically detecting if the gem is available in the environment.

lib/generators/logidze · high confidence

Add trigger performance benchmarks for hstore and jsonb variants

Added a new benchmark suite in bench/triggers to compare the performance of different database trigger implementations for tracking record changes. The suite includes benchmarks for plain updates, hstore-based triggers, hstore with a jsonb fallback exception handler, two jsonb-minus approaches, and two key-iteration approaches. It also includes a Makefile to run these benchmarks using pgbench and documentation of the results, helping users understand the performance trade-offs between these change-tracking strategies.

bench/triggers · high confidence

Added Logidze performance benchmark infrastructure

This change introduces the database schema and SQL functions required to benchmark the Logidze auditing library. It adds six PL/pgSQL functions (\logidze\_logger\, \logidze\_version\, \logidze\_snapshot\, \logidze\_filter\_keys\, \logidze\_compact\_history\, \logidze\_capture\_exception\) and corresponding ActiveRecord migrations to set up \logidze\_users\ and \logidze\_detached\_users\ tables. The setup includes enabling the \hstore\ extension, creating a separate \logidze\_data\ table for detached storage, and configuring triggers to capture change history for performance testing.

bench/performance/db · high confidence

Added Rails application configuration for performance benchmarks

A new standalone Rails application has been added to the \bench/performance/config\ directory to serve as the environment for running performance benchmarks. This setup includes standard Rails boot and environment initialization files, a PostgreSQL database configuration pointing to the \logidze\_perf\_bench\ database, and an application configuration that enables eager loading and permits specific time-related classes in YAML columns.

bench/performance/config · high confidence

Added development and setup scripts for the dummy application

New executable scripts have been added to the bin directory to streamline local development. The bin/console script provides an interactive Ruby console with Rails and Logidze pre-loaded. The bin/setup script automates the initial environment configuration by installing Bundler, resolving dependencies, and running database migrations for the dummy test application. Additionally, bin/rubocop was added to run code style checks using a specific gemfile.

bin · high confidence

Added runtime check for pending Logidze function upgrades

Logidze now includes a new \CheckPending\ Rack middleware that verifies whether the PostgreSQL functions installed in the database match the versions defined in the library. If a mismatch is detected, the application will either log a prominent warning or raise a \PendingMigrationError\ (configurable via \Logidze.on\_pending\_upgrade\), prompting the user to run the \logidze:install --update\ generator and apply the migration to ensure correct behavior.

lib/logidze/utils · high confidence

Introduction of LogidzeData model for history tracking

A new \LogidzeData\ model has been added to the application, inheriting from \ApplicationRecord\. This model is designed to store historical data changes using the Logidze gem, featuring a \log\_data\ attribute typed as \Logidze::History::Type\ and a polymorphic association to a \loggable\ record. This change enables the application to track and persist audit logs for associated models.

app/models · high confidence

New generator for separate log storage table

Users can now run \rails generate logidze:migration:logs\ to create a dedicated \logidze\_data\ table for storing audit logs separately from the main entity. This new generator produces a migration that creates a \logidze\_data\ table with a JSONB column for log data and a polymorphic association to the loggable record, allowing for more scalable storage of change history.

lib/generators/logidze/migration · high confidence

New install generator templates for hstore and function migrations

The library now includes new ERB templates for the install generator, providing distinct migration strategies for different database setups. The \hstore.rb.erb\ template enables the hstore extension, while \migration.rb.erb\ and \migration\_fx.rb.erb\ handle the creation of Logidze trigger functions, with the latter supporting reversible migrations via the \fx\ gem to manage version upgrades safely.

lib/generators/logidze/install/templates · high confidence

New install generator with FX gem support and update migrations

The Logidze gem now includes an install generator (\rails generate logidze:install\) that creates the necessary migration files to set up audit triggers. Users can optionally pass the \--fx\ flag to generate schema.rb-compatible migrations using the \fx\ gem, which separates SQL function definitions into individual files. The generator also supports an \--update\ flag to create version-specific update migrations for existing installations, allowing for smoother upgrades of the audit functionality.

lib/generators/logidze/install · high confidence

New model generator with advanced trigger and logging options

A new \logidze:model\ generator has been added, allowing users to scaffold migrations and model modifications for audit logging. The generator supports configuring detached history storage (\--detached\), setting history size limits (\--limit\), and applying debounce times to reduce changelog spam (\--debounce\_time\). It also enables column filtering via whitelist (\--only\) or blacklist (\--except\) options, allows specifying a custom timestamp column, and supports updating existing triggers (\--update\) or generating trigger-only migrations (\--only\_trigger\). Additionally, it handles legacy data backfilling (\--backfill\) and integrates with PostgreSQL foreign-key triggers (\fx\) and prefixed/suffixed table names.

lib/generators/logidze/model · high confidence

Behavioural changes

Configurable model migration generator with backfill and FX support

The Logidze model generator now produces migrations that support several new configuration options: a --backfill flag to populate existing records with historical data, an --after\_trigger option to customize trigger timing, and support for table name prefixes and suffixes. It also introduces an --update flag for upgrading existing installations and handles legacy data migration by dropping old triggers. Additionally, the generator now supports the FX (foreign key) extension for trigger management and uses statement\_timestamp() instead of now() for better transactional accuracy.

lib/generators/logidze/model/templates · high confidence

Introduce dedicated History type and Version model for JSONB storage

The library now uses a dedicated \Logidze::History::Type\ class inheriting from \ActiveModel::Type::Value\ to handle JSONB serialization and deserialization, replacing the previous coder-based approach. This change ensures proper type casting for Rails 5+ compatibility and marks the history attribute as mutable. Additionally, a new \Logidze::History::Version\ model is introduced to represent individual log entries, exposing attributes like \version\, \changes\, \time\, and \responsible\_id\, along with support for meta information.

lib/logidze/history · high confidence

Introduces global configuration and behavior toggles for Logidze

The library now exposes a central configuration object (Logidze) allowing users to control core behaviors without modifying individual model definitions. Key options include disabling association versioning by default, configuring how the system handles empty log data (returning self vs nil), setting the default placement of log data (inline vs detached), and defining the action taken when a database schema upgrade is pending. Additionally, users can temporarily disable database triggers via \without\_logging\ or force full snapshots for new versions using \with\_full\_snapshot\.

lib · high confidence

Logidze gem upgraded to version 1.4.1

The Logidze gem has been updated to version 1.4.1. This release includes significant architectural changes such as the introduction of a detached mode for storing log data in a separate table, configurable meta information attachment via \with\_meta\ and \with\_responsible\, and support for versioned associations. It also adds methods for resetting log data, creating snapshots, and browsing history, while dropping support for older Rails and Ruby versions.

lib/logidze · high confidence

Repository maintenance and documentation overhaul

This update replaces the legacy Travis CI configuration with GitHub Actions and introduces a lefthook pre-commit setup to enforce code style (RuboCop, Markdown linting) and link checking. It also migrates the Ruby linter from RuboCop to the Standard gem, updates the .gitignore to exclude more editor and build artifacts, and significantly expands the README with comprehensive installation, configuration, and usage guides while adding a RELEASING guide and CHANGELOG.

(repo-wide) · high confidence

Updated Logidze database functions with new exception handling and compaction logic

The installed database functions have been updated to version 5 for the main logger and version 3 for snapshots, introducing several behavioral improvements. A new \logidze\_capture\_exception\ function allows users to customize how database errors are handled during logging (raising or committing). The \logidze\_compact\_history\ function has been added to manage history size limits more effectively. Additionally, the logger now supports a \--detached\ mode for storing log data in a separate table, improves JSONB handling with fallbacks for \hstore\_to\_jsonb\_loose\, and ensures \log\_data\ is consistently removed from snapshots to prevent circular references.

lib/generators/logidze/install/functions · high confidence

Fixes

Prevents duplicate trigger definitions in database schema dumps

The \etc/dump\_triggers.rake\ script has been added to resolve an issue where duplicate trigger definitions appeared in \schema.rb\ when multiple database schemas were present. This change modifies the Postgres adapter's \all\ method to deduplicate triggers by name during the \rails db:\<schema\>\ execution, ensuring cleaner and more accurate schema dumps.

etc · high confidence

Test coverage

Add test environment configuration for the dummy Rails application; Add test environment configuration for the dummy application; Added RSpec matchers for file existence and timestamp validation; Added SQL spec tests for history compaction, key filtering, snapshots, and versioning; Added acceptance tests for Logidze migration and model generation; Added dummy application models for testing; Added integration tests for log tracking features; Added test coverage for Logidze core features; Added test database schema for partitioned tables and JSONB support; Added test helpers and cleanup contexts for SQL and migration specs; Added test support helpers for acceptance, database, and time utilities; Added tests for Logidze utility functions and pending upgrade checks; Added tests for install, logs, and model generators; Refactored test suite infrastructure and added acceptance specs.

Dependencies

Expanded Rails version support in test suite

The test suite now supports Rails versions 6.0, 7.0, 7.1, 7.2, and 8.0, as well as the Rails master branch, by introducing dedicated Gemfiles for each target version. This change ensures compatibility across a broader range of Rails releases during development and testing.

gemfiles · high confidence

Upgrade to Rails 6+ and modernize dependencies

The gem now requires Ruby \>= 2.7.0 and Rails \>= 6.0 (via railties and activerecord), dropping support for older versions. Development dependencies have been updated to modern versions, including pg \>= 1.0, rake \>= 13.0, and rspec-rails \>= 4.0, while concurrently pinning concurrent-ruby to 1.3.4 to work around a known Rails issue.

(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

Baseline

  • First survey — no prior run to compare against. CAI 62.

Lenses

  • Code Health 100
  • Architecture 69
  • Maturity 51
  • Readiness 70
  • Security 66
  • Domain Modelling 100

Changes since last survey

  • 300 commits — 245 feature/other, 55 fixes

By area

  • (root) — 138 commits
  • lib/logidze — 50 commits
  • lib/generators — 43 commits
  • .github/workflows — 14 commits
  • spec/dummy — 11 commits
  • bench/performance — 9 commits
  • spec/integration — 6 commits
  • (repo) — 5 commits
  • spec/integrations — 4 commits
  • bench/triggers — 3 commits
  • spec/support — 3 commits
  • spec/acceptance — 2 commits
  • spec/acceptance_helper.rb — 2 commits
  • spec/generators — 2 commits
  • spec/logidze — 2 commits
  • .dockerdev/.bashrc — 1 commit
  • app/models — 1 commit
  • bin/rubocop — 1 commit
  • gemfiles/rails6.gemfile — 1 commit
  • gemfiles/rails7.gemfile — 1 commit

Notable commits

  • fix: - mdl fix
  • fix: Add fix and test for article when it had no associated model
  • fix: Add rubocop fixes and model specs for style
  • fix: Apply the use of <<~ on all the SQL statements. Fix some rubocop offenses
  • fix: Fix #at vs filter_map bug
  • fix: Fix .rubocop.yml
  • fix: Fix Gemfile warning, allow more recent versions of Rails 7.0
  • fix: Fix README
  • fix: Fix columns filtering
  • fix: Fix compacting when the log size is greater than limit
  • fix: Fix creating empty versions, when only blacklisted columns are updated
  • fix: Fix default scope test
  • fix: Fix destroy not deleting fx trigger file (#249)
  • fix: Fix docs
  • fix: Fix docs: correct detached mode command nd add note on upgrading logdize_logger
  • fix: Fix ignore log data in 4.2
  • fix: Fix options in README
  • fix: Fix preparing test db
  • fix: Fix rails 5.2.1 compatibility in versioned association
  • fix: Fix require active_model/type for Rails 5.2
  • …and 280 more

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

Survey your own repository

palkan/logidze 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 19 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 73c4bffd0e76b1e6d025a781d04f0fba43bf47fc — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.