cjm-dev-graph-schema 0.0.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2022, fastai
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,166 @@
1
+ Metadata-Version: 2.4
2
+ Name: cjm-dev-graph-schema
3
+ Version: 0.0.11
4
+ Summary: Development/decision-provenance schema for context graphs: Decision, Fact-slot/Assertion, Evidence, Thread, Session, Procedure, and Entity node kinds with deterministic identity and overlay/reasoning edges — the dev-domain sibling to cjm-transcript-graph-schema for graphing a project's own evolution.
5
+ Author-email: "Christian J. Mills" <9126128+cj-mills@users.noreply.github.com>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/cj-mills/cjm-dev-graph-schema
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
10
+ Requires-Python: >=3.12
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: cjm-context-graph-layer>=0.0.7
14
+ Requires-Dist: cjm-context-graph-primitives>=0.0.12
15
+ Dynamic: license-file
16
+
17
+ # cjm-dev-graph-schema
18
+
19
+ <!-- generated from the context graph by `cjm-context-graph readme` — do not edit by hand; edit the graph (the urge to hand-edit = move it on-graph) -->
20
+
21
+ Development/decision-provenance schema for context graphs: Decision, Fact-slot/Assertion, Evidence, Thread, Session, Procedure, and Entity node kinds with deterministic identity and overlay/reasoning edges — the dev-domain sibling to cjm-transcript-graph-schema for graphing a project's own evolution.
22
+
23
+ ## Modules
24
+
25
+ - **`cjm_dev_graph_schema.__init__`**
26
+ - **`cjm_dev_graph_schema.aliases`** — Rename-stable subject resolution (the A+aliases identity machinery).
27
+ - **`cjm_dev_graph_schema.identity`** — Deterministic node-id helpers for the dev/decision-provenance domain.
28
+ - **`cjm_dev_graph_schema.nodes`** — Typed node dataclasses for the dev schema (coarse + fine tier).
29
+ - **`cjm_dev_graph_schema.predicates`** — Typed predicates + their value-space metadata (the dedup decidability layer).
30
+ - **`cjm_dev_graph_schema.vocab`** — The reserved node-kind and edge-relation vocabulary for the dev/decision-provenance domain.
31
+ - **`tests.test_code_nodes`** — Code source-type nodes: deterministic identity, wire shapes, and edges.
32
+ - **`tests.test_entity`** — EntityNode: deterministic (sub-kind, key) identity, wire-dict, DEPENDS_ON edges.
33
+ - **`tests.test_fine_nodes`** — Fine-tier nodes: deterministic identity, wire shapes, and alias resolution.
34
+ - **`tests.test_nodes`** — Coarse-tier NoteNode: deterministic identity, wire-dict mapping, REFERENCES edges.
35
+ - **`tests.test_predicates`** — Predicate value-space: canonicalization, ordering, and conflict decisions.
36
+
37
+ ## API
38
+
39
+ ### `cjm_dev_graph_schema.aliases`
40
+
41
+ - `build_alias_index` _function_ — Index every entity by its key, current name, and each alias.
42
+ - `resolve_subject_id` _function_ — Resolve a subject name to its entity id via the alias index (no guessing).
43
+
44
+ ### `cjm_dev_graph_schema.identity`
45
+
46
+ - `assertion_node_id` _function_ — Assertion identity = (slot, canonical value, actor).
47
+ - `cell_node_id` _function_ — Cell identity = (notebook module, stable cell key).
48
+ - `check_node_id` _function_ — Check identity = (its work item, canonical text) — the same wording on two
49
+ - `code_module_node_id` _function_ — Code-module identity = (repo_key, module_path).
50
+ - `code_symbol_node_id` _function_ — Code-symbol identity = (enclosing module, qualified name).
51
+ - `code_text_node_id` _function_ — Code-text-region identity = (module, region key).
52
+ - `decision_node_id` _function_ — Decision identity = its canonical statement (idempotent re-records).
53
+ - `entity_node_id` _function_ — Entity identity = (sub-kind, stable key).
54
+ - `factslot_node_id` _function_ — Fact-slot identity = (subject, predicate).
55
+ - `note_node_id` _function_ — Note identity = its stable slug.
56
+ - `section_node_id` _function_ — Section identity = (enclosing Note, heading anchor slug).
57
+ - `series_node_id` _function_ — Series identity = its stable key.
58
+ - `session_node_id` _function_ — Session identity = its stable key (so DECIDED_IN/PRODUCED_IN converge).
59
+ - `topic_node_id` _function_ — Topic identity = its normalized name slug.
60
+
61
+ ### `cjm_dev_graph_schema.nodes`
62
+
63
+ - `AssertionNode` _class_ — One value claimed for a Fact-slot — identified by WHAT is claimed.
64
+ - `CellNode` _class_ — One VERBATIM notebook cell — the lossless source substrate of a notebook module.
65
+ - `CheckNode` _class_ — A definition-of-done check on a work item — a derivable gate, not prose.
66
+ - `CodeModuleNode` _class_ — The code source-type's coarse node: one decomposed `.py` module.
67
+ - `CodeSymbolNode` _class_ — A definition within a module: a function, class, or method.
68
+ - `CodeTextNode` _class_ — A non-def top-level region of a plain-`.py` module — the verbatim substrate BETWEEN symbols.
69
+ - `DecisionNode` _class_ — A decision/conclusion, with rationale recorded as edges, not prose.
70
+ - `EntityNode` _class_ — A first-class subject: a repo/lib, stage, capability, person, or term.
71
+ - `FactSlotNode` _class_ — A `(subject, predicate)` slot — the home for layered, supersede-able claims.
72
+ - `NoteNode` _class_ — The coarse-tier document node: one decomposed markdown/memory file.
73
+ - `SectionNode` _class_ — One heading-delimited section of a Note's body — the navigable unit + anchor target.
74
+ - `SeriesNode` _class_ — An ordered collection/progression a note belongs to (a Quarto series, …).
75
+ - `SessionNode` _class_ — A working session — the home decisions/facts are PRODUCED_IN / DECIDED_IN.
76
+ - `TopicNode` _class_ — A category/tag facet — a thematic-clustering subject shared across notes.
77
+
78
+ ### `cjm_dev_graph_schema.predicates`
79
+
80
+ - `Predicate` _class_ — A typed predicate's value-space (the contradiction decidability metadata).
81
+ - `active_contradiction` _function_ — Whether a slot's ACTIVE (non-superseded) values form a hard contradiction.
82
+ - `canonical_value` _function_ — Canonicalize a value so equal claims collapse to one Assertion.
83
+ - `get_predicate` _function_ — Look up a predicate's value-space; None = an untyped freetext predicate.
84
+ - `is_multivalued` _function_ — Whether the predicate is a SET slot (distinct values coexist, never conflict).
85
+ - `is_ordered` _function_ — Whether the predicate's values have a "later supersedes earlier" ordering.
86
+ - `is_typed` _function_ — Whether the predicate is in the typed registry.
87
+ - `ordering_supersedes` _function_ — For an ordered predicate, does `new_value` supersede `old_value`?
88
+ - `soft_conflict` _function_ — Whether an UNTYPED slot's active values disagree (a worklist candidate).
89
+ - `values_conflict` _function_ — Whether two values are a HARD contradiction under the value-space.
90
+
91
+ ### `cjm_dev_graph_schema.vocab`
92
+
93
+ - `DevNodeKinds` _class_ — Node labels of the dev/decision-provenance schema (the locked model).
94
+ - `DevRelations` _class_ — Dev-domain edge relations (reserved up front).
95
+
96
+ ### `tests.test_code_nodes`
97
+
98
+ - `test_cell_contains_next_documents_references_edges` _function_
99
+ - `test_cell_identity_prefers_nbformat_id_else_index` _function_
100
+ - `test_cell_wire_is_verbatim_and_typed` _function_
101
+ - `test_codetext_region_identity_and_wire` _function_
102
+ - `test_module_about_targets_repo_entity` _function_
103
+ - `test_module_contains_edges_order_regions` _function_
104
+ - `test_module_defines_and_imports_edges` _function_
105
+ - `test_module_identity_is_repokey_path` _function_
106
+ - `test_module_wire_carries_relevance_fields_and_source` _function_
107
+ - `test_nested_defines` _function_
108
+ - `test_nested_symbol_has_no_body_props` _function_
109
+ - `test_symbol_identity_is_module_qualname` _function_
110
+ - `test_symbol_uses_edges_superset_dedups_and_skips_self` _function_
111
+ - `test_symbol_wire_and_call_edges` _function_
112
+ - `test_symbol_without_content_hash_has_no_source` _function_
113
+ - `test_top_level_symbol_carries_verbatim_body_and_order` _function_
114
+
115
+ ### `tests.test_entity`
116
+
117
+ - `test_depends_on_edges_target_same_kind_ids` _function_
118
+ - `test_id_from_kind_and_key` _function_
119
+ - `test_same_key_different_kind_differs` _function_
120
+ - `test_to_graph_node_shape` _function_
121
+
122
+ ### `tests.test_fine_nodes`
123
+
124
+ - `test_assertion_identity_is_slot_value_actor` _function_
125
+ - `test_assertion_wire_and_edges` _function_
126
+ - `test_decision_and_session` _function_
127
+ - `test_entity_aliases_resolve_rename_stable` _function_
128
+ - `test_factslot_identity_is_subject_predicate` _function_
129
+
130
+ ### `tests.test_nodes`
131
+
132
+ - `test_cross_post_alias_resolution` _function_
133
+ - `test_cross_post_edges_anchor_resolves_to_section_id` _function_
134
+ - `test_facets_stored_on_node_when_present` _function_
135
+ - `test_id_changes_with_slug` _function_
136
+ - `test_id_is_deterministic_from_slug` _function_
137
+ - `test_no_references_no_edges` _function_
138
+ - `test_optional_fields_omitted_when_empty` _function_
139
+ - `test_reference_edges_target_linked_note_ids` _function_
140
+ - `test_section_identity_and_anchor_resolution_by_construction` _function_
141
+ - `test_section_node_shape_carries_verbatim_text` _function_
142
+ - `test_section_structural_edges_membership_and_hierarchy` _function_
143
+ - `test_series_edges_membership` _function_
144
+ - `test_series_node_shape_and_identity` _function_
145
+ - `test_tagged_edges_target_shared_topic_ids` _function_
146
+ - `test_to_graph_node_shape` _function_
147
+ - `test_topic_node_shape_and_identity` _function_
148
+
149
+ ### `tests.test_predicates`
150
+
151
+ - `test_active_contradiction_and_soft_conflict` _function_
152
+ - `test_aka_distinct_values_never_conflict` _function_
153
+ - `test_aka_is_multivalued_slug_set` _function_
154
+ - `test_canonical_value_enum_lowercases` _function_
155
+ - `test_canonical_value_semver_strips_v_prefix` _function_
156
+ - `test_canonical_value_untyped_preserves_case` _function_
157
+ - `test_ordering_supersedes_semver` _function_
158
+ - `test_ordering_supersedes_task_state_enum` _function_
159
+ - `test_rename_disposition_is_unordered_enum` _function_
160
+ - `test_typed_predicate_registry` _function_
161
+ - `test_values_conflict_only_typed_unordered` _function_
162
+ - `test_version_is_ordered_semver` _function_
163
+
164
+ ## Dependencies
165
+
166
+ **Used by:** `cjm-context-graph-projection`, `cjm-markdown-decompose-core`, `cjm-notebook-decompose-core`, `cjm-python-decompose-core`
@@ -0,0 +1,150 @@
1
+ # cjm-dev-graph-schema
2
+
3
+ <!-- generated from the context graph by `cjm-context-graph readme` — do not edit by hand; edit the graph (the urge to hand-edit = move it on-graph) -->
4
+
5
+ Development/decision-provenance schema for context graphs: Decision, Fact-slot/Assertion, Evidence, Thread, Session, Procedure, and Entity node kinds with deterministic identity and overlay/reasoning edges — the dev-domain sibling to cjm-transcript-graph-schema for graphing a project's own evolution.
6
+
7
+ ## Modules
8
+
9
+ - **`cjm_dev_graph_schema.__init__`**
10
+ - **`cjm_dev_graph_schema.aliases`** — Rename-stable subject resolution (the A+aliases identity machinery).
11
+ - **`cjm_dev_graph_schema.identity`** — Deterministic node-id helpers for the dev/decision-provenance domain.
12
+ - **`cjm_dev_graph_schema.nodes`** — Typed node dataclasses for the dev schema (coarse + fine tier).
13
+ - **`cjm_dev_graph_schema.predicates`** — Typed predicates + their value-space metadata (the dedup decidability layer).
14
+ - **`cjm_dev_graph_schema.vocab`** — The reserved node-kind and edge-relation vocabulary for the dev/decision-provenance domain.
15
+ - **`tests.test_code_nodes`** — Code source-type nodes: deterministic identity, wire shapes, and edges.
16
+ - **`tests.test_entity`** — EntityNode: deterministic (sub-kind, key) identity, wire-dict, DEPENDS_ON edges.
17
+ - **`tests.test_fine_nodes`** — Fine-tier nodes: deterministic identity, wire shapes, and alias resolution.
18
+ - **`tests.test_nodes`** — Coarse-tier NoteNode: deterministic identity, wire-dict mapping, REFERENCES edges.
19
+ - **`tests.test_predicates`** — Predicate value-space: canonicalization, ordering, and conflict decisions.
20
+
21
+ ## API
22
+
23
+ ### `cjm_dev_graph_schema.aliases`
24
+
25
+ - `build_alias_index` _function_ — Index every entity by its key, current name, and each alias.
26
+ - `resolve_subject_id` _function_ — Resolve a subject name to its entity id via the alias index (no guessing).
27
+
28
+ ### `cjm_dev_graph_schema.identity`
29
+
30
+ - `assertion_node_id` _function_ — Assertion identity = (slot, canonical value, actor).
31
+ - `cell_node_id` _function_ — Cell identity = (notebook module, stable cell key).
32
+ - `check_node_id` _function_ — Check identity = (its work item, canonical text) — the same wording on two
33
+ - `code_module_node_id` _function_ — Code-module identity = (repo_key, module_path).
34
+ - `code_symbol_node_id` _function_ — Code-symbol identity = (enclosing module, qualified name).
35
+ - `code_text_node_id` _function_ — Code-text-region identity = (module, region key).
36
+ - `decision_node_id` _function_ — Decision identity = its canonical statement (idempotent re-records).
37
+ - `entity_node_id` _function_ — Entity identity = (sub-kind, stable key).
38
+ - `factslot_node_id` _function_ — Fact-slot identity = (subject, predicate).
39
+ - `note_node_id` _function_ — Note identity = its stable slug.
40
+ - `section_node_id` _function_ — Section identity = (enclosing Note, heading anchor slug).
41
+ - `series_node_id` _function_ — Series identity = its stable key.
42
+ - `session_node_id` _function_ — Session identity = its stable key (so DECIDED_IN/PRODUCED_IN converge).
43
+ - `topic_node_id` _function_ — Topic identity = its normalized name slug.
44
+
45
+ ### `cjm_dev_graph_schema.nodes`
46
+
47
+ - `AssertionNode` _class_ — One value claimed for a Fact-slot — identified by WHAT is claimed.
48
+ - `CellNode` _class_ — One VERBATIM notebook cell — the lossless source substrate of a notebook module.
49
+ - `CheckNode` _class_ — A definition-of-done check on a work item — a derivable gate, not prose.
50
+ - `CodeModuleNode` _class_ — The code source-type's coarse node: one decomposed `.py` module.
51
+ - `CodeSymbolNode` _class_ — A definition within a module: a function, class, or method.
52
+ - `CodeTextNode` _class_ — A non-def top-level region of a plain-`.py` module — the verbatim substrate BETWEEN symbols.
53
+ - `DecisionNode` _class_ — A decision/conclusion, with rationale recorded as edges, not prose.
54
+ - `EntityNode` _class_ — A first-class subject: a repo/lib, stage, capability, person, or term.
55
+ - `FactSlotNode` _class_ — A `(subject, predicate)` slot — the home for layered, supersede-able claims.
56
+ - `NoteNode` _class_ — The coarse-tier document node: one decomposed markdown/memory file.
57
+ - `SectionNode` _class_ — One heading-delimited section of a Note's body — the navigable unit + anchor target.
58
+ - `SeriesNode` _class_ — An ordered collection/progression a note belongs to (a Quarto series, …).
59
+ - `SessionNode` _class_ — A working session — the home decisions/facts are PRODUCED_IN / DECIDED_IN.
60
+ - `TopicNode` _class_ — A category/tag facet — a thematic-clustering subject shared across notes.
61
+
62
+ ### `cjm_dev_graph_schema.predicates`
63
+
64
+ - `Predicate` _class_ — A typed predicate's value-space (the contradiction decidability metadata).
65
+ - `active_contradiction` _function_ — Whether a slot's ACTIVE (non-superseded) values form a hard contradiction.
66
+ - `canonical_value` _function_ — Canonicalize a value so equal claims collapse to one Assertion.
67
+ - `get_predicate` _function_ — Look up a predicate's value-space; None = an untyped freetext predicate.
68
+ - `is_multivalued` _function_ — Whether the predicate is a SET slot (distinct values coexist, never conflict).
69
+ - `is_ordered` _function_ — Whether the predicate's values have a "later supersedes earlier" ordering.
70
+ - `is_typed` _function_ — Whether the predicate is in the typed registry.
71
+ - `ordering_supersedes` _function_ — For an ordered predicate, does `new_value` supersede `old_value`?
72
+ - `soft_conflict` _function_ — Whether an UNTYPED slot's active values disagree (a worklist candidate).
73
+ - `values_conflict` _function_ — Whether two values are a HARD contradiction under the value-space.
74
+
75
+ ### `cjm_dev_graph_schema.vocab`
76
+
77
+ - `DevNodeKinds` _class_ — Node labels of the dev/decision-provenance schema (the locked model).
78
+ - `DevRelations` _class_ — Dev-domain edge relations (reserved up front).
79
+
80
+ ### `tests.test_code_nodes`
81
+
82
+ - `test_cell_contains_next_documents_references_edges` _function_
83
+ - `test_cell_identity_prefers_nbformat_id_else_index` _function_
84
+ - `test_cell_wire_is_verbatim_and_typed` _function_
85
+ - `test_codetext_region_identity_and_wire` _function_
86
+ - `test_module_about_targets_repo_entity` _function_
87
+ - `test_module_contains_edges_order_regions` _function_
88
+ - `test_module_defines_and_imports_edges` _function_
89
+ - `test_module_identity_is_repokey_path` _function_
90
+ - `test_module_wire_carries_relevance_fields_and_source` _function_
91
+ - `test_nested_defines` _function_
92
+ - `test_nested_symbol_has_no_body_props` _function_
93
+ - `test_symbol_identity_is_module_qualname` _function_
94
+ - `test_symbol_uses_edges_superset_dedups_and_skips_self` _function_
95
+ - `test_symbol_wire_and_call_edges` _function_
96
+ - `test_symbol_without_content_hash_has_no_source` _function_
97
+ - `test_top_level_symbol_carries_verbatim_body_and_order` _function_
98
+
99
+ ### `tests.test_entity`
100
+
101
+ - `test_depends_on_edges_target_same_kind_ids` _function_
102
+ - `test_id_from_kind_and_key` _function_
103
+ - `test_same_key_different_kind_differs` _function_
104
+ - `test_to_graph_node_shape` _function_
105
+
106
+ ### `tests.test_fine_nodes`
107
+
108
+ - `test_assertion_identity_is_slot_value_actor` _function_
109
+ - `test_assertion_wire_and_edges` _function_
110
+ - `test_decision_and_session` _function_
111
+ - `test_entity_aliases_resolve_rename_stable` _function_
112
+ - `test_factslot_identity_is_subject_predicate` _function_
113
+
114
+ ### `tests.test_nodes`
115
+
116
+ - `test_cross_post_alias_resolution` _function_
117
+ - `test_cross_post_edges_anchor_resolves_to_section_id` _function_
118
+ - `test_facets_stored_on_node_when_present` _function_
119
+ - `test_id_changes_with_slug` _function_
120
+ - `test_id_is_deterministic_from_slug` _function_
121
+ - `test_no_references_no_edges` _function_
122
+ - `test_optional_fields_omitted_when_empty` _function_
123
+ - `test_reference_edges_target_linked_note_ids` _function_
124
+ - `test_section_identity_and_anchor_resolution_by_construction` _function_
125
+ - `test_section_node_shape_carries_verbatim_text` _function_
126
+ - `test_section_structural_edges_membership_and_hierarchy` _function_
127
+ - `test_series_edges_membership` _function_
128
+ - `test_series_node_shape_and_identity` _function_
129
+ - `test_tagged_edges_target_shared_topic_ids` _function_
130
+ - `test_to_graph_node_shape` _function_
131
+ - `test_topic_node_shape_and_identity` _function_
132
+
133
+ ### `tests.test_predicates`
134
+
135
+ - `test_active_contradiction_and_soft_conflict` _function_
136
+ - `test_aka_distinct_values_never_conflict` _function_
137
+ - `test_aka_is_multivalued_slug_set` _function_
138
+ - `test_canonical_value_enum_lowercases` _function_
139
+ - `test_canonical_value_semver_strips_v_prefix` _function_
140
+ - `test_canonical_value_untyped_preserves_case` _function_
141
+ - `test_ordering_supersedes_semver` _function_
142
+ - `test_ordering_supersedes_task_state_enum` _function_
143
+ - `test_rename_disposition_is_unordered_enum` _function_
144
+ - `test_typed_predicate_registry` _function_
145
+ - `test_values_conflict_only_typed_unordered` _function_
146
+ - `test_version_is_ordered_semver` _function_
147
+
148
+ ## Dependencies
149
+
150
+ **Used by:** `cjm-context-graph-projection`, `cjm-markdown-decompose-core`, `cjm-notebook-decompose-core`, `cjm-python-decompose-core`
@@ -0,0 +1 @@
1
+ __version__ = "0.0.11"
@@ -0,0 +1,62 @@
1
+ """Rename-stable subject resolution (the A+aliases identity machinery).
2
+
3
+ An Entity's identity `key` is a durable, name-INDEPENDENT conceptual slug (e.g.
4
+ `torch-utils`); the current repo name is a `name` property; prior names + variant
5
+ link-slugs are `aliases`. So a fact ABOUT an entity that itself got renamed keeps
6
+ one stable subject — the historical "keep cjm-torch-plugin-utils" claim and the
7
+ current "cjm-substrate-torch-utils" both resolve to the SAME entity.
8
+
9
+ This is the CONFIRMED-equivalence resolution structure. A CANDIDATE equivalence
10
+ (fuzzy slug-drift) becomes an alias via the propose/confirm worklist, never auto-
11
+ guessed here. Pure: builds an index from entity node forms and looks subjects up.
12
+ """
13
+
14
+ from typing import Any, Dict, Iterable, List, Optional
15
+
16
+
17
+ def _props(node: Any) -> Dict[str, Any]:
18
+ """Properties dict from an entity wire dict / GraphNode (tolerant access)."""
19
+ p = getattr(node, "properties", None)
20
+ if p is None and isinstance(node, dict):
21
+ p = node.get("properties")
22
+ return p or {}
23
+
24
+
25
+ def _node_id(node: Any) -> Optional[str]:
26
+ """A node's id (typed GraphNode or wire dict)."""
27
+ if isinstance(node, dict):
28
+ return node.get("id")
29
+ return getattr(node, "id", None)
30
+
31
+
32
+ def _canon(name: str) -> str:
33
+ """Canonical lookup key for a subject name (case/space-insensitive)."""
34
+ return str(name).strip().lower()
35
+
36
+
37
+ def build_alias_index(
38
+ entities: Iterable[Any], # Entity node wire dicts / GraphNodes
39
+ ) -> Dict[str, str]: # canon(key|name|alias) -> entity node id
40
+ """Index every entity by its key, current name, and each alias.
41
+
42
+ First writer wins on a collision (`setdefault`) — the durable `key` is added
43
+ first, so a name shared transiently can't hijack a key-resolution."""
44
+ index: Dict[str, str] = {}
45
+ for e in entities:
46
+ nid = _node_id(e)
47
+ if not nid:
48
+ continue
49
+ p = _props(e)
50
+ names: List[Any] = [p.get("key"), p.get("name")] + list(p.get("aliases") or [])
51
+ for n in names:
52
+ if n:
53
+ index.setdefault(_canon(n), nid)
54
+ return index
55
+
56
+
57
+ def resolve_subject_id(
58
+ index: Dict[str, str], # An index from `build_alias_index`
59
+ name: str, # A subject name / key / alias
60
+ ) -> Optional[str]: # The entity node id, or None when unresolved
61
+ """Resolve a subject name to its entity id via the alias index (no guessing)."""
62
+ return index.get(_canon(name))