Skip to content
CAI
Software that uses CAICheck a score

izelnakri/paper_trail

56.5

Adequate · 3 October 2026

1.3k

lines of production code

Elixir

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is an Elixir library that provides audit trail and versioning capabilities for Ecto models. It tracks insert, update, and delete operations by storing historical records in a dedicated versions table, supporting both simple and strict versioning modes. The library integrates with Ecto.Multi for atomic transactions and includes utilities for querying version history, handling multi-tenancy via schema prefixes, and supporting various primary key types including UUIDs.

How it got here

2016 — Initial project scaffolding and Ecto integration

13 changes.

This period established the foundational structure of the PaperTrail library, including CI infrastructure, database migrations, and core Ecto integration for versioned operations. It introduced the \mix paper\_trail.install\ task, Ecto.Multi support for atomic transactions, and a comprehensive example application to demonstrate usage and test coverage.

2017–2020 — UUID and multi-tenant test coverage

8 changes.

This period focused on expanding test coverage to support UUID primary keys and multi-tenant scenarios. New test suites, helper modules, and schema migrations were added to verify PaperTrail's behavior with non-standard primary keys and tenant isolation. The work also included automating the test execution workflow and refining the versioning schema to support configurable originator fields.

Features

Added example application configuration for development and testing

The example application now includes environment-specific configuration files (dev.exs and test.exs) that define Ecto repository settings for a Postgres database. These files configure the database connection details, such as hostname, username, and pool size, allowing the example app to connect to local Postgres instances for development and testing purposes.

example/config · high confidence

Added example application with Ecto models and supervision tree

The example application now includes core Ecto schema definitions for Company and Person entities, complete with changesets for data validation and association handling. A Repo module is configured to use the Postgres adapter, and an Application module sets up a supervision tree to manage the repository process, providing a functional starting point for interacting with the database.

example/lib · high confidence

Added mix paper\_trail.install task to generate migration files

Users can now run the new \mix paper\_trail.install\ task to automatically generate a database migration file for the \versions\ table. The generated migration includes standard columns for tracking changes (event, item\_type, item\_id, item\_changes) and allows configuration of the timestamp column type via the \:paper\_trail\ application environment, defaulting to \:utc\_datetime\.

lib/mix · high confidence

Automated test execution script added

A new shell script (scripts/test.sh) has been introduced to streamline the testing workflow. When executed, it automatically determines the Docker image tag from the current Git commit hash, loads environment variables from a .env file, and runs the test suites for paper\_trail, version, and uuid modules using the Mix test runner.

scripts · high confidence

Ecto Multi support for versioned operations

The library now supports \insert\, \update\, and \delete\ operations that atomically create a version record alongside the model change using Ecto.Multi. This ensures that versioning is consistent with the main database transaction, and the API returns a unified result containing both the model and the version struct, or an error if either step fails.

lib · high confidence

Example app database schema and versioning support

The example application now includes the necessary Ecto migrations to initialize its database schema. This adds tables for companies and people, establishing a relationship where people belong to companies. Additionally, a versions table is created to support audit logging, storing event details, item changes, and metadata, with a specific index on the originator\_id field to track who made changes.

example/priv · high confidence

Initial example application scaffolding

Added a new example application to demonstrate usage of the library, including a \.gitignore\ file to exclude build artifacts, an \.iex.exs\ configuration to automatically import Ecto queries, and a \README.md\ with installation instructions for adding the package via Hex.

example · high confidence

Initial project scaffolding and CI infrastructure

The repository has been initialized with core Elixir project configuration files, including \.formatter.exs\, \.editorconfig\, and a \.env\ template for environment variables. To support development and continuous integration, a Dockerfile and \docker-compose.yaml\ have been added to containerize the application and a PostgreSQL 16 database, featuring a health check for the database service. A \setup-database.sh\ script is included to handle database initialization within the container, and the \.gitignore\ has been expanded to cover standard Elixir build artifacts and temporary files.

