Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
879ab7d
SP2: physical project store design
david-w-t Aug 6, 2026
02b64eb
Add SP2 implementation plan
david-w-t Aug 6, 2026
f972a96
Ignore .worktrees/ (local git worktree scratch dir)
david-w-t Aug 6, 2026
d698ae2
SP2 T1: graphdb_ns home-relative routing (arity-2)
david-w-t Aug 6, 2026
9c48802
Fix: hard-tab constraint in graphdb_ns_tests.erl (SP2 T1)
david-w-t Aug 6, 2026
e6820fa
SP2 T2: graphdb_project physical store + Project handle + allocators
david-w-t Aug 6, 2026
60a60fa
SP2 T2 fix: tables_exist/1 must check all three tables, not just nodes
david-w-t Aug 6, 2026
aab2996
SP2 T3: graphdb_instance public write API takes Project (WIP, compile…
david-w-t Aug 6, 2026
6d187b7
SP2 T4: creation cascade allocates from and writes to Project
david-w-t Aug 6, 2026
2d5a4f5
SP2 T5: add_relationship write primitives take Home
david-w-t Aug 6, 2026
098a9ec
SP2 T6: connection RESOLVE (mandatory/auto) routes through Project
david-w-t Aug 6, 2026
0a3ee79
SP2 T7: remove/update relationship primitives take Home
david-w-t Aug 6, 2026
0442952
SP2 T8: instance reads take Project
david-w-t Aug 6, 2026
668138b
SP2 T9: add_class_membership routes through Project
david-w-t Aug 6, 2026
385b419
SP2 T10: get_node/retire_node/unretire_node/update_node_avps/delete_n…
david-w-t Aug 6, 2026
ca07eca
SP2 T10 fix: test-suite nref/AVP fixes + require_project gate on mgr …
david-w-t Aug 6, 2026
53336bf
SP2 T11: graphdb_mgr mutate/2 + dispatch/3 stale-arity fixes
david-w-t Aug 6, 2026
518c3e3
SP2 T12: graphdb_query session binds Project
david-w-t Aug 6, 2026
90abf0d
SP2 T12 fix: Home-route labels + scaffold check, add session tests
david-w-t Aug 6, 2026
bc3b020
SP2 T13: graphdb_rules scope-tag docs + test fixture polish
david-w-t Aug 6, 2026
c6b6ede
SP2 T14: test suite migration to project sessions
david-w-t Aug 6, 2026
a419628
SP2 T14 follow-up: route #q_instances_of{} through the bound project
david-w-t Aug 7, 2026
c3f44fe
SP2 T15: documentation updates
david-w-t Aug 7, 2026
70dc145
SP2 T15 fix: refresh root CLAUDE.md namespace section, correct workar…
david-w-t Aug 7, 2026
2809f8b
SP2 review wave A: production exports, xref gate, idempotent register…
david-w-t Aug 7, 2026
1bbdde8
SP2 review wave B: environment-bound label routing, read-path handle …
david-w-t Aug 7, 2026
7701109
SP2 review wave C: close singleton-crash and label-precedence gaps, f…
david-w-t Aug 7, 2026
6a8be0d
SP2: file remaining deferrals, retire the resolved project-boundary e…
david-w-t Aug 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ jobs:

- name: Compile
run: rebar3 compile

- name: Cross reference analysis (undefined function calls)
run: rebar3 xref
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ rebar3
CLAUDE.local.md
resume
ttb_last_config
.worktrees/
6 changes: 5 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ nref spaces:
- **Environment**: scaffold nrefs 1–35; permanent tier `[?LABEL_START, ?NREF_START)` = `[10001, 1000000)` holds English (10000), loader-assigned atom-labeled bootstrap nodes, and worker `init/1` seeds (graphdb_attr, graphdb_language sub-groups); runtime allocations ≥ `?NREF_START` (1000000). Boundaries are macros in `apps/graphdb/include/graphdb_nrefs.hrl` — **not** directives in `bootstrap.terms`. All graphdb node-nref allocation goes through `graphdb_nref` (first child of `graphdb_sup`): permanent phase during init, runtime phase after the `graphdb:start/2` flip.
- **Project**: allocator starts at **1** — no pre-assigned nrefs, no bootstrap file, no floor needed

Cross-database nref resolution: `characterization` and `reciprocal` fields always reference environment nrefs; `target_nref` is routed to environment or project based on the arc label's `target_kind` AVP stored in the environment attribute library. This routing is encoded by the pure `graphdb_ns` module (SP1). A project is an anchor node under `Projects` (nref 5); project write operations require a `graphdb_project` session (SP1 — see `docs/designs/project-env-reference-namespace-model-design.md` and `TASKS.md` → *Multi-project sessions*). SP1 is behaviour-preserving against today's single store; physical per-project storage is SP2.
Cross-database nref resolution is **home-relative**: `characterization` and `reciprocal` (arc labels), class nodes, and attribute nodes always resolve to the environment; `source_nref` and `target_nref` route through the operation's `Home :: environment | Project`. This routing is encoded by the pure `graphdb_ns` module (`namespace_of/2`, `target_namespace/2`, `node_table/1`, `rel_table/1`).

A project is an anchor node under `Projects` (nref 5). `graphdb_project:register_project/1` creates that anchor **and** the project's own three Mnesia tables (`nodes_<Anchor>`, `relationships_<Anchor>`, `counters_<Anchor>`); `open/1` resolves a project nref into a `Project` handle `#{anchor, nodes, rels, counters}`, validated by `require_project/1`. Project nref and rel-id allocation is project-local, starting at 1. Project write operations and instance reads take a `Project` handle as their first argument and reject a missing/invalid one with `{error, invalid_project}`.

Because each project's allocator restarts at 1, project nrefs collide numerically with environment bootstrap nrefs 1–35 — a bare nref is only unique within a `Home`. SP1 (reference & namespace model) and SP2 (physical project store) are both implemented; SP3 (distribution/residency + proxy dereference) and SP4 (migration) remain. See `docs/designs/project-env-reference-namespace-model-design.md`, `docs/designs/sp2-physical-project-store-design.md`, and `TASKS.md` → *Multi-project sessions*.

### Bootstrap Nref Quick-Reference (BFS, nrefs 1–35)

Expand Down
222 changes: 193 additions & 29 deletions TASKS.md

Large diffs are not rendered by default.

145 changes: 91 additions & 54 deletions apps/graphdb/CLAUDE.md

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions apps/graphdb/src/graphdb_attr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@
%% Seeded nref accessors
seeded_nrefs/0,
%% Cross-worker stamping
retro_stamp_attribute_types/0
retro_stamp_attribute_types/0,
%% Cross-worker lookup (graphdb_language, graphdb_rules init/1 seeding)
find_attribute_by_name/2
]).

%%---------------------------------------------------------------------
Expand All @@ -159,8 +161,7 @@
%%---------------------------------------------------------------------
-ifdef(TEST).
-export([
valid_target_kind/1,
find_attribute_by_name/2
valid_target_kind/1
]).
-endif.

Expand Down
794 changes: 468 additions & 326 deletions apps/graphdb/src/graphdb_instance.erl

Large diffs are not rendered by default.

Loading
Loading