Relocate class-domain read helpers (validate_template_scope_in_txn, search_class_taxonomy) into graphdb_class#46
Merged
Conversation
… graphdb_instance The helper is pure class-domain logic (template-kind check + taxonomy-ancestry scope) — three of its four calls were already into graphdb_class. Moving it turns those into local unqualified calls and removes graphdb_instance reaching into class internals to validate Connection-arc template scope. graphdb_instance now calls graphdb_class:validate_template_scope_in_txn/3; behaviour byte-identical (same abort terms, same phase semantics). A small head_parent/1 helper is duplicated into graphdb_class (in keeping with the codebase's deliberate per-worker micro-helper duplication). Direct CT tests added in graphdb_class_SUITE (in-scope success, non-template, out-of-ancestry); the add_relationship integration tests in graphdb_instance_SUITE stay (they exercise add_relationship end-to-end, a different unit). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
…aphdb_instance search_class_taxonomy/2 + search_first_in_ancestors/2 are pure class-domain reads (walk a class + its taxonomy ancestors for a bound AVP); both their non-trivial calls were already into graphdb_class (get_class/1, ancestors/1). Moving them turns those into local calls and makes the helper a public graphdb_class read, sibling to class_in_ancestry/2. graphdb_instance's collect_class_hits/2 (the Priority-2 class-value inheritance step) now calls graphdb_class:search_class_taxonomy/2; the resolve_value orchestration and ambiguity policy stay in graphdb_instance. Behaviour-identical (still reads via the class gen_server's public get_class/ancestors). A find_avp_value/2 twin is duplicated into graphdb_class (per the codebase's per-worker micro-helper convention); graphdb_instance keeps its own (4 other callers). +3 direct CT tests in graphdb_class_SUITE (on-class, on-ancestor, not-found); resolve_value inheritance tests in graphdb_instance_SUITE stay. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
…n + search_class_taxonomy Add the two relocated functions to the graphdb_class API section of the worker CLAUDE.md, and refine the export-list grouping comments. Architecture.md is intentionally untouched: the relocations are internal refactors that leave the public contract (resolve_value/2, add_relationship signatures) and the documented inheritance algorithm unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
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.
Relocate class-domain read helpers into
graphdb_classA small, behaviour-preserving cleanup that follows up the atomic
add_relationshipwork (#44, #45): two helper families that lived ingraphdb_instancebut are pure class-domain logic move tographdb_class, where the reads they depend on already live.Commits
validate_template_scope_in_txn/3— confirms a Connection arc's templateis a
kind=templatenode whose parent class is in the source's or target'staxonomic ancestry. Three of its four calls were already into
graphdb_class(get_template_in_txn/1,class_in_ancestry_in_txn/2×2);moving it turns those into local calls.
graphdb_instance:add_relationshipnow calls
graphdb_class:validate_template_scope_in_txn/3.search_class_taxonomy/2+search_first_in_ancestors/2— walk a classand its taxonomy ancestors (nearest-first) for the first bound AVP. Both
non-trivial calls were already into
graphdb_class(get_class/1,ancestors/1). Now a publicgraphdb_classread, sibling toclass_in_ancestry/2. The per-instance membership orchestration and theambiguity policy (
resolve_from_class/collect_class_hits/classify_class_hits) stay ingraphdb_instance— only the per-classsub-walk moves.
Docs — worker
CLAUDE.mdupdated for both relocated functions; exportgrouping comments refined.
Architecture.mddeliberately untouched (internalrefactor; public contract and documented inheritance algorithm unchanged).
Behaviour
Byte-identical: same return/abort terms, same read semantics (the relocated
functions still read via the class gen_server's public
get_class/ancestors,so concurrency is unchanged). Two micro-helpers (
head_parent/1,find_avp_value/2) are duplicated intographdb_class— in keeping with thecodebase's deliberate per-worker micro-helper convention (no shared util
module);
graphdb_instancekeeps its own (other callers remain).Tests
graphdb_class_SUITE59 → 65 (+6 direct CT cases: template-scope in/out ofancestry + non-template; class-taxonomy on-class/on-ancestor/not-found).
graphdb_instance_SUITEunchanged at 114 (itsadd_relationshipandresolve_valueintegration tests still exercise the relocated logic end-to-end).Clean compile, zero warnings.
🤖 Generated with Claude Code