Skip to content

Relocate class-domain read helpers (validate_template_scope_in_txn, search_class_taxonomy) into graphdb_class#46

Merged
david-w-t merged 3 commits into
davidwt-com:mainfrom
david-w-t:develop
Jun 22, 2026
Merged

Relocate class-domain read helpers (validate_template_scope_in_txn, search_class_taxonomy) into graphdb_class#46
david-w-t merged 3 commits into
davidwt-com:mainfrom
david-w-t:develop

Conversation

@david-w-t

Copy link
Copy Markdown
Contributor

Relocate class-domain read helpers into graphdb_class

A small, behaviour-preserving cleanup that follows up the atomic
add_relationship work (#44, #45): two helper families that lived in
graphdb_instance but are pure class-domain logic move to
graphdb_class, where the reads they depend on already live.

Commits

  1. validate_template_scope_in_txn/3 — confirms a Connection arc's template
    is a kind=template node whose parent class is in the source's or target's
    taxonomic 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_relationship
    now calls graphdb_class:validate_template_scope_in_txn/3.

  2. search_class_taxonomy/2 + search_first_in_ancestors/2 — walk a class
    and 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 public graphdb_class read, sibling to
    class_in_ancestry/2. The per-instance membership orchestration and the
    ambiguity policy (resolve_from_class/collect_class_hits/
    classify_class_hits) stay in graphdb_instance — only the per-class
    sub-walk moves.

  3. Docs — worker CLAUDE.md updated for both relocated functions; export
    grouping comments refined. Architecture.md deliberately untouched (internal
    refactor; 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 into graphdb_class — in keeping with the
codebase's deliberate per-worker micro-helper convention (no shared util
module); graphdb_instance keeps its own (other callers remain).

Tests

graphdb_class_SUITE 59 → 65 (+6 direct CT cases: template-scope in/out of
ancestry + non-template; class-taxonomy on-class/on-ancestor/not-found).
graphdb_instance_SUITE unchanged at 114 (its add_relationship and
resolve_value integration tests still exercise the relocated logic end-to-end).
Clean compile, zero warnings.

🤖 Generated with Claude Code

david-w-t and others added 3 commits June 21, 2026 11:22
… 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

@david-w-t david-w-t left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@david-w-t david-w-t merged commit 702926a into davidwt-com:main Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant