Skip to content
CAI
Software that uses CAICheck a score

okuramasafumi/alba

76.9

Strong · 20 September 2026

2.6k

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is the Alba Ruby library, a serialization framework that converts Ruby objects into JSON. It provides configuration APIs for handling associations, conditional attributes, and type validation, with optional integration for Rails and performance optimizations via backends like Oj. The project includes comprehensive static type checking via RBS, extensive test coverage, and a benchmark suite for comparing serialization performance.

How it got here

2020 — v4.0.0 release and type safety

7 changes.

The project underwent a major architectural rewrite to version 4.0.0, introducing a comprehensive configuration API, Rails integration, and a new type system for serialization. This release was accompanied by the integration of RBS type checking via Steep to enforce type safety and extensive updates to dependencies for Ruby 3.0+ support.

2021–2026 — Type safety and testing expansion

7 changes.

This period focused on enhancing the library's reliability and developer experience by introducing RBS type signatures for static analysis and expanding test coverage with property-based and integration tests. It also added a comprehensive benchmark suite to evaluate performance against other Ruby JSON serializers and provided type-checked example scripts to demonstrate core features.

Features

Add RBS type checking and Steep integration

The project now includes RBS type signatures and Steep configuration to enforce type safety. A new \Steepfile\ defines the type-checking targets, and the \Rakefile\ exposes \rake typecheck\, \rake rbs\, and \rake steep\ tasks to validate the codebase. The CI configuration has been updated to run these checks, ensuring that API and type changes are accompanied by correct signatures.

(repo-wide) · high confidence

Add examples directory with type-checked demonstration scripts

The library now includes an \examples\ directory containing a suite of Ruby scripts that demonstrate core features such as circular associations, conditional attributes, custom types, polymorphic associations, and metadata handling. A \Steepfile\ has been added to enable static type checking for these examples against the library's signatures, ensuring the demonstrated usage patterns are type-safe.

examples · high confidence

Initial RBS type signature files added

The \sig/alba\ directory now contains a comprehensive set of RBS type definition files (including \association.rbs\, \resource.rbs\, \nested\_attribute.rbs\, and others) that formally describe the types for the Alba serialization library's classes, methods, and instance variables. This addition enables static type checking and improved IDE support for Ruby developers using the library.

sig/alba · high confidence

Initial RBS type signature support for Alba

This change introduces RBS type signatures to the library, enabling static type checking for users who adopt the RBS ecosystem. The \sig/\ directory now contains \alba.rbs\ defining the core module interfaces and types, \external.rbs\ providing minimal declarations for optional dependencies like ActiveSupport and Rails, and a \manifest.yaml\ listing the required signature dependencies (rbs, logger, json, erb, forwardable). This allows tools like Steep to verify type correctness against the Alba API.

sig · high confidence

New benchmark suite for comparing Ruby JSON serializers

The benchmark directory now includes a comprehensive suite for evaluating the performance of various Ruby JSON serialization libraries. This addition introduces scripts (\collection.rb\, \single\_resource.rb\) and a shared setup (\prep.rb\) that benchmark serializers including Alba, Barley, Blueprinter, Fast Serializer Ruby, Jserializer, Panko, PropsTemplate, Representable, and others against a shared dataset. The suite supports configuration for YJIT and Oj optimizations, and a new README documents the hardware environment and provides detailed performance results comparing execution speed and memory allocation across these libraries.

benchmark · high confidence

Behavioural changes

Alba library upgraded to version 4.0.0

The Alba serialization library has been updated to version 4.0.0. This release introduces a comprehensive rewrite of the internal architecture, including new dedicated classes for handling associations, conditional attributes, nested attributes, and type validation. It also adds Rails integration via a Railtie for controller helpers, implements a layout system for wrapping serialized output, and establishes a new type system with auto-conversion capabilities.

lib/alba · high confidence

Apply frozen string literal pragma to bin/console

The bin/console script now includes the frozen\_string\_literal: true directive, ensuring that all string literals in the file are immutable by default. This change improves memory efficiency and prevents accidental string mutation within the console environment.

bin · high confidence

Major refactoring of the Alba core module with new serialization shortcuts and configuration APIs

