stefankroes/ancestry
74.1
Strong · 28 September 2026
1.8k
lines of production code
Ruby
primary language
2
measurements over time
What this system is
This system is the Ancestry gem, a Ruby library that enables ActiveRecord models to manage hierarchical tree structures. It supports multiple storage strategies, including materialized paths, arrays, and PostgreSQL ltree, while providing efficient navigation and caching capabilities. The library is designed to work across various database backends and modern Rails versions, offering configurable behavior for ancestry updates and data formats.
Features
Added diagram images for tree relationship concepts
Added Mermaid diagram source files (ancestors, children, descendants, indirects, leaves, parent, path, root, siblings, subtree) to the img directory. These diagrams visually illustrate various tree node relationships using a consistent graph structure with specific nodes highlighted as references or selected.
img · high confidence
Added local development and testing utility scripts
New executable scripts have been added to the bin directory to streamline local setup and testing workflows. The bin/console script provides an interactive Ruby IRB environment pre-loaded with ActiveSupport, ActiveRecord, and Ancestry, facilitating quick model inspection and debugging. The bin/setup script automates the creation of test databases for both PostgreSQL and MySQL, allowing developers to easily initialize the required database schemas for running specs.
bin · high confidence
Initial commit: Ancestry gem v6.0 with modernized tooling and new tree features
This entry marks the initial commit for the Ancestry gem, establishing the foundation for version 6.0. It introduces significant new capabilities for tree management, including virtual database columns for \parent\_id\, \root\_id\, and \depth\ to enable efficient eager loading via \belongs\_to :parent\ and \has\_many :children\ associations, as well as support for PostgreSQL \integer\[\]\ ancestry formats and UUID primary keys. The commit also modernizes the development environment by adding a \.rubocop.yml\ configuration, an \Appraisals\ file for testing against Rails 6.0–8.0, and new Rake tasks for database management and code coverage, while removing legacy plugin hooks (\init.rb\, \install.rb\) and updating the license year.
(repo-wide) · high confidence
Behavioural changes
Ancestry library refactored with new format strategies and adapter detection
The lib/ancestry module has been significantly restructured to support multiple tree storage strategies (materialized\_path, materialized\_path2, materialized\_path3, ltree, and array) via dedicated format modules, replacing the previous monolithic implementation. A new Ancestry::Adapter module centralizes database adapter detection (PostgreSQL, MySQL, SQLite) to enable cross-database SQL generation, particularly for string concatenation and sorting. The library now introduces virtual cache columns for depth, parent, and root IDs, allowing performance optimizations without requiring physical database columns. Additionally, the migration helper has been updated to support these new formats and virtual columns, and the core has\_ancestry DSL now accepts options for :ancestry\_format, :cache\_depth, :parent, :root, and :counter\_cache to configure these behaviors.
lib/ancestry · high confidence
Configurable default ancestry storage and update strategies
The library now exposes global configuration options to control how ancestry data is stored and updated. Users can set the default ancestry format to :materialized\_path2 (using slash-delimited paths like '/1/2/') instead of the legacy :materialized\_path format, and can specify the primary key format (:integer, :uuid, or :string) for validation. Additionally, the default update strategy is configurable, allowing users to choose between the legacy :ruby strategy (which loads records into memory and triggers callbacks) and the :sql strategy (which updates records directly in the database, currently supported only for PostgreSQL, though it skips callbacks and may leave in-memory objects with stale data).
lib · high confidence
Removal of legacy Rails initialization file
The legacy \rails/init.rb\ file has been removed. This file previously executed \require 'ancestry'\ to load the ancestry gem during Rails initialization. Its removal indicates that the application no longer relies on this specific initialization hook for loading the ancestry gem, likely due to a shift in how dependencies are loaded or a change in the gem's integration method.
rails · high confidence
Test coverage
Comprehensive test suite for tree arrangement, navigation, and caching; Refactor test infrastructure to support multiple databases and coverage.
Dependencies
Update Ancestry gemspec and development dependencies
The Ancestry gemspec has been updated to require ActiveRecord \>= 5.2.6 and Ruby \>= 2.5, adding a runtime dependency on the 'logger' library. Development dependencies have been refreshed to include appraisal, minitest, rake \~\> 13.0, simplecov, simplecov-json, and yard, while the Gemfile now explicitly pins sqlite3 \~\> 1.6.9 and includes mysql2 and trilogy for testing.
(dependencies) · high confidence
Updated gemfile constraints for Rails 6.0–8.1 and SQLite3 versions
The gemfiles for Rails versions 6.0 through 8.1 have been updated to align with specific ActiveRecord and SQLite3 version constraints. Rails 6.0 and 6.1 now require SQLite3 \~\> 1.6.9 and pin concurrent-ruby to \< 1.3.5, while Rails 7.0, 7.1, and 7.2 use SQLite3 \< 2.0. Rails 8.0 and 8.1 require SQLite3 \>= 2.1 and no longer include the concurrent-ruby dependency. The Rails 8.1 gemfile also adds a frozen\_string\_literal comment and removes the trilogy gem dependency present in earlier versions.
gemfiles · 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 73 → 74 (+0.8)
- Rubric changed (rubric-2026.09.8 → rubric-2026.09.16) — scores are not directly comparable.
Lenses
- Code Health 95 → 95 (+0.0)
- Architecture 91 → 97 (+6.1)
- Maturity 64 → 64 (-0.0)
- Readiness 72 → 72 (+0.0)
- Security 90 → 92 (+2.6)
Resolved (3)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Off-boarding risk: anonymized user #1
New (2)
- Alias duplication: acts_as_tree is a well-known alias for has_ancestry in the Rails community (originating from the acts_as_tree gem). While providing backward compatibility is good, exposing both as top-level class methods on the same module without clear deprecation markers or distinct documentation intent can confuse users about which is the canonical API.
- Off-boarding risk: anonymized user #1
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
stefankroes/ancestry 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 e8c09d27929a292452901c8b5f34b1b0a1b882b4 — 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.