Reduce internal code to array-only concepts - #761
Open
kbrock wants to merge 5 commits into
Open
Conversation
kbrock
force-pushed
the
attribute2
branch
2 times, most recently
from
April 29, 2026 06:26
d859da0 to
f565e5f
Compare
Reduces the number of methods that know about the column format. These now delegate to the existing ancestor_ids boundary methods rather than parsing the raw column themselves. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
child_ancestry now calls generate_ancestry(path_ids) instead of the format module's child_ancestry_value. That method was the only caller, so child_ancestry_value is removed from all format modules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
arrays can (and probably want to) use ancestor_ids for the column This does not work for others So we hard coded the column name for the formatting tests Gives us better coverage too
the value is just passed into the builder. no reason to store it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Prerequisite for the serializer: internal methods now work with
ancestor_ids(array) instead of the raw column string. Only theparse/generate boundary knows about the format.
Before
Builder methods accessed the raw column directly and parsed inline.
Each method carried format knowledge (root literal, delimiter parsing).
Array format went through the same parse/generate path as strings.
After
Internal methods delegate to
ancestor_idsboundary methods.child_ancestry_valueremoved from format modules (only caller waschild_ancestry, which now usesgenerate_ancestry(path_ids)).Array format with
ancestor_idscolumn skips parse/generate entirely.What this does NOT do
Non-obvious changes for developers
ancestor_idsas the column name.child_ancestry_valueis gone from format modules. Custom formatsubclasses should implement
generateinstead.@_ancestor_idsivar cache bypassed for array format. Goes awaywhen serializer lands.
Type of Change
Checklist
How Has This Been Tested
bundle exec rake test(mp1 sqlite)FORMAT=materialized_path2 bundle exec rake testFORMAT=materialized_path3 bundle exec rake testFORMAT=array DB=pg bundle exec rake testANCESTRY_COLUMN=family_tree bundle exec rake test