The lib/alba.rb file has been significantly expanded and restructured, introducing a comprehensive set of configuration methods (backend, encoder, inflector, default\_superclass) and new public APIs for easier usage. Key additions include the \Alba.serialize\ and \Alba.hashify\ shortcut methods that allow inline resource definition and automatic resource class inference, replacing the previous pattern of explicitly defining resource classes. The module now handles key transformation (symbolize/stringify) and type registration internally, and includes Rails integration via a railtie. This change represents a shift from a minimal library to a more feature-rich, opinionated serialization framework with improved developer experience.

lib · high confidence

Test coverage

Added alternative gemfiles for testing without ActiveSupport and Oj; Added property-based tests for serialization logic; Added test coverage for association source, circular associations, and key transformation; Added test coverage for resource serialization and Alba configuration; Added tests for Rails integration and dependency handling.

Dependencies

Updated dependencies and gem metadata for Ruby 3.0+ support

The project has updated its dependency constraints to support Ruby 3.0 and newer, dropping support for older versions. Key dependency updates include bumping \rubocop\ to \~\> 1.91.0, \rubocop-minitest\ to \~\> 0.40.0, \rubocop-performance\ to \~\> 1.27.0, \rubocop-md\ to \~\> 2.0, and \rubocop-rake\ to \~\> 0.7.1. Testing dependencies were updated to \minitest\ \~\> 6.0 (for Ruby 3.2+) and \simplecov\ \~\> 1.0, with conditional versioning for \json\ and \minitest\ based on Ruby version. A new \benchmark/Gemfile\ was added to isolate benchmark dependencies, including serializers like \barley\, \props\_template\, and \rabl\. The gemspec metadata was completed with proper URLs for bug tracker, changelog, documentation, and source code, and the required Ruby version was set to \>= 3.0.0.

(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 77.

Lenses

  • Code Health 100
  • Architecture 100
  • Maturity 69
  • Readiness 79
  • Security 78
  • Domain Modelling 100

Changes since last survey

  • 300 commits — 269 feature/other, 31 fixes

By area

  • (repo) — 91 commits
  • (root) — 88 commits
  • .github/workflows — 58 commits
  • lib/alba — 33 commits
  • sig/alba — 7 commits
  • test/usecases — 7 commits
  • benchmark/Gemfile — 3 commits
  • lib/alba.rb — 3 commits
  • benchmark/collection.rb — 2 commits
  • benchmark/prep.rb — 2 commits
  • .github/FUNDING.yml — 1 commit
  • benchmark/README.md — 1 commit
  • benchmark/views — 1 commit
  • docs/migrate_from_active_model_serializers.md — 1 commit
  • test/alba_test.rb — 1 commit
  • test/pbt — 1 commit

Notable commits

  • fix: Fix trait instance method access and add caching (#452)
  • fix: Merge pull request #436 from okuramasafumi/fix-select-with-trait
  • fix: Merge pull request #475 from jkmcrg/fix-hash-object-resource-methods
  • fix: Merge pull request #484 from kinoppyd/fix/typo_on_readme_format
  • fix: Merge pull request #502 from okuramasafumi/copilot/fix-trait-attribute-issue
  • fix: Merge pull request #503 from okuramasafumi/fix-helper-in-nested-attributes
  • fix: Merge pull request #524 from JohnnyKei/fix/serialize-params-with-resource
  • fix: Revert "[CI] Run CI against ruby-head and windows-latest"
  • fix: [Bench] Fix Barley serialization
  • fix: [Benchmark] Fix Barley Array results in output check
  • fix: [Chore] Fix Gemfile syntax error
  • fix: [Chore] Fix gem version string
  • fix: [Chore] Fix the wrong heading in CHANGELOG
  • fix: [Chore] Fix wrong format of README
  • fix: [Chore] Fix wrong gem name in push_gem.yml
  • fix: [Doc] Fix style of the code in README
  • fix: [Fix] Add test for serializing a hash with a resource method
  • fix: [Fix] Call #nil? on attribute values only when a nil handler is set
  • fix: [Fix] Clear trait subclass attributes before eval instead of snapshot comparison
  • fix: [Fix] Enable to apply traits for associations
  • …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

okuramasafumi/alba 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 20 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 f95b89af19c6c2bc5d6df7ca4c0fe59302167181 — 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-b51f968c9b10.