Skip to content

Task 8: scaffold nref constants → shared graphdb_nrefs.hrl header#23

Merged
david-w-t merged 8 commits into
davidwt-com:mainfrom
david-w-t:develop
May 20, 2026
Merged

Task 8: scaffold nref constants → shared graphdb_nrefs.hrl header#23
david-w-t merged 8 commits into
davidwt-com:mainfrom
david-w-t:develop

Conversation

@david-w-t
Copy link
Copy Markdown
Contributor

Summary

  • Introduces apps/graphdb/include/graphdb_nrefs.hrl with 36 named macros covering all scaffold nrefs 1–35 (NREF_*, NAME_ATTR_*, ARC_*) and the permanent English instance nref 10000 (NREF_ENGLISH)
  • Adds graphdb_nrefs.erl with scaffold_spec/0 and verify/0 — verifies every scaffold nref exists in Mnesia with correct kind and name at bootstrap time
  • Wires graphdb_nrefs:verify/0 into graphdb_bootstrap:do_load/0 as a fatal post-bootstrap check
  • Adds code:delete/purge of graphdb_bootstrap in graphdb_mgr:init/1 immediately after successful bootstrap
  • Replaces all inline -define blocks in five source files (graphdb_attr, graphdb_class, graphdb_instance, graphdb_language, graphdb_mgr) with the shared header
  • Migrates all scaffold nref integer literals in seven test files to the shared header macros
  • Adds graphdb_nrefs_SUITE with two CT tests: verify_returns_ok and bootstrap_module_unloaded

Test plan

  • All 320 tests pass (217 CT + 103 EUnit), zero warnings
  • graphdb_nrefs_SUITE:verify_returns_okgraphdb_nrefs:verify/0 returns ok after full bootstrap
  • graphdb_nrefs_SUITE:bootstrap_module_unloadedgraphdb_bootstrap module is not loaded after graphdb_mgr starts
  • No hardcoded scaffold nref integers remain in migrated source or test files

🤖 Generated with Claude Code

david-w-t and others added 8 commits May 20, 2026 05:35
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
scaffold_spec/0 enumerates all 36 scaffold+permanent nrefs as
{MacroName, Nref, Kind, ExpectedName} tuples.  verify/0 reads each
from Mnesia and confirms kind + name AVP match.

CT suite: verify_returns_ok passes; bootstrap_module_unloaded fails
(expected -- unloading not yet implemented, pending Task 4).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After rebuild_and_verify_caches() succeeds, verify/0 confirms every
scaffold nref has the expected kind and name AVP in Mnesia.  A
mismatch is a fatal startup error (throws {error, ...}).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
code:delete/1 + code:purge/1 in graphdb_mgr:init/1 removes the module
from the code server immediately after a successful load.  Erlang
reloads it from the code path on demand (e.g. CT suite restarts).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace inline scaffold-nref -define blocks in five source files with
-include_lib("graphdb/include/graphdb_nrefs.hrl") and rename all
usages to the canonical macro names (NREF_*, NAME_ATTR_*, ARC_*).

graphdb_attr    : PARENT_NAMES/LITERALS/RELATIONSHIPS, NAME_ATTR_FOR_ATTRIBUTE,
                  ATTR_CHILD/PARENT_ARC, TEMPLATE_AVP_NREF
graphdb_class   : CLASSES_CATEGORY, NAME_ATTR_FOR_CLASS, CLASS_CHILD/PARENT_ARC
graphdb_instance: NAME_ATTR_FOR_INSTANCE, INST_CHILD/PARENT_ARC,
                  CLASS/INSTANCE_MEMBERSHIP_ARC, TEMPLATE_AVP_NREF
graphdb_language: PARENT_LITERALS/CLASSES, HUMAN_LANGS, NAME_ATTR_FOR_*,
                  ATTR/CLASS/INST arc macros, CLASS/INSTANCE_MEMBERSHIP_ARC
graphdb_mgr     : PARENT_ARCS updated to use arc macros; CLASS_MEMBERSHIP_ARC

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add -include_lib("graphdb/include/graphdb_nrefs.hrl") to 7 test files
and replace all raw scaffold nref integers with named macros:

  attribute => 17/18/19/20/31  →  ?NAME_ATTR_CATEGORY/ATTRIBUTE/CLASS/INSTANCE, ?ARC_TEMPLATE
  characterization/reciprocal  →  ?ARC_CAT/ATTR/CLS/INST_* arc macros
  mnesia:read(nodes, N)        →  named macros
  10000 (English nref)         →  ?NREF_ENGLISH
  language subcategory tuples  →  ?NREF_HUMAN_LANGS etc.
  NamesGroup / RelGroup lists  →  full macro expansion

320 tests (217 CT + 103 EUnit), all green.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@david-w-t david-w-t merged commit c2988a9 into davidwt-com:main May 20, 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