(repo-wide) · high confidence

New Ecto.Multi integration and version query utilities

This release introduces \PaperTrail.Multi\ to allow versioning operations (insert, update, delete, insert\_or\_update) to be composed within Ecto.Multi transactions, ensuring atomicity. It adds \PaperTrail.VersionQueries\ for retrieving version history with support for schema prefixes (e.g., multi-tenancy). Additionally, \PaperTrail.Serializer\ now properly serializes Ecto embedded schemas, and configuration for the originator field is centralized in \PaperTrail.RepoClient\.

_lib/paper\trail · high confidence

Behavioural changes

Database schema updates for strict versioning and data integrity

The repository migrations now include tables for strict versioning (\strict\_companies\, \strict\_people\) which track \first\_version\_id\ and \current\_version\_id\ to enforce versioned data integrity, alongside a new \users\ table and a \versions\ table for audit trails. Additionally, a uniqueness constraint has been added to the \name\ column for both \simple\_companies\ and \strict\_companies\ to prevent duplicate entries.

priv/repo · high confidence

Migrate to Elixir 1.9+ config syntax and add environment-specific config files

The configuration system has been updated to use the modern \import Config\ syntax instead of the deprecated \use Mix.Config\. Environment-specific settings are now explicitly managed through new \config/dev.exs\ and \config/test.exs\ files, with the test environment defining multiple Ecto repositories (including UUID variants) and using environment variables for database credentials. The main \config.exs\ now unconditionally imports the environment-specific config file, ensuring that development and test environments are properly isolated and configured.

config · high confidence

Support for configurable originator field options in versioning schema

The versioning schema now supports configurable originator fields, allowing the \originator\_id\ column in the \versions\ table to reference the \people\ table via a UUID primary key. This change enables tracking who initiated specific versioning events, with an index added to optimize lookups by originator. Additionally, the \item\_id\ column now supports both binary IDs and strings depending on environment configuration, providing flexibility in how tracked items are identified.

_priv/uuid\_with\_custom\_name\repo · high confidence

Test coverage

Added MultiTenantHelper test support module; Added UUID-based schema migrations for testing; Added example application tests for PaperTrail; Added test support helpers and models for multi-tenancy and UUID primary keys; Added tests for UUID primary key support and custom originator configurations; Added tests for versioning and version queries; Expanded test coverage for PaperTrail bang functions and core operations; Test suite initialization and configuration updated.

Dependencies

Upgrade to Elixir 1.17 and Ecto 3.12 with new release tooling

The library now requires Elixir 1.17 and upgrades its core dependencies to Ecto 3.12.2 and Ecto SQL 3.12.0, replacing the previous Ecto 2.x and Elixir 1.2 constraints. This update also introduces \ex\_doc\ for documentation generation, restricts \jason\ and \postgrex\ to development and test environments, and adds an example application (\example/mix.exs\) demonstrating the library with Ecto 3.0-rc. Additionally, the project integrates \release-it\ and \auto-changelog\ via \package.json\ to automate versioning and changelog updates for both Hex and npm releases.

(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 59 → 56 (-2.8)
  • Rubric changed (rubric-2026.09.15 → rubric-2026.10.1) — scores are not directly comparable.

Lenses

  • Code Health 100 → 100 (+0.0)
  • Architecture 69 → 69 (+0.0)
  • Maturity 49 → 49 (+0.0)
  • Readiness 72 → 53 (-19.0)
  • Security 61 → 66 (+4.5)

Resolved (1)

  • Documentation: no installation or build instructions (README.md)

New (2)

  • High CVE: [GHSA redacted] (package-lock.json)
  • High CVE: [GHSA redacted] (package-lock.json)

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

Survey your own repository

izelnakri/paper_trail 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 3 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 5aae29eabe62706739ba035c89bcf82f457fe27d — the exact code this score is about.
  • Scored under rubric-2026.10.1 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-8fe32cd45d00.